OpenCL defines half data type, and it seems clang accepts this and generates code for it.
The backend support for operations with fp16 seems to be missing and it works (or should work?) by converting these to fp32 for the actual calculations?
But I'm having problems with this.
first I just tried to use fp16 data type, without any support in backend. This was expected to fail.
I got error:
LLVM ERROR: Cannot select: 0x2f566b0: i32 = fp32_to_fp16 0x2f66bb0 [ID=876]
So I created an instruction pattern which matches this fp32_to_fp16
def CFHrf : InstTCE<(outs R32IRegs:$op2), (ins R32FPRegs:$op1), "", [(set R32IRegs:$op2, (fp32_to_fp16 R32FPRegs:$op1))]>;
But then I got error
/tmp/tcecc-dKBdca/GenInstrInfo.td:30:91: error: Variable not defined: 'fp32_to_fp16'