re PR tree-optimization/79723 (Another case of dropped gs: prefix)
authorRichard Biener <rguenther@suse.de>
Tue, 28 Feb 2017 09:17:20 +0000 (09:17 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 28 Feb 2017 09:17:20 +0000 (09:17 +0000)
2017-02-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/79723
* tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Preserve
address-space properly.

* gcc.target/i386/pr79723.c: New testcase.

From-SVN: r245772

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr79723.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index cd9552175ffc06209be003803bf9b4b046367e53..a98a08e2fb47b13bf2f55fc2cc6b7152500ef77b 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79723
+       * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Preserve
+       address-space properly.
+
 2017-02-28  Thomas Schwinge  <thomas@codesourcery.com>
 
        * doc/optinfo.texi (Optimization groups): Fix option used for
index 55edc8a5fea080a06772487c59d1ae4e2eab73de..8c0514c7996dd8e8e2e0a2039f9ce14f126c75c5 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79723
+       * gcc.target/i386/pr79723.c: New testcase.
+
 2017-02-27  Pat Haugen  <pthaugen@us.ibm.com>
 
        PR target/79544
diff --git a/gcc/testsuite/gcc.target/i386/pr79723.c b/gcc/testsuite/gcc.target/i386/pr79723.c
new file mode 100644 (file)
index 0000000..0f1bdee
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse2 -mno-avx" } */
+
+void memset_pattern_seg_gs(unsigned char * __seg_gs *s, long n)
+{
+  for (long i = 0; i < n; ++i)
+    s[i] = 0;
+}
+
+/* { dg-final { scan-assembler "mov\[au\]p.\[ \t\]\[^,\]+, %gs:" } } */
index f4b777eeae61b1c8120177674050649b9edbe023..c87f72c8af8e82ec569911ad785e36e38de93f3d 100644 (file)
@@ -8957,6 +8957,7 @@ free_stmt_vec_info (gimple *stmt)
 static tree
 get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size)
 {
+  tree orig_scalar_type = scalar_type;
   machine_mode inner_mode = TYPE_MODE (scalar_type);
   machine_mode simd_mode;
   unsigned int nbytes = GET_MODE_SIZE (inner_mode);
@@ -9017,6 +9018,12 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size)
       && !INTEGRAL_MODE_P (TYPE_MODE (vectype)))
     return NULL_TREE;
 
+  /* Re-attach the address-space qualifier if we canonicalized the scalar
+     type.  */
+  if (TYPE_ADDR_SPACE (orig_scalar_type) != TYPE_ADDR_SPACE (vectype))
+    return build_qualified_type
+            (vectype, KEEP_QUAL_ADDR_SPACE (TYPE_QUALS (orig_scalar_type)));
+
   return vectype;
 }