Fix assert in nvptx_propagate_unified
2017-06-30 Tom de Vries <tom@codesourcery.com>
* config/nvptx/nvptx.c (nvptx_propagate_unified): Fix gcc_assert
condition by allowing !INSN_P.
* testsuite/libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c: New test.
---
gcc/config/nvptx/nvptx.c | 2 +-
.../reduction-cplx-flt-2.c | 32 ++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
@@ -2300,7 +2300,7 @@ nvptx_propagate_unified (rtx_insn *unified)
&& GET_RTX_CLASS (GET_CODE (SET_SRC (pat))) == RTX_COMPARE
&& XEXP (SET_SRC (pat), 0) == cond_reg)
break;
- gcc_assert (NONJUMP_INSN_P (probe));
+ gcc_assert (NONJUMP_INSN_P (probe) || !INSN_P (probe));
}
rtx pred_reg = SET_DEST (pat);
new file mode 100644
@@ -0,0 +1,32 @@
+#include <complex.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef float _Complex Type;
+
+#define N 32
+
+int
+main (void)
+{
+ Type ary[N];
+
+ for (int ix = 0; ix < N; ix++)
+ ary[ix] = 1.0 + 1.0i;
+
+ Type tprod = 1.0;
+
+#pragma acc parallel vector_length(32)
+ {
+#pragma acc loop vector reduction (*:tprod)
+ for (int ix = 0; ix < N; ix++)
+ tprod *= ary[ix];
+ }
+
+ Type expected = 65536.0;
+
+ if (tprod != expected)
+ abort ();
+
+ return 0;
+}