1%default {"result":"","special":""}
2/*
3 * 32-bit div/rem "lit8" binary operation.  Handles special case of
4 * op0=minint & op1=-1
5 */
6    /* div/rem/lit8 vAA, vBB, #+CC */
7    movzbl  2(rPC), %eax                    # eax <- BB
8    movsbl  3(rPC), %ecx                    # ecx <- ssssssCC
9    GET_VREG  %eax, %eax                    # eax <- rBB
10    testl   %ecx, %ecx
11    je      common_errDivideByZero
12    cmpl    $$0x80000000, %eax
13    jne     .L${opcode}_continue_div
14    cmpl    $$-1, %ecx
15    jne     .L${opcode}_continue_div
16    movl    $special, %eax
17    SET_VREG %eax, rINST
18    ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
19
20.L${opcode}_continue_div:
21    mov     rIBASE, LOCAL0(%esp)
22    cltd
23    idivl   %ecx
24    SET_VREG $result, rINST
25    mov     LOCAL0(%esp), rIBASE
26    ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
27