]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/49621 (ICE in trunc_int_for_mode, at explow.c:57)
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Jul 2011 13:09:48 +0000 (15:09 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Jul 2011 13:09:48 +0000 (15:09 +0200)
Backport from mainline
2011-07-08  Jakub Jelinek  <jakub@redhat.com>

PR target/49621
* config/rs6000/rs6000.c (rs6000_emit_vector_cond_expr): Use
CONST0_RTX (dest_mode) instead of const0_rtx as second operand
of NE.
* config/rs6000/vector.md (vector_select_<mode>,
vector_select_<mode>_uns): Change second operand of NE to
CONST0_RTX (<MODE>mode) instead of const0_rtx.
* config/rs6000/altivec.md (*altivec_vsel<mode>,
*altivec_vsel<mode>_uns): Expect second operand of NE to be
zero_constant of the corresponding vector mode.
* config/rs6000/vsx.md (*vsx_xxsel<mode>, *vsx_xxsel<mode>_uns):
Likewise.

* gcc.target/powerpc/altivec-34.c: New test.

From-SVN: r176458

gcc/ChangeLog
gcc/config/rs6000/altivec.md
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/vector.md
gcc/config/rs6000/vsx.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/altivec-34.c [new file with mode: 0644]

index 13ce2dee8dc53d04f3a54d4aef3b4633c0ab4ad3..4cce9b5bcfb43c2043a52e83a2fccf837f55598b 100644 (file)
@@ -1,6 +1,21 @@
 2011-07-19  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2011-07-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/49621
+       * config/rs6000/rs6000.c (rs6000_emit_vector_cond_expr): Use
+       CONST0_RTX (dest_mode) instead of const0_rtx as second operand
+       of NE.
+       * config/rs6000/vector.md (vector_select_<mode>,
+       vector_select_<mode>_uns): Change second operand of NE to
+       CONST0_RTX (<MODE>mode) instead of const0_rtx.
+       * config/rs6000/altivec.md (*altivec_vsel<mode>,
+       *altivec_vsel<mode>_uns): Expect second operand of NE to be
+       zero_constant of the corresponding vector mode.
+       * config/rs6000/vsx.md (*vsx_xxsel<mode>, *vsx_xxsel<mode>_uns):
+       Likewise.
+
        2011-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/49644
index 0745b3a2f56414e74b9af2e80165c08025a8d084..d4967fb6ca852226da6018d88339fc2b2fa2235d 100644 (file)
   [(set (match_operand:VM 0 "altivec_register_operand" "=v")
        (if_then_else:VM
         (ne:CC (match_operand:VM 1 "altivec_register_operand" "v")
-               (const_int 0))
+               (match_operand:VM 4 "zero_constant" ""))
         (match_operand:VM 2 "altivec_register_operand" "v")
         (match_operand:VM 3 "altivec_register_operand" "v")))]
   "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
   [(set (match_operand:VM 0 "altivec_register_operand" "=v")
        (if_then_else:VM
         (ne:CCUNS (match_operand:VM 1 "altivec_register_operand" "v")
-                  (const_int 0))
+                  (match_operand:VM 4 "zero_constant" ""))
         (match_operand:VM 2 "altivec_register_operand" "v")
         (match_operand:VM 3 "altivec_register_operand" "v")))]
   "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
index 0582dba7c72b84ce4d5d5b50ac01b15a7ee476d4..27956c52eb787eb6f56ac411bdcc1f7027083a32 100644 (file)
@@ -16007,7 +16007,7 @@ 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);
+  cond2 = gen_rtx_fmt_ee (NE, cc_mode, mask, CONST0_RTX (dest_mode));
   emit_insn (gen_rtx_SET (VOIDmode,
                          dest,
                          gen_rtx_IF_THEN_ELSE (dest_mode,
index 5e462b915bfc7ca5428f5b35a92123f4f9416a5b..73d2ae0f77eff9f2a33115d7a1c7ee12c863a457 100644 (file)
   [(set (match_operand:VEC_L 0 "vlogical_operand" "")
        (if_then_else:VEC_L
         (ne:CC (match_operand:VEC_L 3 "vlogical_operand" "")
-               (const_int 0))
+               (match_dup 4))
         (match_operand:VEC_L 2 "vlogical_operand" "")
         (match_operand:VEC_L 1 "vlogical_operand" "")))]
   "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
-  "")
+  "operands[4] = CONST0_RTX (<MODE>mode);")
 
 (define_expand "vector_select_<mode>_uns"
   [(set (match_operand:VEC_L 0 "vlogical_operand" "")
        (if_then_else:VEC_L
         (ne:CCUNS (match_operand:VEC_L 3 "vlogical_operand" "")
-                  (const_int 0))
+                  (match_dup 4))
         (match_operand:VEC_L 2 "vlogical_operand" "")
         (match_operand:VEC_L 1 "vlogical_operand" "")))]
   "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
-  "")
+  "operands[4] = CONST0_RTX (<MODE>mode);")
 
 ;; Expansions that compare vectors producing a vector result and a predicate,
 ;; setting CR6 to indicate a combined status
index 91052a8a235813f41a561289c776e19c8349e735..827f0343bcb59d8b7ce6077331dfa5c690894121 100644 (file)
   [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
        (if_then_else:VSX_L
         (ne:CC (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,wa")
-               (const_int 0))
+               (match_operand:VSX_L 4 "zero_constant" ""))
         (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,wa")
         (match_operand:VSX_L 3 "vsx_register_operand" "<VSr>,wa")))]
   "VECTOR_MEM_VSX_P (<MODE>mode)"
   [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
        (if_then_else:VSX_L
         (ne:CCUNS (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,wa")
-                  (const_int 0))
+                  (match_operand:VSX_L 4 "zero_constant" ""))
         (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,wa")
         (match_operand:VSX_L 3 "vsx_register_operand" "<VSr>,wa")))]
   "VECTOR_MEM_VSX_P (<MODE>mode)"
index aa95f8a2fed0d1ed3fe97d29c8fd8090f09ae11e..b22da57f47266617c27b1340842d63da9908fa07 100644 (file)
@@ -1,6 +1,11 @@
 2011-07-19  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2011-07-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/49621
+       * gcc.target/powerpc/altivec-34.c: New test.
+
        2011-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/49644
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-34.c b/gcc/testsuite/gcc.target/powerpc/altivec-34.c
new file mode 100644 (file)
index 0000000..8e6372b
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR target/49621 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -maltivec" } */
+
+#include <altivec.h>
+
+int
+foo (void)
+{
+  vector unsigned a, b, c;
+  unsigned k = 1;
+
+  a = (vector unsigned) { 0, 0, 0, 1 };
+  b = c = (vector unsigned) { 0, 0, 0, 0 };
+
+  a = vec_add (a, vec_splats (k));
+  b = vec_add (b, a);
+  c = vec_sel (c, a, b);
+
+  if (vec_any_eq (b, c))
+    return 1;
+
+  return 0;
+}