xref: /netbsd-src/external/gpl3/gdb/dist/sim/testsuite/aarch64/adds.s (revision 4b004442778f1201b2161e87fd65ba87aae6601a)
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# Also check -2 and 1 (not C).
7# For sub, negate the second value.
8
9.include "testutils.inc"
10
11	start
12	mov w0, #1
13	mov w1, #-1
14	adds w2, w0, w1
15	bne .Lfailure
16	mov w0, #-1
17	mov w1, #-1
18	adds w2, w0, w1
19	bpl .Lfailure
20	mov w0, #2
21	mov w1, #-1
22	adds w2, w0, w1
23	bcc .Lfailure
24	mov w0, #0x80000000
25	mov w1, #-1
26	adds w2, w0, w1
27	bvc .Lfailure
28	mov w0, #-2
29	mov w1, #1
30	adds w2, w0, w1
31	bcs .Lfailure
32
33	mov x0, #1
34	mov x1, #-1
35	adds x2, x0, x1
36	bne .Lfailure
37	mov x0, #-1
38	mov x1, #-1
39	adds x2, x0, x1
40	bpl .Lfailure
41	mov x0, #2
42	mov x1, #-1
43	adds x2, x0, x1
44	bcc .Lfailure
45	mov x0, #0x8000000000000000
46	mov x1, #-1
47	adds x2, x0, x1
48	bvc .Lfailure
49	mov x0, #-2
50	mov x1, #1
51	adds x2, x0, x1
52	bcs .Lfailure
53
54	mov w0, #1
55	mov w1, #1
56	subs w2, w0, w1
57	bne .Lfailure
58	mov w0, #-1
59	mov w1, #1
60	subs w2, w0, w1
61	bpl .Lfailure
62	mov w0, #2
63	mov w1, #1
64	subs w2, w0, w1
65	bcc .Lfailure
66	mov w0, #0x80000000
67	mov w1, #1
68	subs w2, w0, w1
69	bvc .Lfailure
70	mov w0, #-2
71	mov w1, #-1
72	subs w2, w0, w1
73	bcs .Lfailure
74
75	mov x0, #1
76	mov x1, #1
77	subs x2, x0, x1
78	bne .Lfailure
79	mov x0, #-1
80	mov x1, #1
81	subs x2, x0, x1
82	bpl .Lfailure
83	mov x0, #2
84	mov x1, #1
85	subs x2, x0, x1
86	bcc .Lfailure
87	mov x0, #0x8000000000000000
88	mov x1, #1
89	subs x2, x0, x1
90	bvc .Lfailure
91	mov x0, #-2
92	mov x1, #-1
93	subs x2, x0, x1
94	bcs .Lfailure
95
96	pass
97.Lfailure:
98	fail
99