Blame SOURCES/gcc32-pr12799.patch

4ac4fd
2005-10-02  Jakub Jelinek  <jakub@redhat.com>
4ac4fd
4ac4fd
	PR optimization/12799
4ac4fd
	* gcc.c-torture/execute/20051002-1.c: New test.
4ac4fd
4ac4fd
2003-11-02  Eric Botcazou  <ebotcazou@libertysurf.fr>
4ac4fd
4ac4fd
	PR optimization/12799
4ac4fd
	* reload1.c (reload_cse_move2add): Generate the add2
4ac4fd
	patterns manually.
4ac4fd
4ac4fd
	* gcc.dg/20031102-1.c: New test.
4ac4fd
4ac4fd
--- gcc/reload1.c.jj	2003-10-31 11:42:15.000000000 +0100
4ac4fd
+++ gcc/reload1.c	2005-10-02 21:52:08.000000000 +0200
4ac4fd
@@ -9176,8 +9176,13 @@ reload_cse_move2add (first)
4ac4fd
 		    success = validate_change (insn, &SET_SRC (pat), reg, 0);
4ac4fd
 		  else if (rtx_cost (new_src, PLUS) < rtx_cost (src, SET)
4ac4fd
 			   && have_add2_insn (reg, new_src))
4ac4fd
-		    success = validate_change (insn, &PATTERN (insn),
4ac4fd
-					       gen_add2_insn (reg, new_src), 0);
4ac4fd
+		    {
4ac4fd
+		      rtx newpat = gen_rtx_SET (VOIDmode, reg,
4ac4fd
+						gen_rtx_PLUS (GET_MODE (reg),
4ac4fd
+							      reg, new_src));
4ac4fd
+		      success
4ac4fd
+			= validate_change (insn, &PATTERN (insn), newpat, 0);
4ac4fd
+		    }
4ac4fd
 		  reg_set_luid[regno] = move2add_luid;
4ac4fd
 		  reg_mode[regno] = GET_MODE (reg);
4ac4fd
 		  reg_offset[regno] = INTVAL (src);
4ac4fd
@@ -9227,9 +9232,15 @@ reload_cse_move2add (first)
4ac4fd
 		      else if ((rtx_cost (new_src, PLUS)
4ac4fd
 				< COSTS_N_INSNS (1) + rtx_cost (src3, SET))
4ac4fd
 			       && have_add2_insn (reg, new_src))
4ac4fd
-			success
4ac4fd
-			  = validate_change (next, &PATTERN (next),
4ac4fd
-					     gen_add2_insn (reg, new_src), 0);
4ac4fd
+			{
4ac4fd
+			  rtx newpat
4ac4fd
+			    = gen_rtx_SET (VOIDmode, reg,
4ac4fd
+					   gen_rtx_PLUS (GET_MODE (reg),
4ac4fd
+							 reg, new_src));
4ac4fd
+			  success
4ac4fd
+			    = validate_change (next, &PATTERN (next),
4ac4fd
+					       newpat, 0);
4ac4fd
+			}
4ac4fd
 		      if (success)
4ac4fd
 			delete_insn (insn);
4ac4fd
 		      insn = next;
4ac4fd
--- gcc/testsuite/gcc.dg/20031102-1.c.jj	1 Jan 1970 00:00:00 -0000
4ac4fd
+++ gcc/testsuite/gcc.dg/20031102-1.c	2 Nov 2003 08:32:23 -0000	1.1
4ac4fd
@@ -0,0 +1,37 @@
4ac4fd
+/* PR optimization/12799 */
4ac4fd
+/* Origin: Pratap Subrahmanyam <pratap@vmware.com> */
4ac4fd
+
4ac4fd
+/* { dg-do run } */
4ac4fd
+/* { dg-options "-O2" } */
4ac4fd
+/* { dg-options "-O2 -march=i686" { target i686-*-* } } */
4ac4fd
+
4ac4fd
+/* Verify that reload_cse_move2add doesn't add unexpected CLOBBERs. */
4ac4fd
+
4ac4fd
+extern void abort(void);
4ac4fd
+
4ac4fd
+int loo = 1;
4ac4fd
+
4ac4fd
+__inline__ char InlineFunc(void)
4ac4fd
+{
4ac4fd
+  return __builtin_expect(!!(loo == 1), 1);
4ac4fd
+}
4ac4fd
+
4ac4fd
+int FooBar(void)
4ac4fd
+{
4ac4fd
+  int i;
4ac4fd
+  int var1 = InlineFunc() ? 2046 : 1023;
4ac4fd
+  int var2 = InlineFunc() ? 512 : 1024;
4ac4fd
+
4ac4fd
+  for (i = 0; i < var1; i++)
4ac4fd
+    ;
4ac4fd
+
4ac4fd
+  if (InlineFunc() && var2 != 512)
4ac4fd
+    abort();
4ac4fd
+
4ac4fd
+  return 0;
4ac4fd
+}
4ac4fd
+
4ac4fd
+int main(void)
4ac4fd
+{
4ac4fd
+  return FooBar();
4ac4fd
+}
4ac4fd
--- gcc/testsuite/gcc.c-torture/execute/20051002-1.c.jj	2005-09-19 08:33:21.659531528 +0200
4ac4fd
+++ gcc/testsuite/gcc.c-torture/execute/20051002-1.c	2005-10-02 20:38:54.000000000 +0200
4ac4fd
@@ -0,0 +1,18 @@
4ac4fd
+/* PR optimization/12799 */
4ac4fd
+extern void abort (void);
4ac4fd
+
4ac4fd
+unsigned int
4ac4fd
+foo (unsigned long a)
4ac4fd
+{
4ac4fd
+  if (a >= 0xffffffffUL)
4ac4fd
+    return 0xffffffff;
4ac4fd
+  return a;
4ac4fd
+}
4ac4fd
+
4ac4fd
+int
4ac4fd
+main ()
4ac4fd
+{
4ac4fd
+  if (foo (0) != 0)
4ac4fd
+    abort ();
4ac4fd
+  return 0;
4ac4fd
+}