5 #define BRASLCLOBBER "cc", "0","1","2","3","4","5","14", \
6 "f0","f1","f2","f3","f4","f5","f6","f7"
8 void if_eq(void) { printf("equal\n"); }
9 void if_ne(void) { printf("not equal\n"); }
10 void if_gt(void) { printf("greater than\n"); }
11 void if_le(void) { printf("less or equal\n"); }
12 void if_lt(void) { printf("less than\n"); }
13 void if_ge(void) { printf("greater or equal\n"); }
14 void if_taken(void) { printf("taken\n"); }
15 void if_not_taken(void) { printf("not taken\n"); }
28 void compare_never(int64_t value1
, int64_t value2
)
30 register int64_t val1
asm("r7") = value1
;
31 register int64_t val2
asm("r8") = value2
;
35 CGRJ(7,8,8,NEVER
) "\n\t"
36 "brasl 14,if_not_taken\n\t"
38 "brasl 14,if_taken\n\t"
40 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
44 void compare_always(int64_t value1
, int64_t value2
)
46 register int64_t val1
asm("r7") = value1
;
47 register int64_t val2
asm("r8") = value2
;
51 CGRJ(7,8,8,ALWAYS
) "\n\t"
52 "brasl 14,if_not_taken\n\t"
54 "brasl 14,if_taken\n\t"
56 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
60 void compare_le(int64_t value1
, int64_t value2
)
62 register int64_t val1
asm("r7") = value1
;
63 register int64_t val2
asm("r8") = value2
;
72 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
76 void compare_ge(int64_t value1
, int64_t value2
)
78 register int64_t val1
asm("r7") = value1
;
79 register int64_t val2
asm("r8") = value2
;
88 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
92 void compare_gt(int64_t value1
, int64_t value2
)
94 register int64_t val1
asm("r7") = value1
;
95 register int64_t val2
asm("r8") = value2
;
104 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
108 void compare_lt(int64_t value1
, int64_t value2
)
110 register int64_t val1
asm("r7") = value1
;
111 register int64_t val2
asm("r8") = value2
;
115 CGRJ(7,8,8,LT
) "\n\t"
120 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
124 void compare_eq(int64_t value1
, int64_t value2
)
126 register int64_t val1
asm("r7") = value1
;
127 register int64_t val2
asm("r8") = value2
;
131 CGRJ(7,8,8,EQ
) "\n\t"
136 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
140 void compare_ne(int64_t value1
, int64_t value2
)
142 register int64_t val1
asm("r7") = value1
;
143 register int64_t val2
asm("r8") = value2
;
147 CGRJ(7,8,8,NE
) "\n\t"
152 : : "d"(val1
), "d"(val2
) : BRASLCLOBBER
);
182 compare_never(-12, 42);
183 compare_never(42, 42);
184 compare_never(100, 42);
186 compare_always(-12, 42);
187 compare_always(42, 42);
188 compare_always(100, 42);