public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e
Date: Wed, 12 Oct 2022 07:17:17 +0000	[thread overview]
Message-ID: <bug-107172-4-9tLlHuhY5Y@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107172-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #19 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to H.J. Lu from comment #18)
> (In reply to Segher Boessenkool from comment #16)
> > Hi Roger,
> > 
> > (In reply to Roger Sayle from comment #15)
> > > Yes, a COMPARE rtx can be used to set various flags on x86, but many other
> > > operations also legitimately set and/or use MODE_CC, often in a parallel
> > > with the primary operation.
> > 
> > *Any* MODE_CC setter sets the flags as-if from a compare.  This is what
> > MODE_CC *is*.
> > 
> > Setting something as ne:CC and then using it as somethingelse:CC has no
> > defined meaning.
> 
> This
> 
> (parallel [
>             (set (reg:SI 97) 
>                 (neg:SI (ltu:SI (reg:CCC 17 flags)
>                         (const_int 0 [0]))))
>             (clobber (reg:CC 17 flags))
>         ])
> 
> still won't work correctly if reg:CCC 17 flags is set by a compare of
> 2 known values.

I guess Segher means it should be NE instead of LTU in the
x86_mov<mode>cc_0_m1_neg, since the setters is NE to const 0.

 (ne:CCC (reg:SI 87 [ a_lsm.8 ])
                    (const_int 0 [0])))

 (define_expand "x86_mov<mode>cc_0_m1_neg"
   [(parallel
     [(set (match_operand:SWI48 0 "register_operand")
-         (neg:SWI48 (ltu:SWI48 (reg:CCC FLAGS_REG) (const_int 0))))
+         (neg:SWI48 (ne:SWI48 (reg:CCC FLAGS_REG) (const_int 0))))
      (clobber (reg:CC FLAGS_REG))])])

It can pass the PR, but failed pr101617.c, the f1 case.

generate:
        testl   %edi, %edi
        movl    $1, %edx
        movl    $-1, %eax
        cmove   %edx, %eax

origin:
        negl    %edi
        sbbl    %eax, %eax
        orl     $1, %eax

  parent reply	other threads:[~2022-10-12  7:17 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 17:51 [Bug tree-optimization/107172] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2022-10-06 18:02 ` [Bug tree-optimization/107172] [13 Regression] " pinskia at gcc dot gnu.org
2022-10-06 18:46 ` [Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e marxin at gcc dot gnu.org
2022-10-07  7:21 ` rguenth at gcc dot gnu.org
2022-10-07 12:17 ` aldyh at gcc dot gnu.org
2022-10-07 21:04 ` [Bug target/107172] " hjl.tools at gmail dot com
2022-10-07 22:20 ` hjl.tools at gmail dot com
2022-10-09 21:51 ` roger at nextmovesoftware dot com
2022-10-10 18:32 ` segher at gcc dot gnu.org
2022-10-10 18:34 ` segher at gcc dot gnu.org
2022-10-10 19:16 ` hjl.tools at gmail dot com
2022-10-10 20:55 ` segher at gcc dot gnu.org
2022-10-11  0:10 ` hjl.tools at gmail dot com
2022-10-11 16:16 ` segher at gcc dot gnu.org
2022-10-11 17:16 ` hjl.tools at gmail dot com
2022-10-11 18:05 ` segher at gcc dot gnu.org
2022-10-11 19:49 ` roger at nextmovesoftware dot com
2022-10-11 20:26 ` segher at gcc dot gnu.org
2022-10-11 22:30 ` hjl.tools at gmail dot com
2022-10-11 22:38 ` hjl.tools at gmail dot com
2022-10-12  7:17 ` crazylht at gmail dot com [this message]
2022-10-12  7:25 ` crazylht at gmail dot com
2022-10-12  8:11 ` segher at gcc dot gnu.org
2022-10-12 17:50 ` hjl.tools at gmail dot com
2022-10-13  3:38 ` crazylht at gmail dot com
2022-10-13  8:14 ` ubizjak at gmail dot com
2022-10-13 12:31 ` crazylht at gmail dot com
2022-10-13 16:54 ` hjl.tools at gmail dot com
2022-10-13 17:49 ` hjl.tools at gmail dot com
2022-10-13 22:07 ` segher at gcc dot gnu.org
2022-10-13 22:12 ` segher at gcc dot gnu.org
2022-10-13 22:20 ` segher at gcc dot gnu.org
2022-10-13 22:23 ` hjl.tools at gmail dot com
2022-10-13 22:34 ` hjl.tools at gmail dot com
2022-10-15 14:53 ` segher at gcc dot gnu.org
2022-10-17  3:28 ` crazylht at gmail dot com
2022-10-17  7:48 ` rguenth at gcc dot gnu.org
2022-10-17  7:55 ` rguenth at gcc dot gnu.org
2022-10-17 15:59 ` hjl.tools at gmail dot com
2022-10-17 22:01 ` segher at gcc dot gnu.org
2022-10-18  0:19 ` hjl.tools at gmail dot com
2022-10-18 14:44 ` segher at gcc dot gnu.org
2022-10-18 19:54 ` hjl.tools at gmail dot com
2022-10-18 20:14 ` segher at gcc dot gnu.org
2022-10-20 17:25 ` pinskia at gcc dot gnu.org
2022-10-20 19:03 ` hjl.tools at gmail dot com
2022-10-22 21:14 ` segher at gcc dot gnu.org
2022-10-27 18:42 ` cvs-commit at gcc dot gnu.org
2022-10-28  9:11 ` roger at nextmovesoftware dot com
2022-10-28 15:48 ` hjl.tools at gmail dot com
2022-11-30 17:33 ` jakub at gcc dot gnu.org
2022-11-30 21:52 ` hjl.tools at gmail dot com
2023-05-30 13:44 ` cvs-commit at gcc dot gnu.org
2023-07-27 14:47 ` shaohua.li at inf dot ethz.ch

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-107172-4-9tLlHuhY5Y@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).