http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54349

             Bug #: 54349
           Summary: _mm_cvtsi128_si64 unnecessary stores value at stack
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: nel...@seznam.cz


Consider following program:

#include <emmintrin.h>
#include <stdint.h>
int64_t foo(__m128i a){return  _mm_cvtsi128_si64(a);}
int64_t bar(double b){ return *((int64_t*)&b);}

A _mm_cvtsi128_si64 does unnecesary store into stack instead moving to register
directly. Same problem is present when interpreting double as integer.

  .file "e.c"
  .text
  .p2align 4,,15
  .globl  foo
  .type foo, @function
foo:
.LFB517:
  .cfi_startproc
  movq  %xmm0, -16(%rsp)
  movq  -16(%rsp), %rax
  ret
  .cfi_endproc
.LFE517:
  .size foo, .-foo
  .p2align 4,,15
  .globl  bar
  .type bar, @function
bar:
.LFB518:
  .cfi_startproc
  movsd %xmm0, -8(%rsp)
  movq  -8(%rsp), %rax
  ret
  .cfi_endproc
.LFE518:
  .size bar, .-bar
  .ident  "GCC: (Debian 20120820-1) 4.8.0 20120820 (experimental) [trunk
revision 190537]"
  .section  .note.GNU-stack,"",@progbits

Reply via email to