[LLVMbugs] [Bug 17195] New: ASM-based SIMD code -O2 performance and -g compilation errors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 11 08:34:47 PDT 2013


            Bug ID: 17195
           Summary: ASM-based SIMD code -O2 performance and -g compilation
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hadsell at blueskystudios.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11182
  --> http://llvm.org/bugs/attachment.cgi?id=11182&action=edit
test case described in bug report

Our C++ code embeds asm code for a calculation using SIMD instructions.  There
are 2 problems demonstrated by the attached test case.

(1) With G++ I have to use -fno-dse for optimized code; without it the code
runs much more slowly than the equivalent non-SIMD version.  With Clang++,
there is no such option, and the SIMD code runs more slowly than the non-SIMD

The performance numbers look like this, running on Fedora 14 with a Xeon(R) CPU
X5680 @ 3.33GHz:

Clang++ SIMD version: 8.3 s.
Clang++ non-SIMD version: 5.8 s.
G++ SIMD version: 8.7 s.
G++ non-SIMD version: 11.2 s.

In the attached test case you can select the SIMD or non-SIMD version with a
#define macro in line 6.

Our Clang++ 3.3 was built with G++ 4.7.2.  I uses these options for compiling
and linking: -march=core2 -msse4.1 -m64 -std=c++0x -fPIC -pthread
-Wno-logical-op-parentheses -Wno-shift-op-parentheses -O2 -g

I used G++ 4.5.1 with these options: -march=core2 -msse4.1 -m64 -mpc64
-std=c++0x -pedantic-errors -mieee-fp -fPIC -pthread -O2 -g
-fno-strict-aliasing -fno-tree-ccp -fno-dse

(2) Compiling with -g for a debug (non-optimized) version produces errors like
this for the SIMD version:

clang_test.cc:373:2: error: ran out of registers during register allocation
        compute_factors_t (f0, f1, f2, f3, f0_1, f1_1, f2_1, f3_1,
clang_test.cc:197:10: note: expanded from macro 'compute_factors_t'
    asm ("movapd %1, %%xmm0                     \n\t"    \

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130911/ed3b28b9/attachment.html>

More information about the llvm-bugs mailing list