xref: /netbsd-src/external/gpl3/gdb/dist/sim/testsuite/v850/satsubi.cgs (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
1# v850 satsubi
2# mach: all
3
4	.include "testutils.inc"
5
6# If the result of the add is "negative", that means we went too
7# positive.  The result should be the most positive number.
8
9	noflags
10	seti	0x7ffffffe, r1
11	satsubi	-10, r1, r2
12
13	flags	sat + c + v + ns + nz
14	reg	r2, 0x7fffffff
15
16# Similarly, if the result of the add is "positive", that means we
17# went too negative.  The result should be the most negative number.
18
19	noflags
20	seti	0x80000001, r1
21	satsubi	10, r1, r2
22
23	flags	sat + nc + v + s + nz
24	reg	r2, 0x80000000
25
26# Check that the SAT flag remains set until reset
27
28	seti	2, r1
29	satsubi	1, r1, r2
30
31	flags	sat + nc + nv + ns + nz
32	reg	r2, 1
33
34	noflags
35	seti	2, r1
36	satsubi	1, r1, r2
37
38	flags	nsat + nc + nv + ns + nz
39	reg	r2, 1
40
41# Check that results exactly equal to min/max don't saturate
42
43	noflags
44	seti	0x7ffffffe, r1
45	satsubi	-1, r1, r2
46
47	flags	nsat + c + nv + ns + nz
48	reg	r2, 0x7fffffff
49
50
51	noflags
52	seti	0x80000001, r1
53	satsubi	1, r1, r2
54
55	flags	nsat + nc + nv + s + nz
56	reg	r2, 0x80000000
57
58
59	pass
60