public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/55894] New: No constant propagation in Intel intrinsics
Date: Mon, 07 Jan 2013 13:14:00 -0000	[thread overview]
Message-ID: <bug-55894-4@http.gcc.gnu.org/bugzilla/> (raw)


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


             reply	other threads:[~2013-01-07 13:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 13:14 glisse at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55894-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).