diff mbox series

[pushed] aarch64: Add a test for zeroing <64bits>x2_t structures

Message ID mpto75ck61c.fsf@arm.com
State New
Headers show
Series [pushed] aarch64: Add a test for zeroing <64bits>x2_t structures | expand

Commit Message

Richard Sandiford Aug. 28, 2024, 3:42 p.m. UTC
g:8d6c6fbc5271dde433998c09407b30e2cf195420 improved the code
generated for functions like:

  void test_s8 (int8x8x2_t *ptr) { *ptr = (int8x8x2_t) {}; }

Previously we would load zero from the constant pool, whereas
now we just use "stp xzr, xzr".  This patch adds a test for
this improvement.

Tested on aarch64-linux-gnu & pushed.

Richard


gcc/testsuite/
	* gcc.target/aarch64/struct_zero.c: New test.
---
 .../gcc.target/aarch64/struct_zero.c          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/struct_zero.c
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/aarch64/struct_zero.c b/gcc/testsuite/gcc.target/aarch64/struct_zero.c
new file mode 100644
index 00000000000..13f7236a4d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/struct_zero.c
@@ -0,0 +1,21 @@ 
+/* { dg-options "-O2" } */
+
+#include <arm_neon.h>
+
+void test_s8 (int8x8x2_t *ptr) { *ptr = (int8x8x2_t) {}; }
+void test_u8 (uint8x8x2_t *ptr) { *ptr = (uint8x8x2_t) {}; }
+void test_p8 (poly8x8x2_t *ptr) { *ptr = (poly8x8x2_t) {}; }
+void test_s16 (int16x4x2_t *ptr) { *ptr = (int16x4x2_t) {}; }
+void test_u16 (uint16x4x2_t *ptr) { *ptr = (uint16x4x2_t) {}; }
+void test_p16 (poly16x4x2_t *ptr) { *ptr = (poly16x4x2_t) {}; }
+void test_bf16 (bfloat16x4x2_t *ptr) { *ptr = (bfloat16x4x2_t) {}; }
+void test_f16 (float16x4x2_t *ptr) { *ptr = (float16x4x2_t) {}; }
+void test_s32 (int32x2x2_t *ptr) { *ptr = (int32x2x2_t) {}; }
+void test_u32 (uint32x2x2_t *ptr) { *ptr = (uint32x2x2_t) {}; }
+void test_f32 (float32x2x2_t *ptr) { *ptr = (float32x2x2_t) {}; }
+void test_s64 (int64x1x2_t *ptr) { *ptr = (int64x1x2_t) {}; }
+void test_u64 (uint64x1x2_t *ptr) { *ptr = (uint64x1x2_t) {}; }
+void test_p64 (poly64x1x2_t *ptr) { *ptr = (poly64x1x2_t) {}; }
+void test_f64 (float64x1x2_t *ptr) { *ptr = (float64x1x2_t) {}; }
+
+/* { dg-final { scan-assembler-times {\tstp\txzr, xzr, \[x0\]\n} 15 } } */