summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/attr-unaligned-load-ice.c
blob: e1ed1c148e007c152275996568892d86320bb18b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* PR target/68617
   Verify that unaligned_access is correctly with attribute target.  */
/* { dg-do compile } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv6" } } */
/* { dg-options "-Os -mfloat-abi=softfp -mtp=soft" } */
/* { dg-add-options arm_arch_v6 } */

long __attribute__((target("thumb")))
foo (char *s, long size, int unsigned_p)
{
  long x;
  unsigned char *p = (unsigned char *) s;
  switch (size)
    {
    case 4:
      x = ((long) p[3] << 24) | ((long) p[2] << 16) | (p[1] << 8) | p[0];
      return x;
    }
}