| 1 |
/* PR target/68617 |
| 2 |
Verify that unaligned_access is correctly with attribute target. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv6" } } */ |
| 5 |
/* { dg-require-effective-target arm_arch_v6_ok } */ |
| 6 |
/* { dg-options "-Os -mfloat-abi=softfp -mtp=soft" } */ |
| 7 |
/* { dg-add-options arm_arch_v6 } */ |
| 8 |
|
| 9 |
long __attribute__((target("thumb"))) |
| 10 |
foo (char *s, long size, int unsigned_p) |
| 11 |
{ |
| 12 |
long x; |
| 13 |
unsigned char *p = (unsigned char *) s; |
| 14 |
switch (size) |
| 15 |
{ |
| 16 |
case 4: |
| 17 |
x = ((long) p[3] << 24) | ((long) p[2] << 16) | (p[1] << 8) | p[0]; |
| 18 |
return x; |
| 19 |
} |
| 20 |
} |