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]

[patch, committed] fix nios2 thinko


Our friends at Altera spotted a bug in the Nios II backend that was causing different code to be generated randomly for functions involving taking the address of a symbol. The root of the problem was that in r255492 I goofed and introduced some uses of INTVAL that were not guarded by CONST_INT_P so they were randomly grabbing contents of a SYMBOL_REF rtx instead. AFAICT the generated code was not functionally incorrect, just different; the bug caused the movsi_internal splitter to fail to fire when it was supposed to, but I think LRA was subsequently generating the %hi/%lo pair via a different code path.

The fix is pretty obvious....  add the missing guard.  :-P

-Sandra
2018-03-15  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* config/nios2/nios2.md (movsi_internal): Fix thinko in 
	split predicate.
Index: gcc/config/nios2/nios2.md
===================================================================
--- gcc/config/nios2/nios2.md	(revision 482298)
+++ gcc/config/nios2/nios2.md	(working copy)
@@ -298,9 +298,10 @@
   }
   "(nios2_large_constant_memory_operand_p (operands[0]) 
     || nios2_large_constant_memory_operand_p (operands[1])
-    || (nios2_large_constant_p (operands[1]) 
-        && !SMALL_INT_UNSIGNED (INTVAL (operands[1]))
-	&& !UPPER16_INT (INTVAL (operands[1]))))"
+    || (nios2_large_constant_p (operands[1])
+        && !(CONST_INT_P (operands[1])
+	     && (SMALL_INT_UNSIGNED (INTVAL (operands[1]))
+	     	 || UPPER16_INT (INTVAL (operands[1]))))))"
   [(set (match_dup 0) (match_dup 1))]
   {
     if (nios2_large_constant_memory_operand_p (operands[0]))

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