|
@@ -61,7 +61,7 @@ implementation
|
|
ti8086moddivnode
|
|
ti8086moddivnode
|
|
*****************************************************************************}
|
|
*****************************************************************************}
|
|
|
|
|
|
- function log2(i : dword) : dword;
|
|
|
|
|
|
+ function log2(i : word) : word;
|
|
begin
|
|
begin
|
|
result:=0;
|
|
result:=0;
|
|
i:=i shr 1;
|
|
i:=i shr 1;
|
|
@@ -79,9 +79,9 @@ implementation
|
|
power:longint;
|
|
power:longint;
|
|
hl:Tasmlabel;
|
|
hl:Tasmlabel;
|
|
op:Tasmop;
|
|
op:Tasmop;
|
|
- e : longint;
|
|
|
|
- d,l,r,s,m,a,n,t : dword;
|
|
|
|
- m_low,m_high,j,k : qword;
|
|
|
|
|
|
+ e : smallint;
|
|
|
|
+ d,l,r,s,m,a,n,t : word;
|
|
|
|
+ m_low,m_high,j,k : dword;
|
|
begin
|
|
begin
|
|
secondpass(left);
|
|
secondpass(left);
|
|
if codegenerror then
|
|
if codegenerror then
|
|
@@ -90,7 +90,7 @@ implementation
|
|
if codegenerror then
|
|
if codegenerror then
|
|
exit;
|
|
exit;
|
|
|
|
|
|
- if is_64bitint(resultdef) then
|
|
|
|
|
|
+ if is_64bitint(resultdef) or is_32bitint(resultdef) then
|
|
{ should be handled in pass_1 (JM) }
|
|
{ should be handled in pass_1 (JM) }
|
|
internalerror(200109052);
|
|
internalerror(200109052);
|
|
{ put numerator in register }
|
|
{ put numerator in register }
|
|
@@ -107,39 +107,39 @@ implementation
|
|
"Cardinal($ffffffff) div 16" overflows! (JM) }
|
|
"Cardinal($ffffffff) div 16" overflows! (JM) }
|
|
if is_signed(left.resultdef) Then
|
|
if is_signed(left.resultdef) Then
|
|
begin
|
|
begin
|
|
- if (current_settings.optimizecputype <> cpu_386) and
|
|
|
|
|
|
+ if (current_settings.optimizecputype > cpu_386) and
|
|
not(cs_opt_size in current_settings.optimizerswitches) then
|
|
not(cs_opt_size in current_settings.optimizerswitches) then
|
|
{ use a sequence without jumps, saw this in
|
|
{ use a sequence without jumps, saw this in
|
|
comp.compilers (JM) }
|
|
comp.compilers (JM) }
|
|
begin
|
|
begin
|
|
{ no jumps, but more operations }
|
|
{ no jumps, but more operations }
|
|
hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
- emit_reg_reg(A_MOV,S_L,hreg1,hreg2);
|
|
|
|
- {If the left value is signed, hreg2=$ffffffff, otherwise 0.}
|
|
|
|
- emit_const_reg(A_SAR,S_L,31,hreg2);
|
|
|
|
|
|
+ emit_reg_reg(A_MOV,S_W,hreg1,hreg2);
|
|
|
|
+ {If the left value is signed, hreg2=$ffff, otherwise 0.}
|
|
|
|
+ emit_const_reg(A_SAR,S_W,15,hreg2);
|
|
{If signed, hreg2=right value-1, otherwise 0.}
|
|
{If signed, hreg2=right value-1, otherwise 0.}
|
|
- emit_const_reg(A_AND,S_L,tordconstnode(right).value.svalue-1,hreg2);
|
|
|
|
|
|
+ emit_const_reg(A_AND,S_W,tordconstnode(right).value.svalue-1,hreg2);
|
|
{ add to the left value }
|
|
{ add to the left value }
|
|
- emit_reg_reg(A_ADD,S_L,hreg2,hreg1);
|
|
|
|
|
|
+ emit_reg_reg(A_ADD,S_W,hreg2,hreg1);
|
|
{ do the shift }
|
|
{ do the shift }
|
|
- emit_const_reg(A_SAR,S_L,power,hreg1);
|
|
|
|
|
|
+ emit_const_reg(A_SAR,S_W,power,hreg1);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
{ a jump, but less operations }
|
|
{ a jump, but less operations }
|
|
- emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
|
|
|
|
|
|
+ emit_reg_reg(A_TEST,S_W,hreg1,hreg1);
|
|
current_asmdata.getjumplabel(hl);
|
|
current_asmdata.getjumplabel(hl);
|
|
cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NS,hl);
|
|
cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NS,hl);
|
|
if power=1 then
|
|
if power=1 then
|
|
- emit_reg(A_INC,S_L,hreg1)
|
|
|
|
|
|
+ emit_reg(A_INC,S_W,hreg1)
|
|
else
|
|
else
|
|
- emit_const_reg(A_ADD,S_L,tordconstnode(right).value.svalue-1,hreg1);
|
|
|
|
|
|
+ emit_const_reg(A_ADD,S_W,tordconstnode(right).value.svalue-1,hreg1);
|
|
cg.a_label(current_asmdata.CurrAsmList,hl);
|
|
cg.a_label(current_asmdata.CurrAsmList,hl);
|
|
- emit_const_reg(A_SAR,S_L,power,hreg1);
|
|
|
|
|
|
+ emit_const_reg(A_SAR,S_W,power,hreg1);
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- emit_const_reg(A_SHR,S_L,power,hreg1);
|
|
|
|
|
|
+ emit_const_reg(A_SHR,S_W,power,hreg1);
|
|
location.register:=hreg1;
|
|
location.register:=hreg1;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -148,85 +148,85 @@ implementation
|
|
begin
|
|
begin
|
|
e:=tordconstnode(right).value.svalue;
|
|
e:=tordconstnode(right).value.svalue;
|
|
d:=abs(e);
|
|
d:=abs(e);
|
|
- { Determine algorithm (a), multiplier (m), and shift factor (s) for 32-bit
|
|
|
|
|
|
+ { Determine algorithm (a), multiplier (m), and shift factor (s) for 16-bit
|
|
signed integer division. Based on: Granlund, T.; Montgomery, P.L.:
|
|
signed integer division. Based on: Granlund, T.; Montgomery, P.L.:
|
|
"Division by Invariant Integers using Multiplication". SIGPLAN Notices,
|
|
"Division by Invariant Integers using Multiplication". SIGPLAN Notices,
|
|
Vol. 29, June 1994, page 61.
|
|
Vol. 29, June 1994, page 61.
|
|
}
|
|
}
|
|
|
|
|
|
l:=log2(d);
|
|
l:=log2(d);
|
|
- j:=qword($80000000) mod qword(d);
|
|
|
|
- k:=(qword(1) shl (32+l)) div (qword($80000000-j));
|
|
|
|
- m_low:=((qword(1)) shl (32+l)) div d;
|
|
|
|
- m_high:=(((qword(1)) shl (32+l)) + k) div d;
|
|
|
|
|
|
+ j:=dword($8000) mod dword(d);
|
|
|
|
+ k:=(dword(1) shl (16+l)) div (dword($8000-j));
|
|
|
|
+ m_low:=((dword(1)) shl (16+l)) div d;
|
|
|
|
+ m_high:=(((dword(1)) shl (16+l)) + k) div d;
|
|
while ((m_low shr 1) < (m_high shr 1)) and (l > 0) do
|
|
while ((m_low shr 1) < (m_high shr 1)) and (l > 0) do
|
|
begin
|
|
begin
|
|
m_low:=m_low shr 1;
|
|
m_low:=m_low shr 1;
|
|
m_high:=m_high shr 1;
|
|
m_high:=m_high shr 1;
|
|
dec(l);
|
|
dec(l);
|
|
end;
|
|
end;
|
|
- m:=dword(m_high);
|
|
|
|
|
|
+ m:=word(m_high);
|
|
s:=l;
|
|
s:=l;
|
|
- if (m_high shr 31)<>0 then
|
|
|
|
|
|
+ if (m_high shr 15)<>0 then
|
|
a:=1
|
|
a:=1
|
|
else
|
|
else
|
|
a:=0;
|
|
a:=0;
|
|
- cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX);
|
|
|
|
- emit_const_reg(A_MOV,S_L,aint(m),NR_EAX);
|
|
|
|
- cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX);
|
|
|
|
- emit_reg(A_IMUL,S_L,hreg1);
|
|
|
|
- emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX);
|
|
|
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_AX);
|
|
|
|
+ emit_const_reg(A_MOV,S_W,aint(m),NR_AX);
|
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_DX);
|
|
|
|
+ emit_reg(A_IMUL,S_W,hreg1);
|
|
|
|
+ emit_reg_reg(A_MOV,S_W,hreg1,NR_AX);
|
|
if a<>0 then
|
|
if a<>0 then
|
|
begin
|
|
begin
|
|
- emit_reg_reg(A_ADD,S_L,NR_EAX,NR_EDX);
|
|
|
|
|
|
+ emit_reg_reg(A_ADD,S_W,NR_AX,NR_DX);
|
|
{
|
|
{
|
|
- printf ("; dividend: memory location or register other than EAX or EDX\n");
|
|
|
|
|
|
+ printf ("; dividend: memory location or register other than AX or DX\n");
|
|
printf ("\n");
|
|
printf ("\n");
|
|
- printf ("MOV EAX, 0%08LXh\n", m);
|
|
|
|
|
|
+ printf ("MOV AX, 0%08LXh\n", m);
|
|
printf ("IMUL dividend\n");
|
|
printf ("IMUL dividend\n");
|
|
- printf ("MOV EAX, dividend\n");
|
|
|
|
- printf ("ADD EDX, EAX\n");
|
|
|
|
- if (s) printf ("SAR EDX, %d\n", s);
|
|
|
|
- printf ("SHR EAX, 31\n");
|
|
|
|
- printf ("ADD EDX, EAX\n");
|
|
|
|
- if (e < 0) printf ("NEG EDX\n");
|
|
|
|
|
|
+ printf ("MOV AX, dividend\n");
|
|
|
|
+ printf ("ADD DX, AX\n");
|
|
|
|
+ if (s) printf ("SAR DX, %d\n", s);
|
|
|
|
+ printf ("SHR AX, 15\n");
|
|
|
|
+ printf ("ADD DX, AX\n");
|
|
|
|
+ if (e < 0) printf ("NEG DX\n");
|
|
printf ("\n");
|
|
printf ("\n");
|
|
- printf ("; quotient now in EDX\n");
|
|
|
|
|
|
+ printf ("; quotient now in DX\n");
|
|
}
|
|
}
|
|
end;
|
|
end;
|
|
{
|
|
{
|
|
- printf ("; dividend: memory location of register other than EAX or EDX\n");
|
|
|
|
|
|
+ printf ("; dividend: memory location of register other than AX or DX\n");
|
|
printf ("\n");
|
|
printf ("\n");
|
|
- printf ("MOV EAX, 0%08LXh\n", m);
|
|
|
|
|
|
+ printf ("MOV AX, 0%08LXh\n", m);
|
|
printf ("IMUL dividend\n");
|
|
printf ("IMUL dividend\n");
|
|
- printf ("MOV EAX, dividend\n");
|
|
|
|
- if (s) printf ("SAR EDX, %d\n", s);
|
|
|
|
- printf ("SHR EAX, 31\n");
|
|
|
|
- printf ("ADD EDX, EAX\n");
|
|
|
|
- if (e < 0) printf ("NEG EDX\n");
|
|
|
|
|
|
+ printf ("MOV AX, dividend\n");
|
|
|
|
+ if (s) printf ("SAR DX, %d\n", s);
|
|
|
|
+ printf ("SHR AX, 15\n");
|
|
|
|
+ printf ("ADD DX, AX\n");
|
|
|
|
+ if (e < 0) printf ("NEG DX\n");
|
|
printf ("\n");
|
|
printf ("\n");
|
|
- printf ("; quotient now in EDX\n");
|
|
|
|
|
|
+ printf ("; quotient now in DX\n");
|
|
}
|
|
}
|
|
if s<>0 then
|
|
if s<>0 then
|
|
- emit_const_reg(A_SAR,S_L,s,NR_EDX);
|
|
|
|
- emit_const_reg(A_SHR,S_L,31,NR_EAX);
|
|
|
|
- emit_reg_reg(A_ADD,S_L,NR_EAX,NR_EDX);
|
|
|
|
|
|
+ emit_const_reg(A_SAR,S_W,s,NR_DX);
|
|
|
|
+ emit_const_reg(A_SHR,S_W,15,NR_AX);
|
|
|
|
+ emit_reg_reg(A_ADD,S_W,NR_AX,NR_DX);
|
|
if e<0 then
|
|
if e<0 then
|
|
- emit_reg(A_NEG,S_L,NR_EDX);
|
|
|
|
- cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX);
|
|
|
|
- cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX);
|
|
|
|
|
|
+ emit_reg(A_NEG,S_W,NR_DX);
|
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_DX);
|
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_AX);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
- cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EDX,location.register)
|
|
|
|
|
|
+ cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_DX,location.register)
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
d:=tordconstnode(right).value.svalue;
|
|
d:=tordconstnode(right).value.svalue;
|
|
- if d>=$80000000 then
|
|
|
|
|
|
+ if d>=$8000 then
|
|
begin
|
|
begin
|
|
- emit_const_reg(A_CMP,S_L,aint(d),hreg1);
|
|
|
|
|
|
+ emit_const_reg(A_CMP,S_W,aint(d),hreg1);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
- emit_const_reg(A_MOV,S_L,0,location.register);
|
|
|
|
- emit_const_reg(A_SBB,S_L,-1,location.register);
|
|
|
|
|
|
+ emit_const_reg(A_MOV,S_W,0,location.register);
|
|
|
|
+ emit_const_reg(A_SBB,S_W,-1,location.register);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
@@ -243,19 +243,19 @@ implementation
|
|
SIGPLAN Notices, Vol. 29, June 1994, page 61.
|
|
SIGPLAN Notices, Vol. 29, June 1994, page 61.
|
|
}
|
|
}
|
|
l:=log2(t)+1;
|
|
l:=log2(t)+1;
|
|
- j:=qword($ffffffff) mod qword(t);
|
|
|
|
- k:=(qword(1) shl (32+l)) div (qword($ffffffff-j));
|
|
|
|
- m_low:=((qword(1)) shl (32+l)) div t;
|
|
|
|
- m_high:=(((qword(1)) shl (32+l)) + k) div t;
|
|
|
|
|
|
+ j:=dword($ffff) mod dword(t);
|
|
|
|
+ k:=(dword(1) shl (16+l)) div (dword($ffff-j));
|
|
|
|
+ m_low:=((dword(1)) shl (16+l)) div t;
|
|
|
|
+ m_high:=(((dword(1)) shl (16+l)) + k) div t;
|
|
while ((m_low shr 1) < (m_high shr 1)) and (l>0) do
|
|
while ((m_low shr 1) < (m_high shr 1)) and (l>0) do
|
|
begin
|
|
begin
|
|
m_low:=m_low shr 1;
|
|
m_low:=m_low shr 1;
|
|
m_high:=m_high shr 1;
|
|
m_high:=m_high shr 1;
|
|
l:=l-1;
|
|
l:=l-1;
|
|
end;
|
|
end;
|
|
- if (m_high shr 32)=0 then
|
|
|
|
|
|
+ if (m_high shr 16)=0 then
|
|
begin
|
|
begin
|
|
- m:=dword(m_high);
|
|
|
|
|
|
+ m:=word(m_high);
|
|
s:=l;
|
|
s:=l;
|
|
a:=0;
|
|
a:=0;
|
|
end
|
|
end
|
|
@@ -267,12 +267,12 @@ implementation
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
s:=log2(t);
|
|
s:=log2(t);
|
|
- m_low:=(qword(1) shl (32+s)) div qword(t);
|
|
|
|
- r:=dword(((qword(1)) shl (32+s)) mod qword(t));
|
|
|
|
|
|
+ m_low:=(dword(1) shl (16+s)) div dword(t);
|
|
|
|
+ r:=word(((dword(1)) shl (16+s)) mod dword(t));
|
|
if (r < ((t>>1)+1)) then
|
|
if (r < ((t>>1)+1)) then
|
|
- m:=dword(m_low)
|
|
|
|
|
|
+ m:=word(m_low)
|
|
else
|
|
else
|
|
- m:=dword(m_low)+1;
|
|
|
|
|
|
+ m:=word(m_low)+1;
|
|
a:=1;
|
|
a:=1;
|
|
end;
|
|
end;
|
|
{ Reduce multiplier for either algorithm to smallest possible }
|
|
{ Reduce multiplier for either algorithm to smallest possible }
|
|
@@ -283,72 +283,72 @@ implementation
|
|
end;
|
|
end;
|
|
{ Adjust multiplier for reduction of even divisors }
|
|
{ Adjust multiplier for reduction of even divisors }
|
|
inc(s,n);
|
|
inc(s,n);
|
|
- cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX);
|
|
|
|
- emit_const_reg(A_MOV,S_L,aint(m),NR_EAX);
|
|
|
|
- cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX);
|
|
|
|
- emit_reg(A_MUL,S_L,hreg1);
|
|
|
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_AX);
|
|
|
|
+ emit_const_reg(A_MOV,S_W,aint(m),NR_AX);
|
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_DX);
|
|
|
|
+ emit_reg(A_MUL,S_W,hreg1);
|
|
if a<>0 then
|
|
if a<>0 then
|
|
begin
|
|
begin
|
|
{
|
|
{
|
|
- printf ("; dividend: register other than EAX or memory location\n");
|
|
|
|
|
|
+ printf ("; dividend: register other than AX or memory location\n");
|
|
printf ("\n");
|
|
printf ("\n");
|
|
- printf ("MOV EAX, 0%08lXh\n", m);
|
|
|
|
|
|
+ printf ("MOV AX, 0%08lXh\n", m);
|
|
printf ("MUL dividend\n");
|
|
printf ("MUL dividend\n");
|
|
- printf ("ADD EAX, 0%08lXh\n", m);
|
|
|
|
- printf ("ADC EDX, 0\n");
|
|
|
|
- if (s) printf ("SHR EDX, %d\n", s);
|
|
|
|
|
|
+ printf ("ADD AX, 0%08lXh\n", m);
|
|
|
|
+ printf ("ADC DX, 0\n");
|
|
|
|
+ if (s) printf ("SHR DX, %d\n", s);
|
|
printf ("\n");
|
|
printf ("\n");
|
|
- printf ("; quotient now in EDX\n");
|
|
|
|
|
|
+ printf ("; quotient now in DX\n");
|
|
}
|
|
}
|
|
- emit_const_reg(A_ADD,S_L,aint(m),NR_EAX);
|
|
|
|
- emit_const_reg(A_ADC,S_L,0,NR_EDX);
|
|
|
|
|
|
+ emit_const_reg(A_ADD,S_W,aint(m),NR_AX);
|
|
|
|
+ emit_const_reg(A_ADC,S_W,0,NR_DX);
|
|
end;
|
|
end;
|
|
if s<>0 then
|
|
if s<>0 then
|
|
- emit_const_reg(A_SHR,S_L,aint(s),NR_EDX);
|
|
|
|
- cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX);
|
|
|
|
- cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX);
|
|
|
|
|
|
+ emit_const_reg(A_SHR,S_W,aint(s),NR_DX);
|
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_DX);
|
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_AX);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
- cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EDX,location.register)
|
|
|
|
|
|
+ cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_DX,location.register)
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX);
|
|
|
|
- emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX);
|
|
|
|
- cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX);
|
|
|
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_AX);
|
|
|
|
+ emit_reg_reg(A_MOV,S_W,hreg1,NR_AX);
|
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_DX);
|
|
{Sign extension depends on the left type.}
|
|
{Sign extension depends on the left type.}
|
|
- if torddef(left.resultdef).ordtype=u32bit then
|
|
|
|
- emit_reg_reg(A_XOR,S_L,NR_EDX,NR_EDX)
|
|
|
|
|
|
+ if torddef(left.resultdef).ordtype=u16bit then
|
|
|
|
+ emit_reg_reg(A_XOR,S_W,NR_DX,NR_DX)
|
|
else
|
|
else
|
|
- emit_none(A_CDQ,S_NO);
|
|
|
|
|
|
+ emit_none(A_CWD,S_NO);
|
|
|
|
|
|
{Division depends on the right type.}
|
|
{Division depends on the right type.}
|
|
- if Torddef(right.resultdef).ordtype=u32bit then
|
|
|
|
|
|
+ if Torddef(right.resultdef).ordtype=u16bit then
|
|
op:=A_DIV
|
|
op:=A_DIV
|
|
else
|
|
else
|
|
op:=A_IDIV;
|
|
op:=A_IDIV;
|
|
|
|
|
|
if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
|
|
if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
|
|
- emit_ref(op,S_L,right.location.reference)
|
|
|
|
|
|
+ emit_ref(op,S_W,right.location.reference)
|
|
else if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
|
|
else if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
|
|
- emit_reg(op,S_L,right.location.register)
|
|
|
|
|
|
+ emit_reg(op,S_W,right.location.register)
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
hreg1:=cg.getintregister(current_asmdata.CurrAsmList,right.location.size);
|
|
hreg1:=cg.getintregister(current_asmdata.CurrAsmList,right.location.size);
|
|
- hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,u32inttype,right.location,hreg1);
|
|
|
|
- emit_reg(op,S_L,hreg1);
|
|
|
|
|
|
+ hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,u16inttype,right.location,hreg1);
|
|
|
|
+ emit_reg(op,S_W,hreg1);
|
|
end;
|
|
end;
|
|
|
|
|
|
- {Copy the result into a new register. Release EAX & EDX.}
|
|
|
|
- cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX);
|
|
|
|
- cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX);
|
|
|
|
|
|
+ {Copy the result into a new register. Release AX & DX.}
|
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_DX);
|
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_AX);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
|
|
if nodetype=divn then
|
|
if nodetype=divn then
|
|
- cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EAX,location.register)
|
|
|
|
|
|
+ cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_AX,location.register)
|
|
else
|
|
else
|
|
- cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EDX,location.register);
|
|
|
|
|
|
+ cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_DX,location.register);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|