[cfe-dev] SSE intrinsics not being emitted by clang

Sanee Berlow via cfe-dev cfe-dev at lists.llvm.org
Tue May 3 07:37:29 PDT 2016


Hello,

I'm trying to use SSE intrinsic functions like _mm_store_ps from the header
xmmintrin.h. I believe that the compiler is meant to provide the
definitions for these functions, is that right? For some reason clang
doesn't seem to be doing that so I'm getting undefined symbol errors while
linking. This problem occurs when I invoke clang programatically, but not
when I compile using the clang frontend executable, despite using the same
arguments with both the executable and CompilerInvocation::CreateFromArgs.
I'm trying to work out what could be causing this.

So for instance, this works fine:

F:\Clanggit\build\32\Release\bin>clang -cc1 -triple i686-pc-windows-msvc
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-mrelocation-model static -mdisable-fp-elim -std=c++11 -masm-verbose
-mconstructor-aliases -target-cpu pentium4 -D_MT --depe
ndent-lib=libcmt --dependent-lib=oldnames -fdiagnostics-format msvc -D
_HAS_EXCEPTIONS=1 -internal-isystem
"F:\Clanggit\build\32\Debug\lib\clang\3.7.0\include" -internal-isystem
"E:/Microsoft Visual Studio 12.0/VC/include" -internal-isystem "C:/Program
Fil
es (x86)/Windows Kits/8.1/Include" -internal-isystem
"F:/git/scripta/trunk/include" -internal-isystem
"F:\\Libraries\\eigen\\Eigen" -fno-dwarf-directory-asm -ferror-limit 19
-fmessage-length 80 -mstackrealign -target-feature +sse4.2 -fms-extensions
-fms-co
mpatibility -fms-compatibility-version=18.00 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -fdelayed-template-parsing
-O3 -o outsource.obj -x c++  source.cpp -v
clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target
i686-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 F:\Clanggit\build\32\Debug\lib\clang\3.7.0\include
 E:/Microsoft Visual Studio 12.0/VC/include
 C:/Program Files (x86)/Windows Kits/8.1/Include
 F:/git/scripta/trunk/include
 F:\\Libraries\\eigen\\Eigen
End of search list.

Resulting obj relocs from the above compilation using the clang frontend
executable:

File: outsource.obj
Format: COFF-i386
Arch: i386
AddressSize: 32bit
Relocations [
  Section (1) .text {
    0x7 IMAGE_REL_I386_DIR32 .rdata
    0xC IMAGE_REL_I386_REL32 _puts
    0x11 IMAGE_REL_I386_REL32 _getchar
  }

Resulting obj relocs from the obj created by the compiler instance
invocation in my program (using the same arguments):

File: temp
Format: COFF-i386
Arch: i386
AddressSize: 32bit
Relocations [
  Section (1) .text {
    0x26 IMAGE_REL_I386_DIR32 ??_C at _1LA@EKEBDMEJ
@?$AA?4?$AA?1?$AAS?$AAc?$AAr?$AAi?$AAp?$AAt?$AAa?$AA?1?$AAs?$AAc?$AAr?$AAi?$AAp?$AAt?$AAs?$AA?1?$AA?4?$AA?4?$AA?1?$AA?4?$AA?4?$AA?1?$AA?4?$AA?4?$AA?1?$AA?4?$AA?4?$AA?1?$AA?4?$AA?4@
    0x2D IMAGE_REL_I386_DIR32 ??_C at _1BIM@JPMPBING
@?$AA?$CI?$AAr?$AAe?$AAi?$AAn?$AAt?$AAe?$AAr?$AAp?$AAr?$AAe?$AAt?$AA_?$AAc?$AAa?$AAs?$AAt?$AA?$DM?$AAs?$AAi?$AAz?$AAe?$AA_?$AAt?$AA?$DO?$AA?$CI?$AAa?$AAr?$AAr?$AAa?$AAy?$AA?$CJ@
    0x32 IMAGE_REL_I386_REL32 __wassert
    0x60 IMAGE_REL_I386_DIR32 .rdata
    0x65 IMAGE_REL_I386_REL32 _puts
    0x81 IMAGE_REL_I386_REL32 __mm_load_ps
    0x94 IMAGE_REL_I386_REL32 __mm_load_ps
    0xB4 IMAGE_REL_I386_REL32 __mm_store_ps
    0xD4 IMAGE_REL_I386_REL32 __mm_store_ps
    0xDB IMAGE_REL_I386_DIR32 .rdata
    0xE0 IMAGE_REL_I386_REL32 _puts
    0xE5 IMAGE_REL_I386_REL32 _getchar
    0x10C IMAGE_REL_I386_DIR32 .rdata
    0x111 IMAGE_REL_I386_REL32 _puts
  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160503/89de31c9/attachment.html>


More information about the cfe-dev mailing list