Fix aarch64 sim bug with adds64, and add testcases for last 3 bug fixes.
[external/binutils.git] / sim / testsuite / sim / aarch64 / adds.s
1 # mach: aarch64
2
3 # Check the basic integer compare instructions: adds, adds64, subs, subs64.
4 # For add, check value pairs 1 and -1 (Z), -1 and -1 (N), 2 and -1 (C),
5 # and MIN_INT and -1 (V), 
6 # For sub, negate the second value.
7
8 .include "testutils.inc"
9
10         start
11         mov w0, #1
12         mov w1, #-1
13         adds w2, w0, w1
14         bne .Lfailure
15         mov w0, #-1
16         mov w1, #-1
17         adds w2, w0, w1
18         bpl .Lfailure
19         mov w0, #2
20         mov w1, #-1
21         adds w2, w0, w1
22         bcc .Lfailure
23         mov w0, #0x80000000
24         mov w1, #-1
25         adds w2, w0, w1
26         bvc .Lfailure
27
28         mov x0, #1
29         mov x1, #-1
30         adds x2, x0, x1
31         bne .Lfailure
32         mov x0, #-1
33         mov x1, #-1
34         adds x2, x0, x1
35         bpl .Lfailure
36         mov x0, #2
37         mov x1, #-1
38         adds x2, x0, x1
39         bcc .Lfailure
40         mov x0, #0x8000000000000000
41         mov x1, #-1
42         adds x2, x0, x1
43         bvc .Lfailure
44
45         mov w0, #1
46         mov w1, #1
47         subs w2, w0, w1
48         bne .Lfailure
49         mov w0, #-1
50         mov w1, #1
51         subs w2, w0, w1
52         bpl .Lfailure
53         mov w0, #2
54         mov w1, #1
55         subs w2, w0, w1
56         bcc .Lfailure
57         mov w0, #0x80000000
58         mov w1, #1
59         subs w2, w0, w1
60         bvc .Lfailure
61
62         mov x0, #1
63         mov x1, #1
64         subs x2, x0, x1
65         bne .Lfailure
66         mov x0, #-1
67         mov x1, #1
68         subs x2, x0, x1
69         bpl .Lfailure
70         mov x0, #2
71         mov x1, #1
72         subs x2, x0, x1
73         bcc .Lfailure
74         mov x0, #0x8000000000000000
75         mov x1, #1
76         subs x2, x0, x1
77         bvc .Lfailure
78
79         pass
80 .Lfailure:
81         fail