| 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_ALIGNED(TYPE) \ |
| 9 |
TYPE *stp_aligned_##TYPE(char* ptr, TYPE x){ \ |
| 10 |
TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ |
| 11 |
arr[0] = x; \ |
| 12 |
arr[1] = x; \ |
| 13 |
return arr; \ |
| 14 |
} |
| 15 |
|
| 16 |
#define STP_TEST_ADJUST_ALIGNED(TYPE) \ |
| 17 |
TYPE *stp_aligned_adjust_##TYPE(char* ptr, TYPE x){ \ |
| 18 |
TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ |
| 19 |
arr[100] = x; \ |
| 20 |
arr[101] = x; \ |
| 21 |
arr[102] = x; \ |
| 22 |
arr[103] = x; \ |
| 23 |
return arr; \ |
| 24 |
} |
| 25 |
|
| 26 |
STP_TEST_ALIGNED(int32_t); |
| 27 |
STP_TEST_ALIGNED(int64_t); |
| 28 |
STP_TEST_ALIGNED(v4si); |
| 29 |
STP_TEST_ADJUST_ALIGNED(int32_t); |
| 30 |
STP_TEST_ADJUST_ALIGNED(int64_t); |
| 31 |
|
| 32 |
/* { dg-final { scan-assembler-times "stp\tw\[0-9\]+, w\[0-9\]" 3 } } */ |
| 33 |
/* { dg-final { scan-assembler-times "stp\tx\[0-9\]+, x\[0-9\]" 3 } } */ |
| 34 |
/* { dg-final { scan-assembler-times "stp\tq\[0-9\]+, q\[0-9\]" 1 } } */ |
| 35 |
|