Hello!
Attached patch fixes PR65990. rep_8byte is not a valid stringop
strategy for 32bit targets.
2015-05-05 Uros Bizjak <[email protected]>
PR target/65990
* config/i386/i386.c (ix86_parse_stringop_strategy_string): Error out
if rep_8byte stringop strategy was specified for 32-bit target.
testsuite/ChangeLog:
2015-05-05 Uros Bizjak <[email protected]>
PR target/65990
* gcc.target/i386/pr65990.c: New test.
Tested on x86_64-linux-gnu{,-m32} and committed to mainline SVN.
RMs, should this patch be backported to release branches?
Uros.
Index: testsuite/gcc.target/i386/pr65990.c
===================================================================
--- testsuite/gcc.target/i386/pr65990.c (revision 0)
+++ testsuite/gcc.target/i386/pr65990.c (revision 0)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=btver2 -mmemcpy-strategy=rep_8byte:-1:noalign" }
+
+/* { dg-error "stringop strategy name rep_8byte specified for option
-mmemcpy_strategy= not supported for 32-bit code" "" { target ia32 } 0 } */
+
+struct U9
+{
+ unsigned a[9];
+};
+
+struct U9 u9;
+
+void
+foo ()
+{
+ u9 = (struct U9) {
+ .a = {
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ }
+ };
+}
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 222804)
+++ config/i386/i386.c (working copy)
@@ -2988,6 +2988,17 @@ ix86_parse_stringop_strategy_string (char *strateg
return;
}
+ if ((stringop_alg) i == rep_prefix_8_byte
+ && !TARGET_64BIT)
+ {
+ /* rep; movq isn't available in 32-bit code. */
+ error ("stringop strategy name %s specified for option %s "
+ "not supported for 32-bit code",
+ alg_name,
+ is_memset ? "-mmemset_strategy=" : "-mmemcpy_strategy=");
+ return;
+ }
+
input_ranges[n].max = maxs;
input_ranges[n].alg = (stringop_alg) i;
if (!strcmp (align, "align"))