From: Jakub Jelinek Date: Sun, 16 Jan 2011 20:11:16 +0000 (+0100) Subject: backport: re PR target/41082 (FAIL: gfortran.fortran-torture/execute/where_2.f90... X-Git-Tag: releases/gcc-4.5.3~309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51ff881a02f11f8ddc73691d557d8cf497e19c32;p=thirdparty%2Fgcc.git backport: re PR target/41082 (FAIL: gfortran.fortran-torture/execute/where_2.f90 execution, -O3) Backport from mainline 2010-12-09 Jakub Jelinek PR target/41082 * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Use stvx instead of stve*x. (altivec_expand_stv_builtin): For op0 use mode of operand 1 instead of operand 0. * config/rs6000/altivec.md (VI_scalar): New mode attr. (altivec_stvex, *altivec_stvesfx): Use scalar instead of vector mode for operand 0, put operand 1 into UNSPEC. From-SVN: r168860 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb32568e36d8..3caa6c65a5e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2011-01-16 Jakub Jelinek + + Backport from mainline + 2010-12-09 Jakub Jelinek + + PR target/41082 + * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Use stvx + instead of stve*x. + (altivec_expand_stv_builtin): For op0 use mode of operand 1 instead + of operand 0. + * config/rs6000/altivec.md (VI_scalar): New mode attr. + (altivec_stvex, *altivec_stvesfx): Use scalar instead of + vector mode for operand 0, put operand 1 into UNSPEC. + 2011-01-13 Nick Clifton Import this fix from the mainline: diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 6fbb7cdcdac6..7b0831364bf5 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -171,6 +171,7 @@ (define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI]) (define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")]) +(define_mode_attr VI_scalar [(V4SI "SI") (V8HI "HI") (V16QI "QI")]) ;; Vector move instructions. (define_insn "*altivec_mov" @@ -1777,19 +1778,15 @@ [(set_attr "type" "vecstore")]) (define_insn "altivec_stvex" - [(parallel - [(set (match_operand:VI 0 "memory_operand" "=Z") - (match_operand:VI 1 "register_operand" "v")) - (unspec [(const_int 0)] UNSPEC_STVE)])] + [(set (match_operand: 0 "memory_operand" "=Z") + (unspec: [(match_operand:VI 1 "register_operand" "v")] UNSPEC_STVE))] "TARGET_ALTIVEC" "stvex %1,%y0" [(set_attr "type" "vecstore")]) (define_insn "*altivec_stvesfx" - [(parallel - [(set (match_operand:V4SF 0 "memory_operand" "=Z") - (match_operand:V4SF 1 "register_operand" "v")) - (unspec [(const_int 0)] UNSPEC_STVE)])] + [(set (match_operand:SF 0 "memory_operand" "=Z") + (unspec:SF [(match_operand:V4SF 1 "register_operand" "v")] UNSPEC_STVE))] "TARGET_ALTIVEC" "stvewx %1,%y0" [(set_attr "type" "vecstore")]) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 01e6d7167ec6..e4ccc3dad271 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4472,7 +4472,7 @@ rs6000_expand_vector_extract (rtx target, rtx vec, int elt) { enum machine_mode mode = GET_MODE (vec); enum machine_mode inner_mode = GET_MODE_INNER (mode); - rtx mem, x; + rtx mem; if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode)) { @@ -4485,17 +4485,11 @@ rs6000_expand_vector_extract (rtx target, rtx vec, int elt) /* Allocate mode-sized buffer. */ mem = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0); + emit_move_insn (mem, vec); + /* Add offset to field within buffer matching vector element. */ - mem = adjust_address_nv (mem, mode, elt * GET_MODE_SIZE (inner_mode)); + mem = adjust_address_nv (mem, inner_mode, elt * GET_MODE_SIZE (inner_mode)); - /* Store single field into mode-sized buffer. */ - x = gen_rtx_UNSPEC (VOIDmode, - gen_rtvec (1, const0_rtx), UNSPEC_STVE); - emit_insn (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (2, - gen_rtx_SET (VOIDmode, - mem, vec), - x))); emit_move_insn (target, adjust_address_nv (mem, inner_mode, 0)); } @@ -9897,6 +9891,7 @@ altivec_expand_stv_builtin (enum insn_code icode, tree exp) rtx op2 = expand_normal (arg2); rtx pat, addr; enum machine_mode tmode = insn_data[icode].operand[0].mode; + enum machine_mode smode = insn_data[icode].operand[1].mode; enum machine_mode mode1 = Pmode; enum machine_mode mode2 = Pmode; @@ -9906,8 +9901,8 @@ altivec_expand_stv_builtin (enum insn_code icode, tree exp) || arg2 == error_mark_node) return const0_rtx; - if (! (*insn_data[icode].operand[1].predicate) (op0, tmode)) - op0 = copy_to_mode_reg (tmode, op0); + if (! (*insn_data[icode].operand[1].predicate) (op0, smode)) + op0 = copy_to_mode_reg (smode, op0); op2 = copy_to_mode_reg (mode2, op2);