OSDN Git Service

* config/rs6000/vector.md (vcondv4sfv4si, vcondv4siv4sf,
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Nov 2011 12:22:17 +0000 (12:22 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Nov 2011 12:22:17 +0000 (12:22 +0000)
vconduv4sfv4si): New patterns.
* config/rs6000/rs6000.c (rs6000_emit_vector_cond_expr): Handle
different dest_mode from comparison mode.

* lib/target-supports.exp (check_effective_target_vect_cond_mixed):
Enable also for powerpc*-*-*.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181202 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/vector.md
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp

index e2d23ea..a418265 100644 (file)
@@ -1,3 +1,10 @@
+2011-11-09  Jakub Jelinek  <jakub@redhat.com>
+
+       * config/rs6000/vector.md (vcondv4sfv4si, vcondv4siv4sf,
+       vconduv4sfv4si): New patterns.
+       * config/rs6000/rs6000.c (rs6000_emit_vector_cond_expr): Handle
+       different dest_mode from comparison mode.
+
 2011-11-09  Richard Guenther  <rguenther@suse.de>
 
        * gimple-fold.c (canonicalize_constructor_val): Mark
index aa04fdd..89b79ab 100644 (file)
@@ -16775,6 +16775,7 @@ rs6000_emit_vector_cond_expr (rtx dest, rtx op_true, rtx op_false,
                              rtx cond, rtx cc_op0, rtx cc_op1)
 {
   enum machine_mode dest_mode = GET_MODE (dest);
+  enum machine_mode mask_mode = GET_MODE (cc_op0);
   enum rtx_code rcode = GET_CODE (cond);
   enum machine_mode cc_mode = CCmode;
   rtx mask;
@@ -16785,6 +16786,9 @@ rs6000_emit_vector_cond_expr (rtx dest, rtx op_true, rtx op_false,
   if (VECTOR_UNIT_NONE_P (dest_mode))
     return 0;
 
+  gcc_assert (GET_MODE_SIZE (dest_mode) == GET_MODE_SIZE (mask_mode)
+             && GET_MODE_NUNITS (dest_mode) == GET_MODE_NUNITS (mask_mode));
+
   switch (rcode)
     {
       /* Swap operands if we can, and fall back to doing the operation as
@@ -16815,7 +16819,7 @@ rs6000_emit_vector_cond_expr (rtx dest, rtx op_true, rtx op_false,
     }
 
   /* Get the vector mask for the given relational operations.  */
-  mask = rs6000_emit_vector_compare (rcode, cc_op0, cc_op1, dest_mode);
+  mask = rs6000_emit_vector_compare (rcode, cc_op0, cc_op1, mask_mode);
 
   if (!mask)
     return 0;
@@ -16827,7 +16831,8 @@ rs6000_emit_vector_cond_expr (rtx dest, rtx op_true, rtx op_false,
       op_false = tmp;
     }
 
-  cond2 = gen_rtx_fmt_ee (NE, cc_mode, mask, CONST0_RTX (dest_mode));
+  cond2 = gen_rtx_fmt_ee (NE, cc_mode, gen_lowpart (dest_mode, mask),
+                         CONST0_RTX (dest_mode));
   emit_insn (gen_rtx_SET (VOIDmode,
                          dest,
                          gen_rtx_IF_THEN_ELSE (dest_mode,
index 0179cd9..fc3f3e1 100644 (file)
     FAIL;
 }")
 
+(define_expand "vcondv4sfv4si"
+  [(set (match_operand:V4SF 0 "vfloat_operand" "")
+       (if_then_else:V4SF
+        (match_operator 3 "comparison_operator"
+                        [(match_operand:V4SI 4 "vint_operand" "")
+                         (match_operand:V4SI 5 "vint_operand" "")])
+        (match_operand:V4SF 1 "vfloat_operand" "")
+        (match_operand:V4SF 2 "vfloat_operand" "")))]
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)
+   && VECTOR_UNIT_ALTIVEC_P (V4SImode)"
+  "
+{
+  if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
+                                   operands[3], operands[4], operands[5]))
+    DONE;
+  else
+    FAIL;
+}")
+
+(define_expand "vcondv4siv4sf"
+  [(set (match_operand:V4SI 0 "vint_operand" "")
+       (if_then_else:V4SI
+        (match_operator 3 "comparison_operator"
+                        [(match_operand:V4SF 4 "vfloat_operand" "")
+                         (match_operand:V4SF 5 "vfloat_operand" "")])
+        (match_operand:V4SI 1 "vint_operand" "")
+        (match_operand:V4SI 2 "vint_operand" "")))]
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)
+   && VECTOR_UNIT_ALTIVEC_P (V4SImode)"
+  "
+{
+  if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
+                                   operands[3], operands[4], operands[5]))
+    DONE;
+  else
+    FAIL;
+}")
+
 (define_expand "vcondu<mode><mode>"
   [(set (match_operand:VEC_I 0 "vint_operand" "")
        (if_then_else:VEC_I
     FAIL;
 }")
 
+(define_expand "vconduv4sfv4si"
+  [(set (match_operand:V4SF 0 "vfloat_operand" "")
+       (if_then_else:V4SF
+        (match_operator 3 "comparison_operator"
+                        [(match_operand:V4SI 4 "vint_operand" "")
+                         (match_operand:V4SI 5 "vint_operand" "")])
+        (match_operand:V4SF 1 "vfloat_operand" "")
+        (match_operand:V4SF 2 "vfloat_operand" "")))]
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)
+   && VECTOR_UNIT_ALTIVEC_P (V4SImode)"
+  "
+{
+  if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
+                                   operands[3], operands[4], operands[5]))
+    DONE;
+  else
+    FAIL;
+}")
+
 (define_expand "vector_eq<mode>"
   [(set (match_operand:VEC_C 0 "vlogical_operand" "")
        (eq:VEC_C (match_operand:VEC_C 1 "vlogical_operand" "")
index c85c864..66a534b 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-09  Jakub Jelinek  <jakub@redhat.com>
+
+       * lib/target-supports.exp (check_effective_target_vect_cond_mixed):
+       Enable also for powerpc*-*-*.
+
 2011-11-09  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/50540
index 6e30233..61bae45 100644 (file)
@@ -3354,7 +3354,8 @@ proc check_effective_target_vect_cond_mixed { } {
     } else {
        set et_vect_cond_mixed_saved 0
        if { [istarget i?86-*-*]
-            || [istarget x86_64-*-*] } {
+            || [istarget x86_64-*-*]
+            || [istarget powerpc*-*-*] } {
           set et_vect_cond_mixed_saved 1
        }
     }