1%verify "executed"
2%default {"routine":"__divdi3","special":"$0x80000000"}
3    /* div vAA, vBB, vCC */
4    movzbl    3(rPC),%eax              # eax<- CC
5    movzbl    2(rPC),%ecx              # ecx<- BB
6    SPILL(rPC)
7    GET_VREG_WORD(rPC,%eax,0)
8    GET_VREG_WORD(%eax,%eax,1)
9    movl     rPC,OUT_ARG2(%esp)
10    testl    %eax,%eax
11    je       .L${opcode}_check_zero
12    cmpl     $$-1,%eax
13    je       .L${opcode}_check_neg1
14.L${opcode}_notSpecial:
15    GET_VREG_WORD(rPC,%ecx,0)
16    GET_VREG_WORD(%ecx,%ecx,1)
17.L${opcode}_notSpecial1:
18    movl     %eax,OUT_ARG3(%esp)
19    movl     rPC,OUT_ARG0(%esp)
20    movl     %ecx,OUT_ARG1(%esp)
21    jmp      .L${opcode}_continue
22%break
23
24.L${opcode}_continue:
25    call     $routine
26.L${opcode}_finish:
27    movzbl   rINST_HI,%ecx
28    SET_VREG_WORD(rPC,%ecx,1)
29    UNSPILL(rPC)
30    SET_VREG_WORD(%eax,%ecx,0)
31    FETCH_INST_WORD(2)
32    ADVANCE_PC(2)
33    GOTO_NEXT
34
35.L${opcode}_check_zero:
36    testl   rPC,rPC
37    jne     .L${opcode}_notSpecial
38    UNSPILL(rPC)
39    jmp     common_errDivideByZero
40.L${opcode}_check_neg1:
41    testl   rPC,%eax
42    jne     .L${opcode}_notSpecial
43    GET_VREG_WORD(rPC,%ecx,0)
44    GET_VREG_WORD(%ecx,%ecx,1)
45    testl    rPC,rPC
46    jne      .L${opcode}_notSpecial1
47    cmpl     $$0x80000000,%ecx
48    jne      .L${opcode}_notSpecial1
49    /* minint / -1, return minint on div, 0 on rem */
50    xorl     %eax,%eax
51    movl     $special,%edx
52    jmp      .L${opcode}_finish
53
54
55
56