1%default {"result":"","special":""}
2    /*
3     * 32-bit binary div/rem operation.  Handles special case of op0=minint and
4     * op1=-1.
5     */
6    /* div/rem/lit16 vA, vB, #+CCCC */
7    /* Need A in rINST, ssssCCCC in ecx, vB in eax */
8    movzbl   rINSTbl,%eax         # eax<- 000000BA
9    SPILL(rIBASE)
10    sarl     $$4,%eax             # eax<- B
11    GET_VREG_R %eax %eax          # eax<- vB
12    movswl   2(rPC),%ecx          # ecx<- ssssCCCC
13    andb     $$0xf,rINSTbl        # rINST<- A
14    cmpl     $$0,%ecx
15    je       common_errDivideByZero
16    cmpl     $$-1,%ecx
17    jne      .L${opcode}_continue_div
18    cmpl     $$0x80000000,%eax
19    jne      .L${opcode}_continue_div
20    movl     $special,$result
21    SET_VREG $result rINST
22    UNSPILL(rIBASE)
23    FETCH_INST_OPCODE 2 %ecx
24    ADVANCE_PC 2
25    GOTO_NEXT_R %ecx
26
27.L${opcode}_continue_div:
28    cltd
29    idivl   %ecx
30    SET_VREG $result rINST
31    UNSPILL(rIBASE)
32    FETCH_INST_OPCODE 2 %ecx
33    ADVANCE_PC 2
34    GOTO_NEXT_R %ecx
35