public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56863] New: cmpnltpd recognition
@ 2013-04-07 14:16 glisse at gcc dot gnu.org
  2013-04-08 11:10 ` [Bug target/56863] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-04-07 14:16 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56863
           Summary: cmpnltpd recognition
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org
            Target: x86_64-linux-gnu


Hello,

I was looking at this program, trying to get it to generate cmpnltpd:

#include <x86intrin.h>
__m128d f(__m128d a, __m128d b){
  return (__m128d)(~(a<b));
}

but it doesn't:

    cmpltpd    %xmm1, %xmm0
    pcmpeqd    %xmm1, %xmm1
    pxor    %xmm0, %xmm1
    movapd    %xmm1, %xmm0

One reason seems to be that the instruction is modeled as (unge a b), whereas
from a trapping point of view I think it should be (not (lt a b)). But even
-ffast-math does not help.

As a side note, notice that:

  return (__m128d)((a<b)?0:(__m128i){-1,-1});

uses pandn instead of pxor to generate the negation. I don't think one is
better than the other, I was just surprised to see the difference.


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

* [Bug target/56863] cmpnltpd recognition
  2013-04-07 14:16 [Bug target/56863] New: cmpnltpd recognition glisse at gcc dot gnu.org
@ 2013-04-08 11:10 ` rguenth at gcc dot gnu.org
  2013-05-29 10:15 ` glisse at gcc dot gnu.org
  2021-07-29 23:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-08 11:10 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-08
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-08 11:10:31 UTC ---
Confirmed.


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

* [Bug target/56863] cmpnltpd recognition
  2013-04-07 14:16 [Bug target/56863] New: cmpnltpd recognition glisse at gcc dot gnu.org
  2013-04-08 11:10 ` [Bug target/56863] " rguenth at gcc dot gnu.org
@ 2013-05-29 10:15 ` glisse at gcc dot gnu.org
  2021-07-29 23:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-05-29 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Currently, -ffast-math generates cmplepd, -fno-trapping-math generates
cmpnltpd. That's better, but we should have cmpnltpd even with -ftrapping-math.

Besides, if we manage to have an unlt with -ftrapping-math, we will still
generate wrong code (but then the x86 back-end already generates the same code
for a<b and isless(a,b), so it is more "unsupported" than wrong).


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

* [Bug target/56863] cmpnltpd recognition
  2013-04-07 14:16 [Bug target/56863] New: cmpnltpd recognition glisse at gcc dot gnu.org
  2013-04-08 11:10 ` [Bug target/56863] " rguenth at gcc dot gnu.org
  2013-05-29 10:15 ` glisse at gcc dot gnu.org
@ 2021-07-29 23:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-29 23:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56863

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Last reconfirmed|2013-04-08 00:00:00         |2021-7-29

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(insn 7 6 8 (set (reg:V2DF 87)
        (lt:V2DF (reg/v:V2DF 84 [ a ])
            (reg/v:V2DF 85 [ b ]))) "/app/example.c":3:20 -1
     (nil))

(insn 8 7 9 (set (reg:V2DI 86)
        (subreg:V2DI (reg:V2DF 87) 0)) "/app/example.c":3:20 -1
     (nil))

(insn 9 8 10 (set (reg:V2DI 88)
        (const_vector:V2DI [
                (const_int -1 [0xffffffffffffffff]) repeated x2
            ])) "/app/example.c":3:20 -1
     (nil))

(insn 10 9 0 (set (reg:V2DI 82 [ _2 ])
        (and:V2DI (not:V2DI (reg:V2DI 86))
            (reg:V2DI 88))) "/app/example.c":3:20 -1
     (nil))

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

end of thread, other threads:[~2021-07-29 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-07 14:16 [Bug target/56863] New: cmpnltpd recognition glisse at gcc dot gnu.org
2013-04-08 11:10 ` [Bug target/56863] " rguenth at gcc dot gnu.org
2013-05-29 10:15 ` glisse at gcc dot gnu.org
2021-07-29 23:16 ` 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).