1# mach: crisv32
2# output: bf\n0\n80\n20\n10\n8\n4\n2\n1\n40\nfade040\n3ade0040\nfade040\n42\n
3
4; Check flag settings.
5
6 .include "testutils.inc"
7 start
8 clear.d r3
9 setf pixnzvc	; Setting U(ser mode) would restrict tests of other flags.
10 move ccs,r3
11 dumpr3
12
13 clear.d r3
14 clearf puixnzvc
15 move ccs,r3
16 dumpr3
17
18 .macro testf BIT
19 clear.d r3
20 clearf puixnzvc
21 setf \BIT
22 move ccs,r3
23 dumpr3
24 .endm
25
26 testf p
27 testf i
28 testf x
29 testf n
30 testf z
31 testf v
32 testf c
33 testf u	; Can't test i-flag or clear u after this point.
34
35 .macro test_get_cc N Z V C
36 clearf znvc
37 move ((\N << 3)|(\Z << 2)|(\V << 1)|\C),ccs
38 test_cc \N \Z \V \C
39 setf znvc
40 move ((\N << 3)|(\Z << 2)|(\V << 1)|\C),ccs
41 test_cc \N \Z \V \C
42 move.d ((\N << 3)|(\Z << 2)|(\V << 1)|\C),r4
43 setf znvc
44 move r4,ccs
45 test_cc \N \Z \V \C
46 clearf znvc
47 move r4,ccs
48 test_cc \N \Z \V \C
49 .endm
50
51 test_get_cc 1 0 0 0
52 test_get_cc 0 1 0 0
53 test_get_cc 0 0 1 0
54 test_get_cc 0 0 0 1
55
56; Test that the U bit sticks.
57 move 0x0fade000,ccs
58 move ccs,r3
59 dumpr3
60
61; Check that the M and Q bits can't be set in user mode.
62 move 0xfade0000,ccs
63 move ccs,r3
64 dumpr3
65
66 move 0x0fade000,ccs
67 move ccs,r3
68 dumpr3
69
70 move.d 0x42,r3
71 dumpr3
72
73 quit
74