public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55894] New: No constant propagation in Intel intrinsics
@ 2013-01-07 13:14 glisse at gcc dot gnu.org
  2013-01-07 13:36 ` [Bug target/55894] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-01-07 13:14 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55894
           Summary: No constant propagation in Intel intrinsics
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org
            Target: x86_64-linux-gnu


I was comparing ways to generate a constant (Intel 12.0 doesn't support the
first one), and noticed that these functions result in different asm. In
particular, there doesn't seem to be a lot of constant propagation going on :-(
-Ofast and various -march only managed to change 'g' to movddup    .LC1(%rip),
%xmm0 (which in itself looks better than movapd, except that if I change g to
take an argument __m128d a and return _mm_xor_pd(a,m), that prevents gcc from
compacting it to a single insn, and I really don't see a reason for f and g to
generate different code as they look so similar). By the way, if you have a
suggestion on the simplest portable way to get this constant...

#include <x86intrin.h>
__m128d f(){
  const __m128d m = _mm_castsi128_pd (_mm_set1_epi64x (0x7fffffffffffffff));
  return m;
}
__m128d g(){
  const __m128d m = _mm_castsi128_pd (_mm_set1_epi64
(_mm_set_pi32(0x7fffffff,0xffffffff)));
  return m;
}
__m128d h(){
  const __m128d x = _mm_set1_pd (-0.);
  const __m128d m1 = _mm_cmpeq_pd (x, x);
  const __m128d m = _mm_xor_pd (x, m1);
  return m;
}

_Z1fv:
.LFB539:
    .cfi_startproc
    movapd    .LC0(%rip), %xmm0
    ret
    .cfi_endproc
[...]
_Z1gv:
.LFB540:
    .cfi_startproc
    movq    .LC1(%rip), %xmm0
    punpcklqdq    %xmm0, %xmm0
    ret
    .cfi_endproc
[...]
_Z1hv:
.LFB541:
    .cfi_startproc
    movapd    .LC3(%rip), %xmm0
    movapd    %xmm0, %xmm1
    cmpeqpd    %xmm0, %xmm1
    xorpd    %xmm1, %xmm0
    ret
    .cfi_endproc
[...]
.LC0:
    .long    4294967295
    .long    2147483647
    .long    4294967295
    .long    2147483647
    .section    .rodata.cst8,"aM",@progbits,8
    .align 8
.LC1:
    .long    -1
    .long    2147483647
    .section    .rodata.cst16
    .align 16
.LC3:
    .long    0
    .long    -2147483648
    .long    0
    .long    -2147483648


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-29  4:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-07 13:14 [Bug target/55894] New: No constant propagation in Intel intrinsics glisse at gcc dot gnu.org
2013-01-07 13:36 ` [Bug target/55894] " rguenth at gcc dot gnu.org
2013-01-07 13:48 ` glisse at gcc dot gnu.org
2013-01-07 14:26 ` jakub at gcc dot gnu.org
2013-01-07 20:17 ` glisse at gcc dot gnu.org
2021-12-29  4:44 ` pinskia at gcc dot gnu.org
2021-12-29  4:47 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).