Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/stp_unaligned.c

raw
1 /* { dg-options "-O2 --param=aarch64-stp-policy=aligned -mcpu=generic" } */
2
3 #include <stdlib.h>
4 #include <stdint.h>
5
6 typedef int v4si __attribute__ ((vector_size (16)));
7
8 #define STP_TEST_UNALIGNED(TYPE) \
9 TYPE *stp_unaligned_##TYPE(char* ptr, TYPE x){ \
10 TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \
11 TYPE *a = arr+1; \
12 a[0] = x; \
13 a[1] = x; \
14 return a; \
15 }
16
17 #define STP_TEST_ADJUST_UNALIGNED(TYPE) \
18 TYPE *stp_unaligned_adjust_##TYPE(char* ptr, TYPE x){ \
19 TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \
20 TYPE *a = arr+1; \
21 a[100] = x; \
22 a[101] = x; \
23 a[102] = x; \
24 a[103] = x; \
25 return a; \
26 }
27
28 STP_TEST_UNALIGNED(int32_t);
29 STP_TEST_UNALIGNED(int64_t);
30 STP_TEST_UNALIGNED(v4si);
31 STP_TEST_ADJUST_UNALIGNED(int32_t);
32 STP_TEST_ADJUST_UNALIGNED(int64_t);
33
34 /* { dg-final { scan-assembler-times "stp\tw\[0-9\]+, w\[0-9\]" 0 } } */
35 /* { dg-final { scan-assembler-times "stp\tx\[0-9\]+, x\[0-9\]" 0 } } */
36 /* { dg-final { scan-assembler-times "stp\tq\[0-9\]+, q\[0-9\]" 0 } } */
37