History

x86-64: fix udiv, add cqto instruction

grischka committed 16 years ago

Commit dd3d4f71 parent 1445fea2 files · +8 −1Browse files

Unified · Split

2 files
  1. x86_64-asm.h +1 −0
  2. x86_64-gen.c +7 −1
x86_64-asm.h+1−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
26 DEF_ASM_OP0(cwtl, 0x98)26 DEF_ASM_OP0(cwtl, 0x98)
27 DEF_ASM_OP0(cwtd, 0x6699)27 DEF_ASM_OP0(cwtd, 0x6699)
28 DEF_ASM_OP0(cltd, 0x99)28 DEF_ASM_OP0(cltd, 0x99)
29 DEF_ASM_OP0(cqto, 0x4899)
29 DEF_ASM_OP0(int3, 0xcc)30 DEF_ASM_OP0(int3, 0xcc)
30 DEF_ASM_OP0(into, 0xce)31 DEF_ASM_OP0(into, 0xce)
31 DEF_ASM_OP0(iret, 0xcf)32 DEF_ASM_OP0(iret, 0xcf)
x86_64-gen.c+7−1
@@ -1137,7 +1137,13 @@ void gen_opi(int op) · 1136 unmodified lines
1137 r = TREG_RAX;1137 r = TREG_RAX;
1138 } else {1138 } else {
1139 if (op == TOK_UDIV || op == TOK_UMOD) {1139 if (op == TOK_UDIV || op == TOK_UMOD) {
1140 o(0xf7d231); /* xor %edx, %edx, div fr, %eax */1140 if ((vtop->type.t & VT_BTYPE) & VT_LLONG) {
1141 o(0xd23148); /* xor %rdx, %rdx */
1142 o(0x48 + REX_BASE(fr));
1143 } else {
1144 o(0xd231); /* xor %edx, %edx */
1145 }
1146 o(0xf7); /* div fr, %eax */
1141 o(0xf0 + fr);1147 o(0xf0 + fr);
1142 } else {1148 } else {
1143 if ((vtop->type.t & VT_BTYPE) & VT_LLONG) {1149 if ((vtop->type.t & VT_BTYPE) & VT_LLONG) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t