6 test(int32_t op1_init
, int32_t op2_init
, int32_t op3_init
, int expected_cc
)
8 register int32_t op1
asm("8") = op1_init
;
9 register int32_t op3
asm("9") = op3_init
;
11 int32_t op2
= op2_init
;
12 int cc
= 1 - expected_cc
;
14 printf("before op1 = %#x\n", op1
);
15 printf("before op2 = %#x\n", op2
);
16 printf("before op3 = %#x\n", op3
);
19 ".insn rsy,0xEB00000000f8, 8,9,%1\n\t"
22 : "=d" (cc
), "+Q" (op2
), "+d"(op1
), "+d"(op3
)
26 printf("after op1 = %#x\n", op1
);
27 printf("after op2 = %#x\n", op2
);
28 printf("after op3 = %#x\n", op3
);
29 printf("cc = %d\n", cc
);
31 if (cc
!= expected_cc
) {
32 printf("condition code is incorrect\n");
34 if (expected_cc
== 0 && op2
!= 0) {
35 printf("cc = 0, but result != 0\n");
37 if (expected_cc
== 1 && op2
>= 0) {
38 printf("cc = 1, but result >= 0\n");
40 if (expected_cc
== 2 && op2
<= 0) {
41 printf("cc = 2, but result <= 0\n");
43 /* the test for cc = 3 is left as an exercise for the reader. */
50 test(0x10000000, 0x10000000, 0x12345678, 2);
51 test(0x10000000, 0x20000000, 0x12345678, 2);
55 test(-1, 0x10000000, 0x12345678, 2);
56 test(0x10000000, 0x7fffffff, 1, 3);