]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/41019 (Vector conditional move produces wrong code with -O3.)
authorUros Bizjak <uros@gcc.gnu.org>
Sun, 16 Aug 2009 21:05:47 +0000 (23:05 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Sun, 16 Aug 2009 21:05:47 +0000 (23:05 +0200)
Backport from mainline:
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.

testsuite/ChangeLog:

Backport from mainline:
2009-08-14  Uros Bizjak  <ubizjak@gmail.com>

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

From-SVN: r150816

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

index c775deb2af5bd14befb787e8bda08a3c948e7735..eb8c7d0179211b0857b490b589747b0128a9eef9 100644 (file)
@@ -1,3 +1,16 @@
+2009-08-16  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline:
+       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-14  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline:
@@ -12,7 +25,7 @@
 2009-08-13  Andrey Belevantsev  <abel@ispras.ru>
 
        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  <ubizjak@gmail.com>
 2009-06-30  Ira Rosen  <irar@il.ibm.com>
 
        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  <rguenther@suse.de>
        arg1.
 
        2009-02-03  Jakub Jelinek  <jakub@redhat.com>
+
        PR target/35318
        * function.c (match_asm_constraints_1): Skip over
        initial optional % in the constraint.
+
 2009-06-19  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline:
        * 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  <ebotcazou@adacore.com>
 
        PR rtl-optimization/39588
 
        Backport from mainline:
        2008-12-02  Martin Jambor  <mjambor@suse.cz>
-       
+
        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.
 
        PR rtl-optimization/39076
        Backport from mainline:
        2008-06-28  Andrew Jenner  <andrew@codesourcery.com>
-       
+
        * regrename.c (build_def_use): Don't copy RTX.
 
 2009-02-04  Joseph Myers  <joseph@codesourcery.com>
 
        * sched-deps.c (sched_analyze_2)[UNSPEC_VOLATILE]: Flush pending
        memory loads and stores.
-       
+
 2009-01-11  Matthias Klose  <doko@ubuntu.com>
 
        PR middle-end/38616
 2008-10-17  Andrew MacLeod  <amacleod@redhat.com>
 
        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.
 
        * 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  <jason@redhat.com>
 
index 51aeaf2619a82c2f7b66283dcfdcb0c3abbdd296..cf28bdf86abb8e0f1aeaa2ceee933c0c33ff5b94 100644 (file)
 (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")])
 
           (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;
 })
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (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 cf67bbaa45348380beec824719dbcd4ec9f2c8d6..f5dc05aa58ac0a848f2a87bb7989411509d4833c 100644 (file)
@@ -1,3 +1,11 @@
+2009-08-16  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline:
+       2009-08-14  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/41019
+       * gcc.target/i386/pr41019.c: New test.
+
 2009-08-16  Paul Thomas  <pault@gcc.gnu.org>
 
        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 (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 ();
+}