Home | History | Annotate | Download | only in x86_64
      1 %default {"result":"","rem":"0"}
      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     movzbq  2(rPC), %rax                    # eax <- BB
      8     movsbl  3(rPC), %ecx                    # ecx <- ssssssCC
      9     GET_VREG  %eax, %rax                    # eax <- rBB
     10     testl   %ecx, %ecx
     11     je      common_errDivideByZero
     12     cmpl    $$-1, %ecx
     13     je      2f
     14     cdq                                     # rax <- sign-extended of eax
     15     idivl   %ecx
     16 1:
     17     SET_VREG $result, rINSTq                # vA <- result
     18     ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
     19 2:
     20     .if $rem
     21     xorl    $result, $result
     22     .else
     23     negl    $result
     24     .endif
     25     jmp     1b
     26