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 rtl-optimization/95102] New: missed if-conversion
Date: Wed, 13 May 2020 08:58:43 +0000	[thread overview]
Message-ID: <bug-95102-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 95102
           Summary: missed if-conversion
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

If you rewrite gcc.target/i386/pr54855-9.c to a form GIMPLE looks like after
some PRE you end up with

typedef float vec __attribute__((vector_size(16)));

vec
foo (vec x, float a)
{
  if (!(x[0] < a))
    x[0] = a;
  return x;
}

which is no longer recognized as the same and emits

foo:
.LFB0:
        .cfi_startproc
        comiss  %xmm0, %xmm1
        ja      .L2
        movss   %xmm1, %xmm0
.L2:
        ret

instead of

foo:
.LFB1:  
        .cfi_startproc
        minss   %xmm1, %xmm0
        ret

this is because RTL if-conversion does not recognize

    7: r86:SF=vec_select(r84:V4SF,parallel)
    8: flags:CCFP=cmp(r85:SF,r86:SF)
      REG_DEAD r86:SF
    9: pc={(flags:CCFP>0)?L14:pc}
      REG_DEAD flags:CCFP
      REG_BR_PROB 536870916

   10: NOTE_INSN_BASIC_BLOCK 3
   12: r84:V4SF=vec_merge(vec_duplicate(r85:SF),r84:V4SF,0x1)
      REG_DEAD r85:SF

   14: L14:
   15: NOTE_INSN_BASIC_BLOCK 4
   20: xmm0:V4SF=r84:V4SF

the form it does recognize is

    8: r82:SF=vec_select(r84:V4SF,parallel)
    9: flags:CCFP=cmp(r85:SF,r82:SF)
   10: pc={(flags:CCFP>0)?L28:pc}
      REG_DEAD flags:CCFP
      REG_BR_PROB 536870916

   28: L28:
   14: NOTE_INSN_BASIC_BLOCK 3
    5: r85:SF=r82:SF
      REG_DEAD r82:SF

   15: L15:
   16: NOTE_INSN_BASIC_BLOCK 4
   18: r87:V4SF=vec_merge(vec_duplicate(r85:SF),r84:V4SF,0x1)

             reply	other threads:[~2020-05-13  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13  8:58 rguenth at gcc dot gnu.org [this message]
2020-05-13  9:11 ` [Bug rtl-optimization/95102] " rguenth at gcc dot gnu.org
2021-07-20  1:05 ` pinskia at gcc dot gnu.org
2021-07-20  1:08 ` pinskia at gcc dot gnu.org
2021-07-20  7:27 ` 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-95102-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).