From 2894086e18ba73fa537e89d47aedd70553bd8ebe Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 21 Apr 2011 13:55:45 +0200 Subject: [PATCH] re PR target/48708 (Invalid V2DI vector set insn generated) PR target/48708 * config/i386/i386.c (ix86_expand_vector_set) : Generate vec_extract and vec_concat for non-SSE4_1 targets. testsuite/ChangeLog: PR target/48708 * gcc.target/i386/pr48708.c: New test. From-SVN: r172821 --- gcc/ChangeLog | 35 ++++++++++++------------- gcc/config/i386/i386.c | 11 +++++++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/i386/pr48708.c | 15 +++++++++++ 4 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr48708.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a414107f799..2f4316cc0bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-21 Uros Bizjak + + PR target/48708 + * config/i386/i386.c (ix86_expand_vector_set) : Generate + vec_extract and vec_concat for non-SSE4_1 targets. + 2011-04-21 Richard Guenther * tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Handle @@ -16,8 +22,7 @@ * config/bfin/bfin.h (bfin_cc_rtx, bfin_rets_rtx): Use rtx, not struct rtx_def *. * config/cris/cris-protos.h (STDIO_INCLUDED): Don't define. - * config/h8300/h8300.h (struct cum_arg): Use rtx, not struct - rtx_def *. + * config/h8300/h8300.h (struct cum_arg): Use rtx, not struct rtx_def *. * config/iq2000/iq2000.h (struct iq2000_args): Use rtx, not struct rtx_def *. * config/m32c/m32c-protos.h (MM, UINT): Don't define. Expand @@ -26,18 +31,15 @@ rtx, not struct rtx_def *. * config/pa/pa-protos.h (return_addr_rtx): Use rtx, not struct rtx_def *. - * config/pa/pa.h (hppa_pic_save_rtx): Use rtx, not struct rtx_def - *. - * config/pdp11/pdp11.h (cc0_reg_rtx): Use rtx, not struct rtx_def - *. + * config/pa/pa.h (hppa_pic_save_rtx): Use rtx, not struct rtx_def *. + * config/pdp11/pdp11.h (cc0_reg_rtx): Use rtx, not struct rtx_def *. * config/sh/sh-protos.h (sfunc_uses_reg, get_fpscr_rtx): Use rtx, not struct rtx_def *. * config/sh/sh.h (sh_compare_op0, sh_compare_op1): Use rtx, not struct rtx_def *. * config/spu/spu-protos.h (spu_float_const): Use rtx, not struct rtx_def *. - * config/spu/spu.c (spu_float_const): Use rtx, not struct rtx_def - *. + * config/spu/spu.c (spu_float_const): Use rtx, not struct rtx_def *. 2011-04-21 Richard Sandiford @@ -183,8 +185,8 @@ * config/mn10300/mn10300-protos.h (mn10300_legitimate_constant_p): Delete. * config/mn10300/mn10300.h (LEGITIMATE_CONSTANT_P): Likewise. - * config/mn10300/mn10300.c (mn10300_legitimate_constant_p): - Make static. Add a mode argument. + * config/mn10300/mn10300.c (mn10300_legitimate_constant_p): Make + static. Add a mode argument. (TARGET_LEGITIMATE_CONSTANT_P): Define. * config/moxie/moxie.h (LEGITIMATE_CONSTANT_P): Delete. @@ -284,8 +286,7 @@ (mips_secondary_reload_class): Likewise. * config/pa/pa.c (TARGET_CANNOT_FORCE_CONST_MEM): Redefine to... (pa_cannot_force_const_mem): ...this new function. - * config/rs6000/rs6000.c (TARGET_CANNOT_FORCE_CONST_MEM): Reefine - to... + * config/rs6000/rs6000.c (TARGET_CANNOT_FORCE_CONST_MEM): Reefine to... (rs6000_cannot_force_const_mem): ...this new function. * config/s390/s390.c (s390_cannot_force_const_mem): Add a mode argument. @@ -386,8 +387,7 @@ 2011-04-20 Chung-Lin Tang * config/arm/arm.c (arm_legitimize_reload_address): For NEON - quad-word modes, reduce to 9-bit index range when above 1016 - limit. + quad-word modes, reduce to 9-bit index range when above 1016 limit. 2011-04-20 Andrew Stubbs @@ -396,8 +396,8 @@ 2011-04-20 Kai Tietz - * fold-const.c (fold_binary_loc): Add handling for - (X & ~Y) | (~X & Y) and (X && !Y) | (!X && Y) optimization to (X ^ Y). + * fold-const.c (fold_binary_loc): Add handling for (X & ~Y) | (~X & Y) + and (X && !Y) | (!X && Y) optimization to (X ^ Y). 2011-04-20 Andrew Stubbs @@ -445,8 +445,7 @@ PR middle-end/48695 * tree-ssa-alias.c (aliasing_component_refs_p): Compute base - objects and types here. Adjust for their offset before - comparing. + objects and types here. Adjust for their offset before comparing. 2011-04-20 Richard Sandiford diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b55c67bb564..558eff11936 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -31484,10 +31484,19 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt) break; case V2DImode: - use_vec_merge = TARGET_SSE4_1; + use_vec_merge = TARGET_SSE4_1 && TARGET_64BIT; if (use_vec_merge) break; + tmp = gen_reg_rtx (GET_MODE_INNER (mode)); + ix86_expand_vector_extract (false, tmp, target, 1 - elt); + if (elt == 0) + tmp = gen_rtx_VEC_CONCAT (mode, tmp, val); + else + tmp = gen_rtx_VEC_CONCAT (mode, val, tmp); + emit_insn (gen_rtx_SET (VOIDmode, target, tmp)); + return; + case V2DFmode: { rtx op0, op1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5917c5ba638..53198469345 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-21 Uros Bizjak + + PR target/48708 + * gcc.target/i386/pr48708.c: New test. + 2011-04-21 Richard Sandiford * gcc.dg/vect/vect-119.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr48708.c b/gcc/testsuite/gcc.target/i386/pr48708.c new file mode 100644 index 00000000000..355c2b2691f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr48708.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#include + +typedef long long T __attribute__((may_alias)); +struct S { __m128i d; }; + +__m128i +foo (long long *x, struct S *y, __m128i *z) +{ + struct S s = *y; + ((T *) &s.d)[0] = *x; + return _mm_cmpeq_epi16 (s.d, *z); +} -- 2.30.2