Open doe300 opened 7 years ago
So far SPIR-V translation library was used by OpenCL front-end compiler only with disabled optimizations. I suppose clang doesn't produce llvm.bswap intrinsic in this mode.
What it the environment you are using SPIR-V library in?
So far SPIR-V translation library was used by OpenCL front-end compiler only with disabled optimizations. I suppose clang doesn't produce llvm.bswap intrinsic in this mode.
This could very well be, since I explicitly run OpenCL -> (SPIR-V-LLVM clang) -> LLVM-IR -> (llvm-spriv) -> SPIR-V so I can use optimizations -O3
in clang.
I'll try to write a pull request to support this intrinsic once #209 is through.
Running code containing the llvm.bswap intrinsic through
llvm-spirv
crashes withAccording to the LLVM Language Reference, this intrinsic is used to swap the bytes in integers, e.g. to move from little-endian to big-endian and vice versa.
Since the SPIR-V specification offers no instruction to swap bytes, I guess this intrinsic should be implemented by manually shifting the single bytes in the integer numbers.