public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106952] Missed optimization: x < y ? x : y not lowered to minss
Date: Tue, 18 Jul 2023 10:39:05 +0000	[thread overview]
Message-ID: <bug-106952-4-s4yVuHHMDn@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106952-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
With the proposed patches for PR88540 and PR105715 I get with -O3 -msse4.1

intersection:
.LFB2:
        .cfi_startproc
        movss   .LC0(%rip), %xmm5
        pxor    %xmm2, %xmm2
        movss   (%rdi), %xmm4
        movss   12(%rsi), %xmm1
        movss   12(%rdi), %xmm0
        divss   %xmm2, %xmm5
        movss   (%rsi), %xmm3
        subss   %xmm4, %xmm1
        subss   %xmm4, %xmm3
        pxor    %xmm4, %xmm4
        mulss   %xmm0, %xmm1
        mulss   %xmm0, %xmm3
        movaps  %xmm1, %xmm0
        cmpnltss        %xmm2, %xmm0
        blendvps        %xmm0, %xmm1, %xmm4
        movaps  %xmm3, %xmm0
        cmpnltss        %xmm2, %xmm0
        pxor    %xmm2, %xmm2
        blendvps        %xmm0, %xmm3, %xmm2
        movss   16(%rsi), %xmm0
        minss   %xmm5, %xmm3
        minss   %xmm5, %xmm1
        movss   4(%rdi), %xmm5
        minss   %xmm4, %xmm2
        movss   16(%rdi), %xmm4
        subss   %xmm5, %xmm0
        maxss   %xmm3, %xmm1
        movss   4(%rsi), %xmm3
        subss   %xmm5, %xmm3
        mulss   %xmm4, %xmm0
        movss   8(%rdi), %xmm5
        mulss   %xmm4, %xmm3
        movaps  %xmm2, %xmm4
        maxss   %xmm0, %xmm4
        minss   %xmm1, %xmm0
        maxss   %xmm3, %xmm2
        minss   %xmm1, %xmm3
        movss   8(%rsi), %xmm1
        subss   %xmm5, %xmm1
        maxss   %xmm3, %xmm0
        movss   20(%rsi), %xmm3
        minss   %xmm4, %xmm2
        movss   20(%rdi), %xmm4
        subss   %xmm5, %xmm3
        mulss   %xmm4, %xmm1
        movaps  %xmm2, %xmm5
        mulss   %xmm4, %xmm3
        movaps  %xmm2, %xmm4
        maxss   %xmm1, %xmm4
        minss   %xmm0, %xmm1
        movaps  %xmm3, %xmm2
        maxss   %xmm3, %xmm5
        minss   %xmm0, %xmm2
        minss   %xmm5, %xmm4
        maxss   %xmm1, %xmm2
        comiss  %xmm4, %xmm2
        seta    %al
        ret

there's the existing issue that RTL conditional move expansion doesn't
preserve the equality of constants for

  _33 = t2_34 < 0.0;
  _12 = _33 ? 0.0 : t2_34;

but it emits two loads from the constant pool for 0.0 here which in the x86
backend fail to be recognized as min/max.

  parent reply	other threads:[~2023-07-18 10:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 15:30 [Bug target/106952] New: " tavianator at gmail dot com
2022-09-15 15:42 ` [Bug target/106952] " amonakov at gcc dot gnu.org
2022-09-15 15:54 ` tavianator at gmail dot com
2022-09-17  4:47 ` rguenth at gcc dot gnu.org
2023-07-18 10:39 ` rguenth at gcc dot gnu.org [this message]
2023-07-20  8:39 ` rguenth at gcc dot gnu.org
2023-07-21  8:18 ` rguenth 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-106952-4-s4yVuHHMDn@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).