From 1262fd02b65bb037b36551b91df729bace07ba46 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 14 Aug 2009 12:31:09 +0200 Subject: [PATCH] re PR target/41019 (Vector conditional move produces wrong code with -O3.) 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: PR target/41019 * gcc.target/i386/pr41019.c: New test. From-SVN: r150738 --- gcc/ChangeLog | 29 ++++++++++----- gcc/config/i386/sse.md | 49 +++++++++++++------------ gcc/testsuite/ChangeLog | 19 ++++++---- gcc/testsuite/gcc.target/i386/pr41019.c | 19 ++++++++++ 4 files changed, 75 insertions(+), 41 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr41019.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6eb18899621..e48cbcdfdba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +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-13 DJ Delorie * config/i386/djgpp-stdint.h: New. @@ -6,8 +16,7 @@ 2009-08-13 Kaz Kojima * config/sh/sh.c (sh_override_options): When flag_exceptions or - flag_unwind_tables is on, turn flag_reorder_blocks_and_partition - off. + flag_unwind_tables is on, turn flag_reorder_blocks_and_partition off. 2009-08-13 Ghassan Shobaki @@ -182,18 +191,19 @@ transform has been done. Call restore_scattering if the transform is not legal. (graphite-interchange.c): Same. - * graphite-poly.c (print_scattering_function): Test for PBB_TRANSFORMED. + * graphite-poly.c (print_scattering_function): Test for + PBB_TRANSFORMED. (graphite_read_transforms): Initialize PBB_TRANSFORMED. (apply_poly_transforms): Do not gcc_assert that the transform is legal. - (new_poly_bb): Initialize PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL. + (new_poly_bb): Initialize PBB_TRANSFORMED, PBB_SAVED and PBB_ORIGINAL. Do not initialize PBB_NB_SCATTERING_TRANSFORM, PBB_NB_LOCAL_VARIABLES, PBB_TRANSFORMED_SCATTERING, and PBB_ORIGINAL_SCATTERING. (free_poly_dr): Free PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL. * graphite-poly.h (struct poly_scattering): New. (struct poly_bb): Add original, transformed, and saved fields. - Remove transformed_scattering, original_scattering, nb_local_variables, - and nb_scattering_transform fields. + Remove transformed_scattering, original_scattering, + nb_local_variables and nb_scattering_transform fields. (PBB_ORIGINAL, PBB_TRANSFORMED, PBB_SAVED): New. (poly_scattering_new): New. (poly_scattering_free): New. @@ -248,8 +258,7 @@ * config/mips/mips-protos.h (and_operands_ok): Declare it. * config/mips/mips.md (move_type): Add ext_ins and logical. (type): Handle them. - (and3): Use and_reg_operand as the second operand's - predicate. + (and3): Use and_reg_operand as the second operand's predicate. (*and3): Add alternatives for lbu, lhu, lwu, ext and shift_shift. Remove commutative constraint modifier. (*and3_mips16): Add alternatives for lbu, lhu, lwu and @@ -1396,9 +1405,9 @@ (vec_unpacks_hi_v4sf): Ditto. (vec_unpacks_lo_v4sf): Ditto. (vec_unpacks_float_hi_v4si): Ditto. - (vec_unpacku_float_lo_v4si): Ditto. - (vec_unpacku_float_hi_v4si): Ditto. (vec_unpacks_float_lo_v4si): Ditto. + (vec_unpacku_float_hi_v4si): Ditto. + (vec_unpacku_float_lo_v4si): Ditto. (movmisalign): Ditto. (vector_ceil2): New patterns for vectorizing math library. (vector_floor2): Ditto. diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 43ec67a9c10..7c60f015e83 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -64,6 +64,10 @@ (define_mode_iterator SSEMODE4S [V4SF V4SI]) (define_mode_iterator SSEMODE2D [V2DF V2DI]) +;; Modes handled by integer vcond pattern +(define_mode_iterator SSEMODE124C8 [V16QI V8HI V4SI + (V2DI "TARGET_SSE4_2 || TARGET_SSE5")]) + ;; Mapping from float mode to required SSE level (define_mode_attr sse [(SF "sse") (DF "sse2") (V4SF "sse") (V2DF "sse2")]) @@ -1520,10 +1524,9 @@ (match_operand:SSEMODEF2P 2 "general_operand" "")))] "SSE_VEC_FLOAT_MODE_P (mode)" { - if (ix86_expand_fp_vcond (operands)) - DONE; - else - FAIL; + bool ok = ix86_expand_fp_vcond (operands); + gcc_assert (ok); + DONE; }) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -6071,35 +6074,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 bb136c54de0..db94b62afef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-08-14 Uros Bizjak + + PR target/41019 + * gcc.target/i386/pr41019.c: New test. + 2009-08-13 Jerry DeLisle PR fortran/40955 @@ -77,13 +82,13 @@ 2009-08-10 Manuel López-Ibáñez - * gcc.dg/dg.exp: Test also c-c++-common dir. - * g++.dg/dg.exp: Likewise. - * g++.dg/warn/Wconversion-real.C: Delete. - * gcc.dg/Wconversion-real.c: Move to ... - * c-c++-common/Wconversion-real.c: ... here. - * lib/target-supports.exp - (check_effective_target_c,check_effective_target_c++): New. + * gcc.dg/dg.exp: Test also c-c++-common dir. + * g++.dg/dg.exp: Likewise. + * g++.dg/warn/Wconversion-real.C: Delete. + * gcc.dg/Wconversion-real.c: Move to ... + * c-c++-common/Wconversion-real.c: ... here. + * lib/target-supports.exp + (check_effective_target_c,check_effective_target_c++): New. 2009-08-10 Daniel Kraft diff --git a/gcc/testsuite/gcc.target/i386/pr41019.c b/gcc/testsuite/gcc.target/i386/pr41019.c new file mode 100644 index 00000000000..c0021c6a450 --- /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 (); +}