aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/aarch64/sbc.c
blob: e479910bc2cb58f3f7aa9dd23ebc51ae8800cb0f (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
/* { dg-do run } */
/* { dg-options "-O2 --save-temps" } */

extern void abort (void);

typedef unsigned int u32int;
typedef unsigned long long u64int;

u32int
test_si (u32int w1, u32int w2, u32int w3, u32int w4)
{
  u32int w0;
  /* { dg-final { scan-assembler "sbc\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+\n" } } */
  w0 = w1 - w2 - (w3 < w4);
  return w0;
}

u64int
test_di (u64int x1, u64int x2, u64int x3, u64int x4)
{
  u64int x0;
  /* { dg-final { scan-assembler "sbc\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+\n" } } */
  x0 = x1 - x2 - (x3 < x4);
  return x0;
}

int
main ()
{
  u32int x;
  u64int y;
  x = test_si (7, 8, 12, 15);
  if (x != -2)
    abort();
  y = test_di (0x987654321ll, 0x123456789ll, 0x345345345ll, 0x123123123ll);
  if (y != 0x8641fdb98ll)
    abort();
  return 0;
}

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