[Libclc-dev] architecture-specific builtins and OpenCL

Richard Gorton rcgorton at cognitive-electronics.com
Tue Nov 11 10:01:16 PST 2014


I originally posted this to llvmdev,but it strikes me that this might be a better place to make the query.


> I'm trying to ascertain whether or not it is possible to use architecture-specific builtins (LLVM3.4.2) in OpenCL:
> 
> This compiles cleanly for my target when it has a .c extension:
> 
> void fred(unsigned long* in, unsigned long* where)
> {
>    *where = __builtin_coge_reverse(*in);
> }
> 
> But this variant crashes very early when it is a .cl file:
> void kernel fred(unsigned long *in, unsigned long* where)
> {
>    *where = __builtin_coge_reverse(*in);
> }
> 
> 
> 
> I'm not even sure how to go about determining the source of problem - it crashes before generating any IR (-mllvm -print-after-all)
> 
> clang: /localspace/rcgorton/svn/Compiler/trunk/LLVM3_4/llvm-3.4.2.src/lib/IR/Instructions.cpp:2352: static llvm::CastInst* llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
> 
> Is there a document somewhere which describes how to use various front-end-dumping switches?  Is there a better way to attack this?
> 
> Thanks in advance,
> 
> 	Richard
> 	rcgorton at cog-e.com




More information about the Libclc-dev mailing list