[llvm-bugs] [Bug 25554] New: [x86, SSE] rematerialized existing constants

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 17 08:29:41 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25554

            Bug ID: 25554
           Summary: [x86, SSE] rematerialized existing constants
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ cat bad_vmov.c 
#include <smmintrin.h>

void foo(__m128i v0, __m128i v1, int *ret) {
  __m128i one0 = _mm_set_epi32(0,0,0,1);
  __m128i one1 = _mm_set_epi32(0,1,0,0);

  if ( _mm_testz_si128(v0, one0) ) ret[0] = 10;
  if ( _mm_testz_si128(v1, one1) ) ret[1] = 20;
}


Using:
 ./clang -v
clang version 3.8.0 (trunk 253253)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

$ ./clang -O2 -S -o - bad_vmov.c -fomit-frame-pointer -msse4.1
...
    movl    $1, %eax
    movd    %rax, %xmm2
    ptest    %xmm2, %xmm0
    jne    LBB0_2
    movl    $10, (%rdi)
LBB0_2:
    movl    $1, %eax     <--- $1 was already in %eax
    movd    %rax, %xmm0  <--- and %xmm2 already has this value
    pslldq    $8, %xmm0
    ptest    %xmm0, %xmm1
    jne    LBB0_4
    movl    $20, 4(%rdi)
LBB0_4:
    retq

-- 
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/20151117/02499387/attachment.html>


More information about the llvm-bugs mailing list