Commit | Line | Data |
---|---|---|
1f22b268 PC |
1 | .data 8 |
2 | ok: | |
3 | .c "ok\n" | |
4 | ||
5 | #define CMOVR(N, T, OP, I0, I1, V, R0, R1, R2) \ | |
6 | movi %R1 I0 \ | |
7 | movi %R2 I1 \ | |
8 | movi %R0 V \ | |
9 | OP##r##T %R0 %R1 %R2 \ | |
10 | beqi OP##T##N##r_##R0##R1##R2 %R0 V \ | |
11 | calli @abort \ | |
12 | OP##T##N##r_##R0##R1##R2: | |
13 | ||
14 | /* reg0 = reg1 op reg0 */ | |
15 | #define CMOVR1(N, T, OP, I0, I1, V, R0, R1, R2) \ | |
16 | movi %R0 I1 \ | |
17 | movi %R1 I0 \ | |
18 | movi %R2 V \ | |
19 | OP##r##T %R0 %R1 %R0 \ | |
20 | beqr OP##T##N##r_1##R0##R1##R2 %R0 %R2 \ | |
21 | calli @abort \ | |
22 | OP##T##N##r_1##R0##R1##R2: | |
23 | ||
24 | #define TEST_CMOV1(N, OP, I0, I1, V, R0, R1, R2) \ | |
25 | CMOVR(N, , OP, I0, I1, V, R0, R1, R2) \ | |
26 | CMOVR1(N, , OP, I0, I1, V, R0, R1, R2) \ | |
27 | ||
28 | #define TEST_CMOV(N, OP, I0, I1, V) \ | |
29 | TEST_CMOV1(N, OP, I0, I1, V, v0, v1, v2) \ | |
30 | TEST_CMOV1(N, OP, I0, I1, V, v0, v1, r0) \ | |
31 | TEST_CMOV1(N, OP, I0, I1, V, v0, v1, r1) \ | |
32 | TEST_CMOV1(N, OP, I0, I1, V, v0, v1, r2) \ | |
33 | TEST_CMOV1(N, OP, I0, I1, V, v1, v2, r1) \ | |
34 | TEST_CMOV1(N, OP, I0, I1, V, v1, v2, r2) \ | |
35 | TEST_CMOV1(N, OP, I0, I1, V, v2, r0, r1) \ | |
36 | TEST_CMOV1(N, OP, I0, I1, V, v2, r0, r2) \ | |
37 | TEST_CMOV1(N, OP, I0, I1, V, r0, r1, r2) | |
38 | ||
39 | #define MOVZR(N, I0, I1, V) TEST_CMOV(N, movz, I0, I1, V) | |
40 | #define MOVNR(N, I0, I1, V) TEST_CMOV(N, movn, I0, I1, V) | |
41 | ||
42 | .code | |
43 | prolog | |
44 | ||
45 | MOVZR(0, 0x0, 0x0, 0x0) | |
46 | MOVZR(1, 0xf7de, 0x0, 0xf7de) | |
47 | ||
48 | MOVZR(2, 0x0, 0xdead, 0xdead) | |
49 | MOVZR(3, 0xf7de, 0xdead, 0xdead) | |
50 | ||
51 | MOVNR(0, 0x0, 0x0, 0x0) | |
52 | MOVNR(1, 0xf7de, 0x0, 0x0) | |
53 | ||
54 | MOVNR(2, 0x0, 0xdead, 0x0) | |
55 | MOVNR(3, 0xf7de, 0xdead, 0xf7de) | |
56 | ||
57 | prepare | |
58 | pushargi ok | |
59 | ellipsis | |
60 | finishi @printf | |
61 | ret | |
62 | epilog |