From: Richard Biener Date: Tue, 28 Feb 2017 09:17:20 +0000 (+0000) Subject: re PR tree-optimization/79723 (Another case of dropped gs: prefix) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7d97b2846c5647a81548caa3264d77c0a595010;p=gcc.git re PR tree-optimization/79723 (Another case of dropped gs: prefix) 2017-02-28 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cd9552175ff..a98a08e2fb4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-02-28 Richard Biener + + PR tree-optimization/79723 + * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Preserve + address-space properly. + 2017-02-28 Thomas Schwinge * doc/optinfo.texi (Optimization groups): Fix option used for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55edc8a5fea..8c0514c7996 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-28 Richard Biener + + PR tree-optimization/79723 + * gcc.target/i386/pr79723.c: New testcase. + 2017-02-27 Pat Haugen 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 index 00000000000..0f1bdeee86a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79723.c @@ -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:" } } */ diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index f4b777eeae6..c87f72c8af8 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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; }