6 /* don't use IPM to better test spechelpers */ \
7 asm volatile( "brc 8,1f\n\t" \
21 "0: /* nop */ brc 0,0\n\t" \
22 : "=Q" (__cc) : : "memory"); \
26 void check_cc(int value
, int cc
)
30 if (value
== 0) printf("expected 0 ");
31 if (value
== 1) printf("expected 1 ");
32 if (value
== 2) printf("expected 2 ");
33 if (value
== 3) printf("expected 3 ");
34 if (cc
== 0) printf("got 0");
35 if (cc
== 1) printf("got 1");
36 if (cc
== 2) printf("got 2");
37 if (cc
== 3) printf("got 3");
48 /* test #1: value is zero, all bits selected */
50 asm volatile( "tmll %[v],0xFFFF\n\t" : : [v
] "d"(v
) : "cc");
51 check_cc(0, get_cc());
53 /* test #2: value is all-ones, mask is zero */
55 asm volatile( "tmll %[v],0\n\t" : : [v
] "d"(v
) : "cc");
56 check_cc(0, get_cc());
58 /* test #3: selected bits are 0 */
60 asm volatile( "tmll %[v],0xf0\n\t" : : [v
] "d"(v
) : "cc");
61 check_cc(0, get_cc());
63 /* test #4: selected bits are all 1 */
65 asm volatile( "tmll %[v],0x70\n\t" : : [v
] "d"(v
) : "cc");
66 check_cc(3, get_cc());
68 /* test #5: selected bits are mixed, leftmost bit is 0 */
70 asm volatile( "tmll %[v],0x81\n\t" : : [v
] "d"(v
) : "cc");
71 check_cc(1, get_cc());
73 /* test #6: selected bits are mixed, leftmost bit is 1 */
75 asm volatile( "tmll %[v],0x81\n\t" : : [v
] "d"(v
) : "cc");
76 check_cc(2, get_cc());