blob: ee7c523b0a1d1dff7e8453521256e12e50e8a3b0 [file] [log] [blame]
Bill Buzbee7c58bd42016-01-20 20:46:01 +00001%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/2addr vA, vB */
7 movzx rINSTbl, %ecx # eax <- BA
8 mov rIBASE, LOCAL0(%esp)
9 sarl $$4, %ecx # ecx <- B
10 GET_VREG %ecx %ecx # eax <- vBB
11 andb $$0xf, rINSTbl # rINST <- A
12 GET_VREG %eax rINST # eax <- vBB
13 testl %ecx, %ecx
14 je common_errDivideByZero
15 cmpl $$-1, %ecx
16 jne .L${opcode}_continue_div2addr
17 cmpl $$0x80000000, %eax
18 jne .L${opcode}_continue_div2addr
19 movl $special, $result
20 SET_VREG $result rINST
21 mov LOCAL0(%esp), rIBASE
22 ADVANCE_PC_FETCH_AND_GOTO_NEXT 1
23
24.L${opcode}_continue_div2addr:
25 cltd
26 idivl %ecx
27 SET_VREG $result rINST
28 mov LOCAL0(%esp), rIBASE
29 ADVANCE_PC_FETCH_AND_GOTO_NEXT 1