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 movzx rINST_HI,%ecx # ecx <- A+ 12 andb $$0xf,%cl # ecx <- A 13 GET_VREG(%eax,%ecx) # eax <- vA 14 sarl $$12,rINST_FULL # rINST_FULL<- B 15 cmpl (rFP,rINST_FULL,4),%eax # compare (vA, vB) 16 movswl 2(rPC),rINST_FULL # Get signed branch offset 17 movl $$2,%eax # assume not taken 18 j${revcmp} 1f 19 testl rINST_FULL,rINST_FULL 20 js common_backwardBranch 21 movl rINST_FULL,%eax 22 1: 23 FETCH_INST_INDEXED(%eax) 24 ADVANCE_PC_INDEXED(%eax) 25 GOTO_NEXT 26 GOTO_NEXT 27