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/108787] [13 Regression] libsodium miscompilation on power9 starting with r13-2107
Date: Tue, 14 Feb 2023 18:00:35 +0000	[thread overview]
Message-ID: <bug-108787-4-BRXH3o5rnX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108787-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/config/rs6000/rs6000.md.jj      2023-01-16 11:52:16.036734757 +0100
+++ gcc/config/rs6000/rs6000.md 2023-02-14 18:53:25.071014954 +0100
@@ -3231,20 +3231,26 @@
        (plus:TI
          (mult:TI (any_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
                   (any_extend:TI (match_operand:DI 2 "gpc_reg_operand")))
-         (any_extend:TI (match_operand:DI 3 "gpc_reg_operand"))))]
+         (match_operand:TI 3 "gpc_reg_operand")))]
   "TARGET_MADDLD && TARGET_POWERPC64"
 {
   rtx op0_lo = gen_rtx_SUBREG (DImode, operands[0], BYTES_BIG_ENDIAN ? 8 : 0);
   rtx op0_hi = gen_rtx_SUBREG (DImode, operands[0], BYTES_BIG_ENDIAN ? 0 : 8);
+  rtx op3_lo = gen_rtx_SUBREG (DImode, operands[3], BYTES_BIG_ENDIAN ? 8 : 0);
+  rtx op3_hi = gen_rtx_SUBREG (DImode, operands[3], BYTES_BIG_ENDIAN ? 0 : 8);
+  rtx hi_temp = gen_reg_rtx (DImode);

-  emit_insn (gen_maddlddi4 (op0_lo, operands[1], operands[2], operands[3]));
+  emit_insn (gen_maddlddi4 (op0_lo, operands[1], operands[2], op3_lo));

   if (BYTES_BIG_ENDIAN)
-    emit_insn (gen_<u>madddi4_highpart (op0_hi, operands[1], operands[2],
-                                       operands[3]));
+    emit_insn (gen_<u>madddi4_highpart (hi_temp, operands[1], operands[2],
+                                       op3_lo));
   else
-    emit_insn (gen_<u>madddi4_highpart_le (op0_hi, operands[1], operands[2],
-                                          operands[3]));
+    emit_insn (gen_<u>madddi4_highpart_le (hi_temp, operands[1], operands[2],
+                                          op3_lo));
+
+  emit_insn (gen_adddi3 (op0_hi, hi_temp, op3_hi));
+
   DONE;
 })


seems to fix this, but I have yet to check if it is the right thing also for
the signed case.

  parent reply	other threads:[~2023-02-14 18:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 15:59 [Bug target/108787] New: " jakub at gcc dot gnu.org
2023-02-14 15:59 ` [Bug target/108787] " jakub at gcc dot gnu.org
2023-02-14 16:36 ` jakub at gcc dot gnu.org
2023-02-14 17:00 ` jakub at gcc dot gnu.org
2023-02-14 18:00 ` jakub at gcc dot gnu.org [this message]
2023-02-14 18:27 ` jakub at gcc dot gnu.org
2023-02-14 19:19 ` segher at gcc dot gnu.org
2023-02-14 19:30 ` jakub at gcc dot gnu.org
2023-02-14 20:27 ` jakub at gcc dot gnu.org
2023-02-14 20:47 ` segher at gcc dot gnu.org
2023-02-14 20:59 ` segher at gcc dot gnu.org
2023-02-15  9:13 ` cvs-commit at gcc dot gnu.org
2023-02-15  9:28 ` 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-108787-4-BRXH3o5rnX@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).