public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Fix (target part) PR91204, ICE in expand_expr_real_2
@ 2019-07-19 15:06 Uros Bizjak
  2019-07-20  6:46 ` [PATCH]: Fix ICE in expand_expr_real_2 (PR target/91204) Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2019-07-19 15:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

As suggested by Jakub in the PR, add missing vector one_cmpl<mode>2 to
mmx.md. A generic fix is in the works by Jakub.

2019-07-19  Uroš Bizjak  <ubizjak@gmail.com>

    PR target/91204
    * config/i386/mmx.md (one_cmpl<mode>2): New expander.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 647 bytes --]

diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 4c71e66e6607..c78b33b510a6 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -1158,6 +1158,14 @@
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(define_expand "one_cmpl<mode>2"
+  [(set (match_operand:MMXMODEI 0 "register_operand")
+	(xor:MMXMODEI
+	  (match_operand:MMXMODEI 1 "register_operand")
+	  (match_dup 2)))]
+  "TARGET_MMX_WITH_SSE"
+  "operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));")
+
 (define_insn "mmx_andnot<mode>3"
   [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,Yv")
 	(and:MMXMODEI

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH]: Fix ICE in expand_expr_real_2 (PR target/91204)
  2019-07-19 15:06 [PATCH, i386]: Fix (target part) PR91204, ICE in expand_expr_real_2 Uros Bizjak
@ 2019-07-20  6:46 ` Jakub Jelinek
  2019-07-20 17:12   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2019-07-20  6:46 UTC (permalink / raw)
  To: Richard Biener, Jeff Law, Eric Botcazou, Uros Bizjak; +Cc: gcc-patches

On Fri, Jul 19, 2019 at 04:41:06PM +0200, Uros Bizjak wrote:
> As suggested by Jakub in the PR, add missing vector one_cmpl<mode>2 to
> mmx.md. A generic fix is in the works by Jakub.

Yes, here it is.  Bootstrapped/regtested on x86_64-linux and i686-linux, ok
for trunk?

2019-07-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/91204
	* optabs.c (expand_unop): As fallback, expand ~op0 as op0 ^ -1.

	* gcc.c-torture/compile/pr91204.c: New test.

--- gcc/optabs.c.jj	2019-07-15 10:53:10.743205405 +0200
+++ gcc/optabs.c	2019-07-19 00:38:20.271852242 +0200
@@ -2972,6 +2972,17 @@ expand_unop (machine_mode mode, optab un
       return target;
     }
 
+  /* Emit ~op0 as op0 ^ -1.  */
+  if (unoptab == one_cmpl_optab
+      && (SCALAR_INT_MODE_P (mode) || GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
+      && optab_handler (xor_optab, mode) != CODE_FOR_nothing)
+    {
+      temp = expand_binop (mode, xor_optab, op0, CONSTM1_RTX (mode),
+			   target, unsignedp, OPTAB_DIRECT);
+      if (temp)
+	return temp;
+    }
+
   if (optab_to_code (unoptab) == NEG)
     {
       /* Try negating floating point values by flipping the sign bit.  */
--- gcc/testsuite/gcc.c-torture/compile/pr91204.c.jj	2019-07-19 09:29:32.366011373 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr91204.c	2019-07-19 09:29:11.011340662 +0200
@@ -0,0 +1,11 @@
+/* PR target/91204 */
+
+int a, b, c[64];
+
+void
+foo (void)
+{
+  int i;
+  for (i = 2; i < 64; i++)
+    c[i] &= b ^ c[i] ^ c[i - 2];
+}


	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]: Fix ICE in expand_expr_real_2 (PR target/91204)
  2019-07-20  6:46 ` [PATCH]: Fix ICE in expand_expr_real_2 (PR target/91204) Jakub Jelinek
@ 2019-07-20 17:12   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2019-07-20 17:12 UTC (permalink / raw)
  To: Jakub Jelinek, Jeff Law, Eric Botcazou, Uros Bizjak; +Cc: gcc-patches

On July 20, 2019 8:45:38 AM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>On Fri, Jul 19, 2019 at 04:41:06PM +0200, Uros Bizjak wrote:
>> As suggested by Jakub in the PR, add missing vector one_cmpl<mode>2
>to
>> mmx.md. A generic fix is in the works by Jakub.
>
>Yes, here it is.  Bootstrapped/regtested on x86_64-linux and
>i686-linux, ok
>for trunk?

Ok. 

Richard. 

>2019-07-20  Jakub Jelinek  <jakub@redhat.com>
>
>	PR target/91204
>	* optabs.c (expand_unop): As fallback, expand ~op0 as op0 ^ -1.
>
>	* gcc.c-torture/compile/pr91204.c: New test.
>
>--- gcc/optabs.c.jj	2019-07-15 10:53:10.743205405 +0200
>+++ gcc/optabs.c	2019-07-19 00:38:20.271852242 +0200
>@@ -2972,6 +2972,17 @@ expand_unop (machine_mode mode, optab un
>       return target;
>     }
> 
>+  /* Emit ~op0 as op0 ^ -1.  */
>+  if (unoptab == one_cmpl_optab
>+      && (SCALAR_INT_MODE_P (mode) || GET_MODE_CLASS (mode) ==
>MODE_VECTOR_INT)
>+      && optab_handler (xor_optab, mode) != CODE_FOR_nothing)
>+    {
>+      temp = expand_binop (mode, xor_optab, op0, CONSTM1_RTX (mode),
>+			   target, unsignedp, OPTAB_DIRECT);
>+      if (temp)
>+	return temp;
>+    }
>+
>   if (optab_to_code (unoptab) == NEG)
>     {
>    /* Try negating floating point values by flipping the sign bit.  */
>--- gcc/testsuite/gcc.c-torture/compile/pr91204.c.jj	2019-07-19
>09:29:32.366011373 +0200
>+++ gcc/testsuite/gcc.c-torture/compile/pr91204.c	2019-07-19
>09:29:11.011340662 +0200
>@@ -0,0 +1,11 @@
>+/* PR target/91204 */
>+
>+int a, b, c[64];
>+
>+void
>+foo (void)
>+{
>+  int i;
>+  for (i = 2; i < 64; i++)
>+    c[i] &= b ^ c[i] ^ c[i - 2];
>+}
>
>
>	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-20 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19 15:06 [PATCH, i386]: Fix (target part) PR91204, ICE in expand_expr_real_2 Uros Bizjak
2019-07-20  6:46 ` [PATCH]: Fix ICE in expand_expr_real_2 (PR target/91204) Jakub Jelinek
2019-07-20 17:12   ` Richard Biener

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).