diff mbox

Fix PR 69282: ICE on 464.h264ref at -O3

Message ID CA+=Sn1nAg4zcynb44qDCOoPLS6t05rEA7mzuxFeG0q9bw-E_2Q@mail.gmail.com
State New
Headers show

Commit Message

Andrew Pinski Feb. 8, 2016, 6:22 a.m. UTC
Hi,
  The problem is that even though expand knows how to expand
VEC_COND<a, b, c> when there is no vcond_mask pattern,
expand_vec_cond_expr_p returns false.  So this patch allows
expand_vec_cond_expr_p to try the next part of the function if there
is no vcond_mask pattern.

OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* optabs-tree.c (expand_vec_cond_expr_p): Don't early return if
get_vcond_mask_icode returns false.

Testsuite/ChangeLog:
* gcc.c-torture/compile/20160205-1.c: New testcase.

Comments

Richard Biener Feb. 8, 2016, 9:21 a.m. UTC | #1
On Mon, Feb 8, 2016 at 7:22 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>   The problem is that even though expand knows how to expand
> VEC_COND<a, b, c> when there is no vcond_mask pattern,
> expand_vec_cond_expr_p returns false.  So this patch allows
> expand_vec_cond_expr_p to try the next part of the function if there
> is no vcond_mask pattern.
>
> OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Please combine the two ifs.

   if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type)
      && get_vcond_mask_icode (TYPE_MODE (value_type),
+                               TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing)
    return true;

Ok with that change.

Thanks,
Richard.

> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * optabs-tree.c (expand_vec_cond_expr_p): Don't early return if
> get_vcond_mask_icode returns false.
>
> Testsuite/ChangeLog:
> * gcc.c-torture/compile/20160205-1.c: New testcase.
diff mbox

Patch

Index: optabs-tree.c
===================================================================
--- optabs-tree.c	(revision 233202)
+++ optabs-tree.c	(working copy)
@@ -323,8 +323,11 @@  expand_vec_cond_expr_p (tree value_type,
   machine_mode value_mode = TYPE_MODE (value_type);
   machine_mode cmp_op_mode = TYPE_MODE (cmp_op_type);
   if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type))
-    return get_vcond_mask_icode (TYPE_MODE (value_type),
-				 TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing;
+    {
+      if (get_vcond_mask_icode (TYPE_MODE (value_type),
+				TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing)
+	return true;
+    }
   if (GET_MODE_SIZE (value_mode) != GET_MODE_SIZE (cmp_op_mode)
       || GET_MODE_NUNITS (value_mode) != GET_MODE_NUNITS (cmp_op_mode)
       || get_vcond_icode (TYPE_MODE (value_type), TYPE_MODE (cmp_op_type),
Index: testsuite/gcc.c-torture/compile/20160205-1.c
===================================================================
--- testsuite/gcc.c-torture/compile/20160205-1.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/20160205-1.c	(working copy)
@@ -0,0 +1,8 @@ 
+int a[32];
+int fn1(int d) {
+  int c = 1;
+  for (int b = 0; b < 32; b++)
+    if (a[b])
+      c = 0;
+  return c;
+}