diff mbox

patch to fix PR78671

Message ID 559ea194-cc24-de31-072e-f749bf3abd3a@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Dec. 8, 2016, 9:17 p.m. UTC
The following patch fixes

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

The patch was successfully bootstrapped and tested on x86-64.

Committed as rev. 243462.
diff mbox

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 243461)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2016-12-08  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/78671
+	* lra-assign.c (lra-assigns.c): Check prohibited regs for an
+	allocno class.
+
 2016-12-08  Uros Bizjak  <ubizjak@gmail.com>
 
 	* gcc.target/i386/i386.h (HARD_REGNO_NREGS): Use GENERAL_REGNO_P.
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 243461)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2016-12-08  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/78671
+	* gcc.target/i386/pr78671.c: New.
+
 2015-12-08  Wilco Dijkstra  <wdijkstr@arm.com>
 
 	PR target/78733
Index: lra-assigns.c
===================================================================
--- lra-assigns.c	(revision 243305)
+++ lra-assigns.c	(working copy)
@@ -628,9 +628,13 @@  find_hard_regno_for_1 (int regno, int *c
 	hard_regno = ira_class_hard_regs[rclass][i];
       if (! overlaps_hard_reg_set_p (conflict_set,
 				     PSEUDO_REGNO_MODE (regno), hard_regno)
-	  /* We can not use prohibited_class_mode_regs because it is
-	     not defined for all classes.  */
 	  && HARD_REGNO_MODE_OK (hard_regno, PSEUDO_REGNO_MODE (regno))
+	  /* We can not use prohibited_class_mode_regs for all classes
+	     because it is not defined for all classes.  */
+	  && (ira_allocno_class_translate[rclass] != rclass
+	      || ! TEST_HARD_REG_BIT (ira_prohibited_class_mode_regs
+				      [rclass][PSEUDO_REGNO_MODE (regno)],
+				      hard_regno))
 	  && ! TEST_HARD_REG_BIT (impossible_start_hard_regs, hard_regno)
 	  && (nregs_diff == 0
 	      || (WORDS_BIG_ENDIAN
Index: testsuite/gcc.target/i386/pr78671.c
===================================================================
--- testsuite/gcc.target/i386/pr78671.c	(revision 0)
+++ testsuite/gcc.target/i386/pr78671.c	(working copy)
@@ -0,0 +1,18 @@ 
+/* { dg-do compile } */
+/* { dg-options "-march=skylake-avx512 -Og" } */
+
+typedef unsigned __int128 u128;
+typedef unsigned __int128 v64u128 __attribute__ ((vector_size (64)));
+
+v64u128
+foo (u128 u128_3, v64u128 v64u128_3, v64u128 v64u128_2, v64u128 v64u128_1,
+     v64u128 v64u128_0)
+{
+  v64u128_0 <<= 1;
+  v64u128_2 >>= 0 != v64u128_2;
+  v64u128_3[v64u128_3[0]] &= 1;
+  v64u128_3 = v64u128_3 & 1;
+  v64u128_2 = v64u128_2 >> 1 | v64u128_2 << v64u128_1[0];
+  v64u128_0[0] >>= 127;
+  return u128_3 + v64u128_0 + v64u128_2 + v64u128_3;
+}