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]

Fix Thumb-2 casesi bug


thumb2_output_casesi generates instruction sequences that write to
scratch operand 4 before the inputs have been read, and so the
associated insn patterns need an earlyclobber to prevent this
overwriting the inputs.  This patch adds that earlyclobber.  Tested
with no regressions with cross to arm-none-linux-gnueabi (configured
for Thumb-2); OK to commit?

Tests are inherently dependent on register allocation; in 4.3-based
sources this was observed to cause a miscompilation of code inlined
into __gcc_personality_v0 and so failures of forced unwinding tests
gcc.dg/cleanup-*.c, but I don't have a testcase this miscompiles with
trunk.

2008-11-20  Joseph Myers  <joseph@codesourcery.com>

	* config/arm/thumb2.md (thumb2_casesi_internal,
	thumb2_casesi_internal_pic): Use earlyclobber for scratch operand
	4.

Index: config/arm/thumb2.md
===================================================================
--- config/arm/thumb2.md	(revision 142046)
+++ config/arm/thumb2.md	(working copy)
@@ -949,7 +949,7 @@
 				 (label_ref (match_operand 2 "" ""))))
 		(label_ref (match_operand 3 "" ""))))
 	      (clobber (reg:CC CC_REGNUM))
-	      (clobber (match_scratch:SI 4 "=r"))
+	      (clobber (match_scratch:SI 4 "=&r"))
 	      (use (label_ref (match_dup 2)))])]
   "TARGET_THUMB2 && !flag_pic"
   "* return thumb2_output_casesi(operands);"
@@ -966,7 +966,7 @@
 				 (label_ref (match_operand 2 "" ""))))
 		(label_ref (match_operand 3 "" ""))))
 	      (clobber (reg:CC CC_REGNUM))
-	      (clobber (match_scratch:SI 4 "=r"))
+	      (clobber (match_scratch:SI 4 "=&r"))
 	      (clobber (match_scratch:SI 5 "=r"))
 	      (use (label_ref (match_dup 2)))])]
   "TARGET_THUMB2 && flag_pic"

-- 
Joseph S. Myers
joseph@codesourcery.com


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