1 %verify "branch taken" 2 %verify "branch not taken" 3 /* 4 * Generic two-operand compare-and-branch operation. Provide a "revcmp" 5 * fragment that specifies the *reverse* comparison to perform, e.g. 6 * for "if-le" you would use "gt". 7 * 8 * For: if-eq, if-ne, if-lt, if-ge, if-gt, if-le 9 */ 10 /* if-cmp vA, vB, +CCCC */ 11 GET_OPA4(a0) # a0 <- A+ 12 GET_OPB(a1) # a1 <- B 13 GET_VREG(a3, a1) # a3 <- vB 14 GET_VREG(a2, a0) # a2 <- vA 15 b${revcmp} a2, a3, 1f # branch to 1 if comparison failed 16 FETCH_S(a1, 1) # a1<- branch offset, in code units 17 b 2f 18 1: 19 li a1, 2 # a1- BYTE branch dist for not-taken 20 2: 21 addu a2, a1, a1 # convert to bytes 22 FETCH_ADVANCE_INST_RB(a2) # update rPC, load rINST 23 #if defined(WITH_JIT) 24 lw a0, offThread_pJitProfTable(rSELF) 25 bgez a2, 3f 26 lw rIBASE, offThread_curHandlerTable(rSELF) # refresh rIBASE 27 3: 28 bnez a0, common_updateProfile 29 #else 30 bgez a2, 4f 31 lw rIBASE, offThread_curHandlerTable(rSELF) # refresh rIBASE 32 4: 33 #endif 34 GET_INST_OPCODE(t0) # extract opcode from rINST 35 GOTO_OPCODE(t0) # jump to next instruction 36