diff mbox series

patch to fix PR93207

Message ID 3faab7e2-8a75-a612-23f0-aaca72413d7c@redhat.com
State New
Headers show
Series patch to fix PR93207 | expand

Commit Message

Vladimir Makarov Jan. 10, 2020, 8:13 p.m. UTC
The following patch fixes

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

The patch was successfully tested bootstrapped on x86-64.

Committed as r280133
diff mbox series

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 280132)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@ 
+2020-01-10  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR inline-asm/93207
+	* lra-constraints.c (match_reload): Permit input operands have the
+	same mode as output while other input operands have a different
+	mode.
+
 2020-01-10  Wilco Dijkstra  <wdijkstr@arm.com>
 
 	PR tree-optimization/90838
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 280132)
+++ lra-constraints.c	(working copy)
@@ -1054,12 +1054,15 @@  match_reload (signed char out, signed ch
   curr_insn_input_reloads[curr_insn_input_reloads_num].match_p = true;
   curr_insn_input_reloads[curr_insn_input_reloads_num++].reg = new_in_reg;
   for (i = 0; (in = ins[i]) >= 0; i++)
-    {
-      lra_assert
-	(GET_MODE (*curr_id->operand_loc[in]) == VOIDmode
-	 || GET_MODE (new_in_reg) == GET_MODE (*curr_id->operand_loc[in]));
+    if (GET_MODE (*curr_id->operand_loc[in]) == VOIDmode
+	|| GET_MODE (new_in_reg) == GET_MODE (*curr_id->operand_loc[in]))
       *curr_id->operand_loc[in] = new_in_reg;
-    }
+    else
+      {
+	lra_assert
+	  (GET_MODE (new_out_reg) == GET_MODE (*curr_id->operand_loc[in]));
+	*curr_id->operand_loc[in] = new_out_reg;
+      }
   lra_update_dups (curr_id, ins);
   if (out < 0)
     return;
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 280132)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2020-01-10  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR inline-asm/93207
+	* gcc.target/i386/pr93207.c: New test.
+
 2020-01-10  Wilco Dijkstra  <wdijkstr@arm.com>
 
 	* testsuite/gcc.target/aarch64/pr90838.c: New test.
Index: testsuite/gcc.target/i386/pr93207.c
===================================================================
--- testsuite/gcc.target/i386/pr93207.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr93207.c	(working copy)
@@ -0,0 +1,14 @@ 
+/* PR inline-asm/93207 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+int main (void) {
+  int f = 0, w;
+
+  asm volatile(
+    ""
+    : "+m&l"(f)
+    : "0a"(&w)
+  );
+  return 0;
+}