aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@marvell.com>2021-09-02 07:08:22 +0000
committerAndrew Pinski <apinski@marvell.com>2021-09-13 15:19:05 +0000
commit03312cbd54f337dfb25be356a1d1abc9925c6c03 (patch)
tree88711fbf822c544cb5629a2d343e6a672bd89e28 /gcc/testsuite
parent20f3c168205cc7b0a97ecd54ffc54bed7637be74 (diff)
downloadgcc-03312cbd54f337dfb25be356a1d1abc9925c6c03.zip
gcc-03312cbd54f337dfb25be356a1d1abc9925c6c03.tar.gz
gcc-03312cbd54f337dfb25be356a1d1abc9925c6c03.tar.bz2
[aarch64] Fix target/95969: __builtin_aarch64_im_lane_boundsi interferes with gimple
This patch adds simple folding of __builtin_aarch64_im_lane_boundsi where we are not going to error out. It fixes the problem by the removal of the function from the IR. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: PR target/95969 * config/aarch64/aarch64-builtins.c (aarch64_fold_builtin_lane_check): New function. (aarch64_general_fold_builtin): Handle AARCH64_SIMD_BUILTIN_LANE_CHECK. (aarch64_general_gimple_fold_builtin): Likewise. gcc/testsuite/ChangeLog: PR target/95969 * gcc.target/aarch64/lane-bound-1.c: New test. * gcc.target/aarch64/lane-bound-2.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.target/aarch64/lane-bound-1.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/lane-bound-2.c10
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/lane-bound-1.c b/gcc/testsuite/gcc.target/aarch64/lane-bound-1.c
new file mode 100644
index 0000000..bbbe679
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/lane-bound-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+#include <arm_neon.h>
+
+void
+f (float32x4_t **ptr)
+{
+ float32x4_t res = vsetq_lane_f32 (0.0f, **ptr, 0);
+ **ptr = res;
+}
+/* GCC should be able to remove the call to "__builtin_aarch64_im_lane_boundsi"
+ and optimize out the second load from *ptr. */
+/* { dg-final { scan-tree-dump-times "__builtin_aarch64_im_lane_boundsi" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " = \\\*ptr_" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/lane-bound-2.c b/gcc/testsuite/gcc.target/aarch64/lane-bound-2.c
new file mode 100644
index 0000000..923c946
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/lane-bound-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-original" } */
+void
+f (void)
+{
+ __builtin_aarch64_im_lane_boundsi (16, 4, 0);
+ __builtin_aarch64_im_lane_boundsi (8, 8, 0);
+}
+/* GCC should be able to optimize these out before gimplification. */
+/* { dg-final { scan-tree-dump-times "__builtin_aarch64_im_lane_boundsi" 0 "original" } } */