| 1 |
/* { dg-options "-O2 --param=aarch64-ldp-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 LDP_TEST_ALIGNED(TYPE) \ |
| 9 |
TYPE ldp_aligned_##TYPE(char* ptr){ \ |
| 10 |
TYPE a_0, a_1; \ |
| 11 |
TYPE *arr = (TYPE*) ((uintptr_t)ptr & ~(2 * 8 * _Alignof(TYPE) - 1)); \ |
| 12 |
a_0 = arr[0]; \ |
| 13 |
a_1 = arr[1]; \ |
| 14 |
return a_0 + a_1; \ |
| 15 |
} |
| 16 |
|
| 17 |
LDP_TEST_ALIGNED(int32_t); |
| 18 |
LDP_TEST_ALIGNED(int64_t); |
| 19 |
LDP_TEST_ALIGNED(v4si); |
| 20 |
|
| 21 |
/* { dg-final { scan-assembler-times "ldp\tw\[0-9\]+, w\[0-9\]" 1 } } */ |
| 22 |
/* { dg-final { scan-assembler-times "ldp\tx\[0-9\]+, x\[0-9\]" 1 } } */ |
| 23 |
/* { dg-final { scan-assembler-times "ldp\tq\[0-9\]+, q\[0-9\]" 1 } } */ |
| 24 |
|