This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

One more patch for PR79131


The following patch permits to compile last 3 test cases on

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

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

Committed as rev. 244989.


Index: ChangeLog
===================================================================
--- ChangeLog	(revision 244987)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2017-01-27  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR target/79131
+	* lra-assigns.c (find_hard_regno_for_1): Take endianess for into
+	account to calculate conflict_set.
+
 2017-01-27  Bin Cheng  <bin.cheng@arm.com>
 
 	PR rtl-optimization/78559
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 244987)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2017-01-27  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR target/79131
+	* gcc.target/arm/pr79131.c: Rename to gcc.target/arm/pr79131-1.c.
+	* gcc.target/arm/pr79131-2.c: New.
+
 2017-01-27  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
 	PR target/65484
Index: lra-assigns.c
===================================================================
--- lra-assigns.c	(revision 244942)
+++ lra-assigns.c	(working copy)
@@ -564,32 +564,45 @@ find_hard_regno_for_1 (int regno, int *c
   offset = lra_reg_info[regno].offset;
   CLEAR_HARD_REG_SET (impossible_start_hard_regs);
   EXECUTE_IF_SET_IN_SPARSESET (live_range_hard_reg_pseudos, conflict_regno)
-    if (lra_reg_val_equal_p (conflict_regno, val, offset))
-      {
-	conflict_hr = live_pseudos_reg_renumber[conflict_regno];
-	nregs = (hard_regno_nregs[conflict_hr]
-		 [lra_reg_info[conflict_regno].biggest_mode]);
-	/* Remember about multi-register pseudos.  For example, 2 hard
-	   register pseudos can start on the same hard register but can
-	   not start on HR and HR+1/HR-1.  */
-	for (hr = conflict_hr + 1;
-	     hr < FIRST_PSEUDO_REGISTER && hr < conflict_hr + nregs;
-	     hr++)
-	  SET_HARD_REG_BIT (impossible_start_hard_regs, hr);
-	for (hr = conflict_hr - 1;
-	     hr >= 0 && hr + hard_regno_nregs[hr][biggest_mode] > conflict_hr;
-	     hr--)
-	  SET_HARD_REG_BIT (impossible_start_hard_regs, hr);
-      }
-    else
-      {
-	add_to_hard_reg_set (&conflict_set,
-			     lra_reg_info[conflict_regno].biggest_mode,
-			     live_pseudos_reg_renumber[conflict_regno]);
-	if (hard_reg_set_subset_p (reg_class_contents[rclass],
-				   conflict_set))
-	  return -1;
-      }
+    {
+      conflict_hr = live_pseudos_reg_renumber[conflict_regno];
+      if (lra_reg_val_equal_p (conflict_regno, val, offset))
+	{
+	  conflict_hr = live_pseudos_reg_renumber[conflict_regno];
+	  nregs = (hard_regno_nregs[conflict_hr]
+		   [lra_reg_info[conflict_regno].biggest_mode]);
+	  /* Remember about multi-register pseudos.  For example, 2
+	     hard register pseudos can start on the same hard register
+	     but can not start on HR and HR+1/HR-1.  */
+	  for (hr = conflict_hr + 1;
+	       hr < FIRST_PSEUDO_REGISTER && hr < conflict_hr + nregs;
+	       hr++)
+	    SET_HARD_REG_BIT (impossible_start_hard_regs, hr);
+	  for (hr = conflict_hr - 1;
+	       hr >= 0 && hr + hard_regno_nregs[hr][biggest_mode] > conflict_hr;
+	       hr--)
+	    SET_HARD_REG_BIT (impossible_start_hard_regs, hr);
+	}
+      else
+	{
+	  enum machine_mode biggest_conflict_mode
+	    = lra_reg_info[conflict_regno].biggest_mode;
+	  int biggest_conflict_nregs
+	    = hard_regno_nregs[conflict_hr][biggest_conflict_mode];
+	  
+	  nregs_diff = (biggest_conflict_nregs
+			- (hard_regno_nregs
+			   [conflict_hr]
+			   [PSEUDO_REGNO_MODE (conflict_regno)]));
+	  add_to_hard_reg_set (&conflict_set,
+			       biggest_conflict_mode,
+			       conflict_hr
+			       - (WORDS_BIG_ENDIAN ? nregs_diff : 0));
+	  if (hard_reg_set_subset_p (reg_class_contents[rclass],
+				     conflict_set))
+	    return -1;
+	}
+    }
   EXECUTE_IF_SET_IN_SPARSESET (conflict_reload_and_inheritance_pseudos,
 			       conflict_regno)
     if (!lra_reg_val_equal_p (conflict_regno, val, offset))
Index: testsuite/gcc.target/arm/pr79131-2.c
===================================================================
--- testsuite/gcc.target/arm/pr79131-2.c	(revision 0)
+++ testsuite/gcc.target/arm/pr79131-2.c	(working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mbig-endian" } */
+
+struct nilfs_segment_usage {
+  int su_flags;
+} a;
+enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY } fn1();
+int b;
+void fn2(int *, long long);
+void fn3() {
+  int c, d;
+  struct nilfs_segment_usage e = a;
+  fn1();
+  c = e.su_flags & 1 << NILFS_SEGMENT_USAGE_DIRTY;
+  d = c;
+  fn2(&b, d ? -1 : 0);
+}
Index: testsuite/gcc.target/arm/pr79131.c
===================================================================
--- testsuite/gcc.target/arm/pr79131.c	(revision 244595)
+++ testsuite/gcc.target/arm/pr79131.c	(working copy)
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -mbig-endian" } */
-
-long long a;
-enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY } b;
-void nilfs_sufile_mod_counter(long long p1) {
-  long c = p1;
-  unsigned d = __builtin_bswap64(a);
-  a = __builtin_bswap64(d + c);
-}
-void nilfs_sufile_do_free() {
-  int e, f;
-  e = __builtin_bswap32(b) & 1 << NILFS_SEGMENT_USAGE_DIRTY;
-  f = e;
-  nilfs_sufile_mod_counter(f ? -1 : 0);
-}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]