re PR target/41019 (Vector conditional move produces wrong code with -O3.)
authorUros Bizjak <uros@gcc.gnu.org>
Fri, 14 Aug 2009 10:31:09 +0000 (12:31 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 14 Aug 2009 10:31:09 +0000 (12:31 +0200)
PR target/41019
* config/i386/sse.md (SSEMODE124C8): New mode iterator.
(vcond<SSEMODEF2P:mode>): Assert that operation is supported by
ix86_expand_fp_vcond.
(vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
Assert that operation is supported by ix86_expand_int_vcond.
(vcondu<SSEMODE124C8:mode>): Ditto.

testsuite/ChangeLog:

PR target/41019
* gcc.target/i386/pr41019.c: New test.

From-SVN: r150738

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr41019.c [new file with mode: 0644]

index 6eb1889..e48cbcd 100644 (file)
@@ -1,3 +1,13 @@
+2009-08-14  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/41019
+       * config/i386/sse.md (SSEMODE124C8): New mode iterator.
+       (vcond<SSEMODEF2P:mode>): Assert that operation is supported by
+       ix86_expand_fp_vcond.
+       (vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
+       Assert that operation is supported by ix86_expand_int_vcond.
+       (vcondu<SSEMODE124C8:mode>): Ditto.
+
 2009-08-13  DJ Delorie  <dj@redhat.com>
 
        * config/i386/djgpp-stdint.h: New.
@@ -6,8 +16,7 @@
 2009-08-13  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * 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  <ghassan.shobaki@amd.com>
 
        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.
        * config/mips/mips-protos.h (and_operands_ok): Declare it.
        * config/mips/mips.md (move_type): Add ext_ins and logical.
        (type): Handle them.
-       (and<mode>3): Use and_reg_operand as the second operand's
-       predicate.
+       (and<mode>3): Use and_reg_operand as the second operand's predicate.
        (*and<mode>3): Add alternatives for lbu, lhu, lwu, <d>ext and
        shift_shift.  Remove commutative constraint modifier.
        (*and<mode>3_mips16): Add alternatives for lbu, lhu, lwu and
        (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<mode>): Ditto.
        (vector_ceil<mode>2): New patterns for vectorizing math library.
        (vector_floor<mode>2): Ditto.
index 43ec67a..7c60f01 100644 (file)
 (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")])
 
           (match_operand:SSEMODEF2P 2 "general_operand" "")))]
   "SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
 {
-  if (ix86_expand_fp_vcond (operands))
-    DONE;
-  else
-    FAIL;
+  bool ok = ix86_expand_fp_vcond (operands);
+  gcc_assert (ok);
+  DONE;
 })
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (set_attr "mode" "TI")])
 
 (define_expand "vcond<mode>"
-  [(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<mode>"
-  [(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;
 })
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index bb136c5..db94b62 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-14  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/41019
+       * gcc.target/i386/pr41019.c: New test.
+
 2009-08-13  Jerry DeLisle <jvdelisle@gcc.gnu.org>
 
        PR fortran/40955
 
 2009-08-10  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
-       * 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  <d@domob.eu>
 
diff --git a/gcc/testsuite/gcc.target/i386/pr41019.c b/gcc/testsuite/gcc.target/i386/pr41019.c
new file mode 100644 (file)
index 0000000..c0021c6
--- /dev/null
@@ -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 ();
+}