| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -save-temps" } */ |
| 3 |
|
| 4 |
#include <string.h> |
| 5 |
|
| 6 |
char src[17] __attribute__ ((aligned(8))) = "abcdefghijklmnopq"; |
| 7 |
char result[17] __attribute__ ((aligned(8))) = {0}; |
| 8 |
|
| 9 |
void __attribute__ ((noinline,noclone)) |
| 10 |
unknown_alignment (char *dest, char *src) |
| 11 |
{ |
| 12 |
memcpy (dest, src, 15); |
| 13 |
} |
| 14 |
|
| 15 |
int main () |
| 16 |
{ |
| 17 |
int i; |
| 18 |
unknown_alignment (result+1, src+2); |
| 19 |
for (i = 0; i < 15; i++) |
| 20 |
if (result[i+1] != src[i+2]) |
| 21 |
__builtin_abort (); |
| 22 |
if (result[16] != 0) |
| 23 |
__builtin_abort (); |
| 24 |
return 0; |
| 25 |
} |
| 26 |
|
| 27 |
/* Check that we don't use any instructions that assume an aligned source. */ |
| 28 |
/* { dg-final { scan-assembler-not {(ldm(ia)?\tr[0-9]|ldrd\t.*\[r[0-9]|vldr)} } } */ |
| 29 |
|
| 30 |
/* Check that we don't use any instructions that assume an aligned dest. */ |
| 31 |
/* { dg-final { scan-assembler-not {(stm(ia)?\tr[0-9]|strd\t.*\[r[0-9]|vstr)} } } */ |