aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/aarch64/bfxil_2.c
blob: 4e4d610c26cf61a2a2a774b85620a06c59d868af (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
/* { dg-do run { target aarch64*-*-* } } */
/* { dg-options "-O2 --save-temps -fno-inline" } */
/* { dg-require-effective-target aarch64_big_endian } */

extern void abort (void);

typedef struct bitfield
{
  unsigned short eight1: 8;
  unsigned short four: 4;
  unsigned short eight2: 8;
  unsigned short seven: 7;
  unsigned int sixteen: 16;
  unsigned short eight3: 8;
  unsigned short eight4: 8;
} bitfield;

bitfield
bfxil (bitfield a)
{
  /* { dg-final { scan-assembler "bfxil\tx\[0-9\]+, x\[0-9\]+, 40, 8" } } */
  a.eight4 = a.eight2;
  return a;
}

int
main (void)
{
  static bitfield a;
  bitfield b;

  a.eight4 = 9;
  a.eight2 = 57;
  b = bfxil (a);

  if (b.eight4 != a.eight2)
    abort ();

  return 0;
}

/* { dg-final { cleanup-saved-temps } } */