1 /* 2 * Generic two-operand compare-and-branch operation. Provide a "condition" 3 * fragment that specifies the comparison to perform, e.g. for 4 * "if-le" you would use "le". 5 * 6 * For: if-eq, if-ne, if-lt, if-ge, if-gt, if-le 7 */ 8 /* if-cmp vA, vB, +CCCC */ 9 .extern MterpProfileBranch 10 ext a2, rINST, 8, 4 # a2 <- A 11 ext a3, rINST, 12, 4 # a3 <- B 12 lh rINST, 2(rPC) # rINST <- offset (sign-extended CCCC) 13 GET_VREG a0, a2 # a0 <- vA 14 GET_VREG a1, a3 # a1 <- vB 15 b${condition}c a0, a1, 1f 16 li rINST, 2 # offset if branch not taken 171: 18#if MTERP_PROFILE_BRANCHES 19 EXPORT_PC 20 move a0, rSELF 21 daddu a1, rFP, OFF_FP_SHADOWFRAME 22 move a2, rINST 23 jal MterpProfileBranch # (self, shadow_frame, offset) 24 bnezc v0, MterpOnStackReplacement # Note: offset must be in rINST 25#endif 26 dlsa rPC, rINST, rPC, 1 # rPC <- rPC + offset * 2 27 lw ra, THREAD_FLAGS_OFFSET(rSELF) # Preload flags for MterpCheckSuspendAndContinue 28 move a0, rINST # a0 <- offset 29 FETCH_INST # load rINST 30 bltz a0, MterpCheckSuspendAndContinue # suspend check if backwards branch 31 GET_INST_OPCODE v0 # extract opcode from rINST 32 GOTO_OPCODE v0 # jump to next instruction 33