aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/nios2/bmx.c
blob: 9daa60635726455c52877dd2db5c5967deadd6ac (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
/* { dg-do compile } */
/* { dg-options "-O2 -march=r2 -mbmx" } */

/* Test generation of Nios II R2 BMX instructions.  */

struct s {
  unsigned int pad1 : 3;
  unsigned int bitfield : 20;
  unsigned int intfield;
};

void f (struct s *a, struct s *b)
{
  a->bitfield = b->bitfield;
}

void g (struct s *a, struct s *b)
{
  a->bitfield = b->intfield;
}

void h (struct s *a, struct s *b)
{
  a->intfield = b->bitfield;
}

/* { dg-final { scan-assembler "\tmerge\t.*, 22, 3" } }  */
/* { dg-final { scan-assembler "\tinsert\t.*, 22, 3" } }  */
/* { dg-final { scan-assembler "\textract\t.*, 22, 3" } }  */