summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips/unaligned-1.c
blob: 4888ca8b51f7d6fc5d5187b09c795c88e915429c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* { dg-options "isa_rev<=5 -mgp64" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler-times "\tsdl\t" 1 } } */
/* { dg-final { scan-assembler-times "\tsdr\t" 1 } } */
/* { dg-final { scan-assembler-times "\tldl\t" 1 } } */
/* { dg-final { scan-assembler-times "\tldr\t" 1 } } */
/* { dg-final { scan-assembler-times "\tswl\t" 1 } } */
/* { dg-final { scan-assembler-times "\tswr\t" 1 } } */
/* { dg-final { scan-assembler-times "\tlwl\t" 1 } } */
/* { dg-final { scan-assembler-times "\tlwr\t" 1 } } */
/* { dg-final { scan-assembler-not "\tnop" } } */

/* Test to make sure we produce the unaligned load/store for
   both 64bit and 32bits sized accesses.  */

struct s
{
  char c;
  int i;
  long long l;
} __attribute__ ((packed)) s __attribute__((aligned(1) ));

NOMIPS16 void
sd (long long l)
{
  s.l = l;
}

NOMIPS16 long long
ld ()
{
  return s.l;
}

NOMIPS16 void
sw (int i)
{
  s.i = i;
}

NOMIPS16 int
lw ()
{
  return s.i;
}