Hello,
On this kernel OpenCL compiler gives the error.
#define bswap32(x) ( ((x) << 24) | (((x) << 8) & 0x00ff0000) | (((x) >> 8) & 0x0000ff00) | ((x) >> 24) ) __kernel void buggy(const uint input, __global uint * output) { output[0] = swap(input); }
Error is:
fcl build 1 succeeded.
error: Cannot select: 0x2d4e258: i32 = bswap 0x2d4e0c0 [ORD=1] [ID=6]
0x2d4e0c0: i32,ch = CopyFromReg 0x2d61944, 0x2d4e038 [ORD=1] [ID=4]
0x2d4e038: i32 = Register %vreg0 [ORD=1] [ID=1]
error: midlevel compiler failed build.
Build failed!
If I change swap definition to anything else, like,
#define bswap32(a) (as_uint(as_uchar4(a).wzyx))
everything is ok.
It's interesting that NVIDIA had the same bug:
https://devtalk.nvidia.com/default/topic/480873/code-selection-failed-to...