Hahnfeld added a comment.

In https://reviews.llvm.org/D47849#1125019, @gtbercea wrote:

> It's precisely the issue which you report here. Since you don't use device 
> specific math functions, you can run into the problem where you may end up 
> calling assembly instructions for a different architecture. I may have 
> mis-classified this as a correctness issue.


I think the issue is slightly different, the assembly is not necessarily in the 
called functions, as I said `sqrt` seems to work fine. Clang just errors 
because they are included via the header.

This is because `clang::InitializePreprocessor` has this:

  // FIXME: This will create multiple definitions for most of the predefined
  // macros. This is not the right way to handle this.
  if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
    InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
                               Builder);

So we will end up with all host defines (including `__SSE2_MATH__` as @hfinkel 
wrote) during target compilation :-(


Repository:
  rC Clang

https://reviews.llvm.org/D47849



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to