rs6000: Fix ICE for invalid constants in built-in functions
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
After my other patch, I decided to write a test case with an illegal
constant operand value to a built-in to see what the results would be.
Without my other patch, we fail to catch the illegal use and emit an
invalid rtl insn and hit an unrecognizable insn ICE. With my previous
patch, we correctly flag the use as invalid, but end up ICEing anyway,
because we don't return the correct return value (const0_rtx) to
signify we had an error.
rs6000: Fix ICE for invalid constants in built-in functions
For invalid constant operand values used in built-in functions, return
const0_rtx to signify an error occurred during expansion.
Bootstrapped and retested on powerlc64le-linux with no regressions.
Ok for trunk and backports after some trunk burn-in time?
Peter
gcc/
* config/rs6000/rs6000-builtin.cc (rs6000_expand_builtin): Return
const0_rtx when there is an error.
gcc/testsuite/
* gcc.target/powerpc/mma-builtin-error.c: New test.
Comments
On 1/13/25 3:59 PM, Peter Bergner wrote:
> rs6000: Fix ICE for invalid constants in built-in functions
>
> For invalid constant operand values used in built-in functions, return
> const0_rtx to signify an error occurred during expansion.
>
> Bootstrapped and retested on powerlc64le-linux with no regressions.
> Ok for trunk and backports after some trunk burn-in time?
Approved offline by Segher, so I pushed the commit.
I'll let it bake on trunk for a bit before backporting.
Peter
@@ -3459,7 +3459,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
error ("argument %d must be a literal between 0 and %d,"
" inclusive",
bifaddr->restr_opnd[i], p);
- return CONST0_RTX (mode[0]);
+ return const0_rtx;
}
break;
}
@@ -3476,7 +3476,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
" inclusive",
bifaddr->restr_opnd[i], bifaddr->restr_val1[i],
bifaddr->restr_val2[i]);
- return CONST0_RTX (mode[0]);
+ return const0_rtx;
}
break;
}
@@ -3493,7 +3493,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
"between %d and %d, inclusive",
bifaddr->restr_opnd[i], bifaddr->restr_val1[i],
bifaddr->restr_val2[i]);
- return CONST0_RTX (mode[0]);
+ return const0_rtx;
}
break;
}
@@ -3509,7 +3509,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
"literal %d",
bifaddr->restr_opnd[i], bifaddr->restr_val1[i],
bifaddr->restr_val2[i]);
- return CONST0_RTX (mode[0]);
+ return const0_rtx;
}
break;
}
new file mode 100644
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+typedef unsigned char vec_t __attribute__((vector_size(16)));
+
+void
+foo (__vector_quad *dst, vec_t vec0, vec_t vec1) /* { dg-error "argument 5 must be a literal between 0 and 15, inclusive" } */
+{
+ __builtin_mma_pmxvi8ger4 (dst, vec0, vec1, 15, 15, -1);
+}