Home | History | Annotate | Download | only in x86
      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     sarl    $$4, %eax                       # eax <- B
     10     GET_VREG %eax, %eax                     # eax <- vB
     11     movswl  2(rPC), %ecx                    # ecx <- ssssCCCC
     12     andb    $$0xf, rINSTbl                  # rINST <- A
     13     testl   %ecx, %ecx
     14     je      common_errDivideByZero
     15     cmpl    $$-1, %ecx
     16     jne     .L${opcode}_continue_div
     17     cmpl    $$0x80000000, %eax
     18     jne     .L${opcode}_continue_div
     19     movl    $special, %eax
     20     SET_VREG %eax, rINST
     21     ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
     22 
     23 .L${opcode}_continue_div:
     24     mov     rIBASE, LOCAL0(%esp)
     25     cltd
     26     idivl   %ecx
     27     SET_VREG $result, rINST
     28     mov     LOCAL0(%esp), rIBASE
     29     ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
     30