summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/bics_4.c
blob: 8dda11350c74c8cb98a8446c7dded46a1a5fd07a (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
46
47
48
/* { dg-do run } */
/* { dg-options "-O2 --save-temps -fno-inline" } */
/* { dg-require-effective-target arm32 } */

extern void abort (void);

int
bics_si_test1 (int a, int b, int c)
{
  if ((a & b) == a)
    return a;
  else
    return c;
}

int
bics_si_test2 (int a, int b, int c)
{
  if ((a & b) == b)
    return b;
  else
    return c;
}

int
main ()
{
  int x;
  x = bics_si_test1 (0xf00d, 0xf11f, 0);
  if (x != 0xf00d)
    abort ();

  x = bics_si_test1 (0xf11f, 0xf00d, 0);
  if (x != 0)
    abort ();

  x = bics_si_test2 (0xf00d, 0xf11f, 0);
  if (x != 0)
    abort ();

  x = bics_si_test2 (0xf11f, 0xf00d, 0);
  if (x != 0xf00d)
    abort ();

  return 0;
}

/* { dg-final { scan-assembler-times "bics\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+" 2 } } */