From: Uros Bizjak Date: Sun, 16 Aug 2009 21:05:47 +0000 (+0200) Subject: backport: re PR target/41019 (Vector conditional move produces wrong code with -O3.) X-Git-Tag: releases/gcc-4.3.5~427 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3d14970210e8a18e7e20a208c79ca685929de2b;p=thirdparty%2Fgcc.git backport: re PR target/41019 (Vector conditional move produces wrong code with -O3.) Backport from mainline: 2009-08-14 Uros Bizjak PR target/41019 * config/i386/sse.md (SSEMODE124C8): New mode iterator. (vcond): Assert that operation is supported by ix86_expand_fp_vcond. (vcond): Use SSEMODE124C8 instead of SSEMODE124. Assert that operation is supported by ix86_expand_int_vcond. (vcondu): Ditto. testsuite/ChangeLog: Backport from mainline: 2009-08-14 Uros Bizjak PR target/41019 * gcc.target/i386/pr41019.c: New test. From-SVN: r150816 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c775deb2af5b..eb8c7d017921 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2009-08-16 Uros Bizjak + + Backport from mainline: + 2009-08-14 Uros Bizjak + + PR target/41019 + * config/i386/sse.md (SSEMODE124C8): New mode iterator. + (vcond): Assert that operation is supported by + ix86_expand_fp_vcond. + (vcond): Use SSEMODE124C8 instead of SSEMODE124. + Assert that operation is supported by ix86_expand_int_vcond. + (vcondu): Ditto. + 2009-08-14 Uros Bizjak Backport from mainline: @@ -12,7 +25,7 @@ 2009-08-13 Andrey Belevantsev PR rtl-optimization/41033 - * alias.c (nonoverlapping_component_refs_p): Punt when strict + * alias.c (nonoverlapping_component_refs_p): Punt when strict aliasing is disabled. 2009-08-05 Uros Bizjak @@ -172,7 +185,7 @@ 2009-06-30 Ira Rosen PR tree-optimization/40542 - * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't + * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't vectorize volatile types. 2009-06-29 Richard Guenther @@ -250,11 +263,11 @@ arg1. 2009-02-03 Jakub Jelinek - + PR target/35318 * function.c (match_asm_constraints_1): Skip over initial optional % in the constraint. - + 2009-06-19 Richard Guenther Backport from mainline: @@ -545,7 +558,7 @@ * c-typeck.c (build_conditional_expr): Emit ObjC warnings by calling objc_compare_types and surpress warnings about incompatible C pointers that are compatible ObjC pointers. - + 2009-04-01 Eric Botcazou PR rtl-optimization/39588 @@ -614,9 +627,9 @@ Backport from mainline: 2008-12-02 Martin Jambor - + PR middle-end/37861 - * tree-ssa-forwprop.c + * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Check that the offset is not computed from a MULT_EXPR if element size is one. @@ -772,7 +785,7 @@ PR rtl-optimization/39076 Backport from mainline: 2008-06-28 Andrew Jenner - + * regrename.c (build_def_use): Don't copy RTX. 2009-02-04 Joseph Myers @@ -955,7 +968,7 @@ * sched-deps.c (sched_analyze_2)[UNSPEC_VOLATILE]: Flush pending memory loads and stores. - + 2009-01-11 Matthias Klose PR middle-end/38616 @@ -1425,7 +1438,7 @@ 2008-10-17 Andrew MacLeod PR tree-optimization/37102 - * tree-outof-ssa.c (remove_gimple_phi_args): Remove all the PHI args + * tree-outof-ssa.c (remove_gimple_phi_args): Remove all the PHI args from a node. Check to see if another PHI is dead. (eliminate_useless_phis): Rename from eliminate_virtual_phis and remove real PHIs which have no uses. @@ -1889,7 +1902,7 @@ * sched-rgn.c (new_ready): Check if instruction can be speculatively scheduled before attempting speculation. - (debug_rgn_dependencies): Remove wrongful assert. + (debug_rgn_dependencies): Remove wrongful assert. 2008-08-05 Jason Merrill diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 51aeaf2619a8..cf28bdf86abb 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -36,6 +36,10 @@ (define_mode_iterator SSEMODEF4 [SF DF V4SF V2DF]) (define_mode_iterator SSEMODEF2P [V4SF V2DF]) +;; Modes handled by integer vcond pattern +(define_mode_iterator SSEMODE124C8 [V16QI V8HI V4SI + (V2DI "TARGET_SSE4_2 || TARGET_SSE5")]) + ;; Mapping from integer vector mode to mnemonic suffix (define_mode_attr ssevecsize [(V16QI "b") (V8HI "w") (V4SI "d") (V2DI "q")]) @@ -909,10 +913,9 @@ (match_operand:V4SF 2 "general_operand" "")))] "TARGET_SSE" { - if (ix86_expand_fp_vcond (operands)) - DONE; - else - FAIL; + bool ok = ix86_expand_fp_vcond (operands); + gcc_assert (ok); + DONE; }) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -4349,35 +4352,33 @@ (set_attr "mode" "TI")]) (define_expand "vcond" - [(set (match_operand:SSEMODEI 0 "register_operand" "") - (if_then_else:SSEMODEI + [(set (match_operand:SSEMODE124C8 0 "register_operand" "") + (if_then_else:SSEMODE124C8 (match_operator 3 "" - [(match_operand:SSEMODEI 4 "nonimmediate_operand" "") - (match_operand:SSEMODEI 5 "nonimmediate_operand" "")]) - (match_operand:SSEMODEI 1 "general_operand" "") - (match_operand:SSEMODEI 2 "general_operand" "")))] + [(match_operand:SSEMODE124C8 4 "nonimmediate_operand" "") + (match_operand:SSEMODE124C8 5 "nonimmediate_operand" "")]) + (match_operand:SSEMODE124C8 1 "general_operand" "") + (match_operand:SSEMODE124C8 2 "general_operand" "")))] "TARGET_SSE2" { - if (ix86_expand_int_vcond (operands)) - DONE; - else - FAIL; + bool ok = ix86_expand_int_vcond (operands); + gcc_assert (ok); + DONE; }) (define_expand "vcondu" - [(set (match_operand:SSEMODEI 0 "register_operand" "") - (if_then_else:SSEMODEI + [(set (match_operand:SSEMODE124C8 0 "register_operand" "") + (if_then_else:SSEMODE124C8 (match_operator 3 "" - [(match_operand:SSEMODEI 4 "nonimmediate_operand" "") - (match_operand:SSEMODEI 5 "nonimmediate_operand" "")]) - (match_operand:SSEMODEI 1 "general_operand" "") - (match_operand:SSEMODEI 2 "general_operand" "")))] + [(match_operand:SSEMODE124C8 4 "nonimmediate_operand" "") + (match_operand:SSEMODE124C8 5 "nonimmediate_operand" "")]) + (match_operand:SSEMODE124C8 1 "general_operand" "") + (match_operand:SSEMODE124C8 2 "general_operand" "")))] "TARGET_SSE2" { - if (ix86_expand_int_vcond (operands)) - DONE; - else - FAIL; + bool ok = ix86_expand_int_vcond (operands); + gcc_assert (ok); + DONE; }) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf67bbaa4534..f5dc05aa58ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-08-16 Uros Bizjak + + Backport from mainline: + 2009-08-14 Uros Bizjak + + PR target/41019 + * gcc.target/i386/pr41019.c: New test. + 2009-08-16 Paul Thomas PR fortran/40847 diff --git a/gcc/testsuite/gcc.target/i386/pr41019.c b/gcc/testsuite/gcc.target/i386/pr41019.c new file mode 100644 index 000000000000..c0021c6a4506 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr41019.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse2 -ftree-vectorize" } */ + +#include "sse2-check.h" + +long long int a[64]; + +void +sse2_test (void) +{ + int k; + + for (k = 0; k < 64; k++) + a[k] = a[k] != 5 ? 12 : 10; + + for (k = 0; k < 64; k++) + if (a[k] != 12) + abort (); +}