[LLVMdev] [cfe-dev] OpenCL SPIR/NVPTX code generation

Benyei, Guy guy.benyei at intel.com
Wed Jan 23 23:13:04 PST 2013

Hi Jordan,
You're right, and the driver -target option works perfectly with the SPIR triples.

   Guy Benyei

From: Jordan Rose [mailto:jordan_rose at apple.com]
Sent: Wednesday, January 23, 2013 19:47
To: Benyei, Guy
Cc: ankur deshwal; cfe-dev at cs.uiuc.edu; llvmdev at cs.uiuc.edu
Subject: Re: [cfe-dev] OpenCL SPIR/NVPTX code generation

On Jan 23, 2013, at 4:04 , "Benyei, Guy" <guy.benyei at intel.com<mailto:guy.benyei at intel.com>> wrote:

Hi Ankur,
Since you use -Xclang, the clang executable passes multiple triples to "clang -cc1". You can see that if you add the -v option. I'm sure there is someone here who can explain it better than I...
Anyhow, I think you better use clang -cc1. Make sure -cc1 is the first command line option you use.

$ clang -cc1 -fno-builtin -emit-llvm-bc -triple spir-unknown-unknown Simple_Kernel.cl -o Simple_Kernel.bc

should work for you.

clang -cc1 shouldn't ever be necessary for end users of clang, particularly because cc1 options are not guaranteed to be stable. You also lose all the default options that the driver normally passes down. It's possible this doesn't matter much for SPIR, at least not right now, but it's not something we should be recommending or supporting.

-target is the driver version of -triple. This "worked" for me, where by "worked" I mean "generated some output but I don't know enough about SPIR to validate it".

% clang -x cl -fno-builtin -target spir -c -emit-llvm


Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130124/493fb79c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 24800 bytes
Desc: image001.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130124/493fb79c/attachment.png>

More information about the llvm-dev mailing list