<div dir="ltr"><div>My guess, and it's only a guess, is that -save-temps causes the compiler to run each step on those files, by executing independent processes, rather than the usual "run all steps in parallel" - in my understanding, Clang doesn't actually work in the "old style cc way" and running several processes with files produced between each step. And as a result, with -save-temps, when the compiler comes to process the second step (processing the .i file), it has "lost" the fact that you are compiling CL code (and I suspect this would happen to other types than half, just not types that are "same as C")<br><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 November 2016 at 22:14, Martin J. O'Riordan via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="#0563C1" vlink="#954F72" lang="EN-IE"><div class="m_66462512505868622WordSection1"><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">I’m not sure whether to direct this message to LLVM-Dev or CFE-Dev, but I think CFE is more appropriate.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">This is in respect to our out-of-tree implementation, derived from the v3.9.0 sources.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">If I am compiling a source file, and I use ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-c -save-temps</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ (or ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-c -save-temps=obj</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’), the intermediate files ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">.i</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ or ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">.ii</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’, ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">.bc</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ and ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">.s</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ are retained as expected; but in an odd twist, I get errors when I compile OpenCL files with the ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">.cl</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ extension.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">This only happens if the OpenCL source uses the keyword ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">half</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’.  If I do not use ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-save-temps</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ then everything works correctly, but when I do use ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-save-temps</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ it fails to parse ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">half</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ as being valid.  The errors I get when I use ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-save-temps</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ are:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">warning: unknown pragma ignored<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">for:<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">#pragma OPENCL EXTENSION cl_khr_fp16 : enable<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">and then subsequent uses of ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">half</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ such as:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">typedef __attribute__((ext_vector_<wbr>type(2))) half half2;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">result in:<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">error: unknown type name 'half'<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">When I omit ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-save-temps</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ the source compiles correctly with no warnings or errors.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">Any idea what might be happening here?  Are there changes in OpenCL support that I need to update my library sources for?  Most of these are from the ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">libclc</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ sources, though I do have local edits that might be stale with respect to recent changes for OpenCL support.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">            MartinO<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>