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, 4.3] Fix PR middle-end/38616


The backport was suggested in the bug report; checked on
i486-linux-gnu with a biarch compiler without regressions.

Ok for the branch (and the testcase for the trunk)?

  Matthias

gcc/

2009-01-11  Matthias Klose  <doko@ubuntu.com>

	PR middle-end/38616, backport from mainline:
	2008-05-04  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (*strmovsi_1): Simplify asm alternatives.
	(*strmovsi_rex_1): Ditto.
	(*strsetsi_1): Ditto.
	(*strsetsi_rex_1): Ditto.

	(add<mode>cc): Macroize expander from addqicc, addhicc, addsicc and
	adddicc expanders using SWI mode iterator.

gcc/testsuite/

2009-01-11  Matthias Klose  <doko@ubuntu.com>

        PR middle-end/38616
	* gcc.dg/pr38616.c: New test.

 
Index: gcc/testsuite/gcc.dg/pr38616.c
===================================================================
--- gcc/testsuite/gcc.dg/pr38616.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr38616.c	(revision 0)
@@ -0,0 +1,13 @@
+/* PR middle-end/38616 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fstack-protector" } */
+
+#include <stdio.h> 
+
+#define BUFFER "1234567890abcdefghijklmno"
+int main (void)
+{
+  char buffer[1024]="";
+  sprintf (buffer, "%s", BUFFER);
+  return strcmp (buffer, BUFFER);
+}
Index: gcc/config/i386/i386.md
===================================================================
--- gcc/config/i386/i386.md	(revision 143264)
+++ gcc/config/i386/i386.md	(working copy)
@@ -18622,7 +18622,7 @@
 	(plus:SI (match_dup 3)
 		 (const_int 4)))]
   "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
-  "{movsl|movsd}"
+  "movs{l|d}"
   [(set_attr "type" "str")
    (set_attr "mode" "SI")
    (set_attr "memory" "both")])
@@ -18637,7 +18637,7 @@
 	(plus:DI (match_dup 3)
 		 (const_int 4)))]
   "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
-  "{movsl|movsd}"
+  "movs{l|d}"
   [(set_attr "type" "str")
    (set_attr "mode" "SI")
    (set_attr "memory" "both")])
@@ -18893,7 +18893,7 @@
 	(plus:SI (match_dup 1)
 		 (const_int 4)))]
   "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
-  "{stosl|stosd}"
+  "stos{l|d}"
   [(set_attr "type" "str")
    (set_attr "memory" "store")
    (set_attr "mode" "SI")])
@@ -18905,7 +18905,7 @@
 	(plus:DI (match_dup 1)
 		 (const_int 4)))]
   "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
-  "{stosl|stosd}"
+  "stos{l|d}"
   [(set_attr "type" "str")
    (set_attr "memory" "store")
    (set_attr "mode" "SI")])
@@ -19736,38 +19736,14 @@
 				 operands[1], operands[0]);")
 
 ;; Conditional addition patterns
-(define_expand "addqicc"
-  [(match_operand:QI 0 "register_operand" "")
+(define_expand "add<mode>cc"
+  [(match_operand:SWI 0 "register_operand" "")
    (match_operand 1 "comparison_operator" "")
-   (match_operand:QI 2 "register_operand" "")
-   (match_operand:QI 3 "const_int_operand" "")]
+   (match_operand:SWI 2 "register_operand" "")
+   (match_operand:SWI 3 "const_int_operand" "")]
   ""
   "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
 
-(define_expand "addhicc"
-  [(match_operand:HI 0 "register_operand" "")
-   (match_operand 1 "comparison_operator" "")
-   (match_operand:HI 2 "register_operand" "")
-   (match_operand:HI 3 "const_int_operand" "")]
-  ""
-  "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
-
-(define_expand "addsicc"
-  [(match_operand:SI 0 "register_operand" "")
-   (match_operand 1 "comparison_operator" "")
-   (match_operand:SI 2 "register_operand" "")
-   (match_operand:SI 3 "const_int_operand" "")]
-  ""
-  "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
-
-(define_expand "adddicc"
-  [(match_operand:DI 0 "register_operand" "")
-   (match_operand 1 "comparison_operator" "")
-   (match_operand:DI 2 "register_operand" "")
-   (match_operand:DI 3 "const_int_operand" "")]
-  "TARGET_64BIT"
-  "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
-
 
 ;; Misc patterns (?)
 


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