public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102224] [9/10/11/12 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f Date: Tue, 07 Sep 2021 09:51:51 +0000 [thread overview] Message-ID: <bug-102224-4-kUDG4EwQgs@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102224-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102224 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The problem is actually about not catering to op0 == op1. In that case what we really want is x & 0x80000000 rather than x ^ (x & 0x80000000). Unfortunately after RA the mask needs to be already emitted, I think e.g. because of PIC etc. we can't easily use a different constant at that point, and for non-AVX pandn insn the negation is on the "0" constrained operand. So --- gcc/config/i386/i386-expand.c.jj 2021-09-06 14:47:43.184050185 +0200 +++ gcc/config/i386/i386-expand.c 2021-09-07 11:35:30.798849245 +0200 @@ -2289,12 +2289,20 @@ ix86_split_xorsign (rtx operands[]) mode = GET_MODE (dest); vmode = GET_MODE (mask); - op1 = lowpart_subreg (vmode, op1, mode); - x = gen_rtx_AND (vmode, op1, mask); - emit_insn (gen_rtx_SET (op1, x)); + if (rtx_equal_p (op0, op1)) + { + op0 = lowpart_subreg (vmode, op0, mode); + x = gen_rtx_AND (vmode, op0, gen_rtx_NOT (vmode, mask)); + } + else + { + op1 = lowpart_subreg (vmode, op1, mode); + x = gen_rtx_AND (vmode, op1, mask); + emit_insn (gen_rtx_SET (op1, x)); - op0 = lowpart_subreg (vmode, op0, mode); - x = gen_rtx_XOR (vmode, op1, op0); + op0 = lowpart_subreg (vmode, op0, mode); + x = gen_rtx_XOR (vmode, op1, op0); + } dest = lowpart_subreg (vmode, dest, mode); emit_insn (gen_rtx_SET (dest, x)); doesn't work without -mavx.
next prev parent reply other threads:[~2021-09-07 9:51 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-07 2:56 [Bug tree-optimization/102224] New: Incorrect compile on `x * copysign(1.0, x)` gabravier at gmail dot com 2021-09-07 2:58 ` [Bug tree-optimization/102224] " gabravier at gmail dot com 2021-09-07 2:59 ` gabravier at gmail dot com 2021-09-07 3:01 ` gabravier at gmail dot com 2021-09-07 3:04 ` [Bug target/102224] " pinskia at gcc dot gnu.org 2021-09-07 3:06 ` [Bug target/102224] [12 regession] wrong code for " pinskia at gcc dot gnu.org 2021-09-07 3:07 ` gabravier at gmail dot com 2021-09-07 3:18 ` [Bug target/102224] [9/10/11/12 " gabravier at gmail dot com 2021-09-07 3:25 ` gabravier at gmail dot com 2021-09-07 6:37 ` rguenth at gcc dot gnu.org 2021-09-07 9:33 ` [Bug target/102224] [9/10/11/12 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f marxin at gcc dot gnu.org 2021-09-07 9:51 ` jakub at gcc dot gnu.org [this message] 2021-09-07 11:25 ` jakub at gcc dot gnu.org 2021-09-07 18:53 ` pinskia at gcc dot gnu.org 2021-09-08 9:26 ` cvs-commit at gcc dot gnu.org 2021-09-08 10:08 ` [Bug target/102224] [9/10/11 " jakub at gcc dot gnu.org 2021-09-08 18:02 ` cvs-commit at gcc dot gnu.org 2021-09-08 18:03 ` [Bug target/102224] [9/10 " jakub at gcc dot gnu.org 2022-05-10 8:20 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:22 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:36 ` jakub 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-102224-4-kUDG4EwQgs@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: linkBe 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).