[cfe-dev] [OpenCL] allow __builtin_astype(char4, char3)

Liu, Yaxun (Sam) via cfe-dev cfe-dev at lists.llvm.org
Fri May 6 13:53:20 PDT 2016


Is char3 as_char3(char4 x) a valid OpenCL builtin function?

According to the spec, both have 4 bytes, so it seems to be a valid builtin.

Naturally one would want to implement it as

char3 as_char3(char4 x) { return __builtin_astype(x, char3); }

However this does not work since Clang will generate bitcast <4 x i8> to <3 x i8> and this is an invalid llvm instruction.

Do you think Clang should be patched to generate correct llvm instruction for this case?

Thanks.

Sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 11898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160506/33d91c97/attachment.bin>


More information about the cfe-dev mailing list