mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-30 04:33:17 +00:00
Implement 64-bit multiplication support.
Signed multiplication uses the existing ~MUL8 routine in SysLib. Unsigned multiplication will use a new ~UMUL8 library routine.
This commit is contained in:
parent
7f3ba768cd
commit
08cf7a0181
@ -480,12 +480,16 @@
|
||||
{ pc_umi - unsigned integer multiply }
|
||||
{ pc_mpl - long integer multiply }
|
||||
{ pc_uml - unsigned long multiply }
|
||||
{ pc_mpq - long long integer multiply }
|
||||
{ pc_umq - unsigned long long multiply }
|
||||
{ pc_mpr - real multiply }
|
||||
{ }
|
||||
{ Gen0(pc_mpi) cgByte,cgWord }
|
||||
{ Gen0(pc_umi) cgUByte,cgUWord }
|
||||
{ Gen0(pc_mpl) cgLong }
|
||||
{ Gen0(pc_uml) cgULong }
|
||||
{ Gen0(pc_mpq) cgQuad }
|
||||
{ Gen0(pc_umq) cgUQuad }
|
||||
{ Gen0(pc_mpr) cgReal,cgDouble,cgComp,cgExtended }
|
||||
{ }
|
||||
{ The two values on the top of the evaluation stack are }
|
||||
|
@ -121,6 +121,8 @@ opt[pc_bqx] := 'bqx';
|
||||
opt[pc_baq] := 'baq';
|
||||
opt[pc_bnq] := 'bnq';
|
||||
opt[pc_ngq] := 'ngq';
|
||||
opt[pc_mpq] := 'mpq';
|
||||
opt[pc_umq] := 'umq';
|
||||
end; {InitWriteCode}
|
||||
|
||||
|
||||
|
2
CGI.pas
2
CGI.pas
@ -229,7 +229,7 @@ type
|
||||
dc_sym,pc_lnd,pc_lor,pc_vsr,pc_uml,pc_udl,pc_ulm,pc_pop,pc_gil,
|
||||
pc_gli,pc_gdl,pc_gld,pc_cpi,pc_tri,pc_lbu,pc_lbf,pc_sbf,pc_cbf,dc_cns,
|
||||
dc_prm,pc_nat,pc_bno,pc_nop,pc_psh,pc_ili,pc_iil,pc_ild,pc_idl,
|
||||
pc_bqr,pc_bqx,pc_baq,pc_bnq,pc_ngq,pc_adq,pc_sbq);
|
||||
pc_bqr,pc_bqx,pc_baq,pc_bnq,pc_ngq,pc_adq,pc_sbq,pc_mpq,pc_umq);
|
||||
|
||||
{intermediate code}
|
||||
{-----------------}
|
||||
|
10
DAG.pas
10
DAG.pas
@ -110,7 +110,8 @@ function CodesMatch (op1, op2: icptr; exact: boolean): boolean;
|
||||
|
||||
pc_adi, pc_adl, pc_adr, pc_and, pc_lnd, pc_bnd, pc_bal, pc_bor,
|
||||
pc_blr, pc_bxr, pc_blx, pc_equ, pc_neq, pc_ior, pc_lor, pc_mpi,
|
||||
pc_umi, pc_mpl, pc_uml, pc_mpr, pc_bqr, pc_bqx, pc_baq, pc_adq: begin
|
||||
pc_umi, pc_mpl, pc_uml, pc_mpr, pc_bqr, pc_bqx, pc_baq, pc_adq,
|
||||
pc_mpq, pc_umq: begin
|
||||
if op1^.left = op2^.left then
|
||||
if op1^.right = op2^.right then
|
||||
result := true;
|
||||
@ -2266,7 +2267,7 @@ case op^.opcode of
|
||||
pc_udl, pc_ulm, pc_uml, pc_vsr:
|
||||
TypeOf := cgULong;
|
||||
|
||||
pc_bnq, pc_ngq, pc_bqr, pc_bqx, pc_baq, pc_adq, pc_sbq:
|
||||
pc_bnq, pc_ngq, pc_bqr, pc_bqx, pc_baq, pc_adq, pc_sbq, pc_mpq, pc_umq:
|
||||
TypeOf := cgQuad;
|
||||
|
||||
pc_ngr, pc_adr, pc_dvr, pc_mpr, pc_sbr:
|
||||
@ -4062,7 +4063,8 @@ var
|
||||
pc_mdl,pc_ulm,pc_mpi,pc_umi,pc_mpl,pc_uml,pc_mpr,pc_ngi,
|
||||
pc_ngl,pc_ngr,pc_not,pc_pop,pc_sbi,pc_sbl,pc_sbr,
|
||||
pc_shl,pc_sll,pc_shr,pc_usr,pc_slr,pc_vsr,pc_tri,
|
||||
pc_bqr,pc_bqx,pc_baq,pc_bnq,pc_ngq,pc_adq,pc_sbq]
|
||||
pc_bqr,pc_bqx,pc_baq,pc_bnq,pc_ngq,pc_adq,pc_sbq,
|
||||
pc_mpq,pc_umq]
|
||||
then begin
|
||||
op^.parents := icount;
|
||||
icount := icount+1;
|
||||
@ -4943,7 +4945,7 @@ case code^.opcode of
|
||||
pc_ulm, pc_mpi, pc_umi, pc_mpl, pc_uml, pc_mpr, pc_psh, pc_sbi,
|
||||
pc_sbl, pc_sbr, pc_shl, pc_sll, pc_shr, pc_usr, pc_slr, pc_vsr,
|
||||
pc_tri, pc_sbf, pc_sto, pc_cui, pc_bqr, pc_bqx, pc_baq, pc_adq,
|
||||
pc_sbq:
|
||||
pc_sbq, pc_mpq, pc_umq:
|
||||
begin
|
||||
code^.right := Pop;
|
||||
code^.left := Pop;
|
||||
|
@ -3142,6 +3142,10 @@ case tree^.token.kind of
|
||||
Gen0(pc_mpl)
|
||||
else if et = cgULong then
|
||||
Gen0(pc_uml)
|
||||
else if et = cgQuad then
|
||||
Gen0(pc_mpq)
|
||||
else if et = cgUQuad then
|
||||
Gen0(pc_umq)
|
||||
else if et = cgExtended then
|
||||
Gen0(pc_mpr)
|
||||
else
|
||||
@ -3556,6 +3560,10 @@ case tree^.token.kind of
|
||||
Gen0(pc_mpl);
|
||||
cgULong:
|
||||
Gen0(pc_uml);
|
||||
cgQuad:
|
||||
Gen0(pc_mpq);
|
||||
cgUQuad:
|
||||
Gen0(pc_umq);
|
||||
cgExtended:
|
||||
Gen0(pc_mpr);
|
||||
otherwise:
|
||||
|
7
Gen.pas
7
Gen.pas
@ -4524,6 +4524,11 @@ procedure GenTree {op: icptr};
|
||||
pc_bqr: GenOp(m_ora_s);
|
||||
pc_bqx: GenOp(m_eor_s);
|
||||
pc_baq: GenOp(m_and_s);
|
||||
|
||||
pc_mpq: GenCall(79);
|
||||
|
||||
pc_umq: GenCall(80);
|
||||
|
||||
otherwise: Error(cge1);
|
||||
end; {case}
|
||||
end; {GenBinQuad}
|
||||
@ -6128,7 +6133,7 @@ case op^.opcode of
|
||||
pc_and,pc_bnd,pc_bor,pc_bxr,pc_ior: GenLogic(op);
|
||||
pc_blr,pc_blx,pc_bal,pc_dvl,pc_mdl,pc_mpl,pc_sll,pc_slr,pc_udl,pc_ulm,
|
||||
pc_uml,pc_vsr: GenBinLong(op);
|
||||
pc_bqr,pc_bqx,pc_baq: GenBinQuad(op);
|
||||
pc_bqr,pc_bqx,pc_baq,pc_mpq,pc_umq: GenBinQuad(op);
|
||||
pc_bnl,pc_ngl: GenUnaryLong(op);
|
||||
pc_bnq,pc_ngq: GenUnaryQuad(op);
|
||||
pc_bno: GenBno(op);
|
||||
|
@ -2033,6 +2033,8 @@ case callNum of
|
||||
76: sp := @'~STACKERR'; {CC}
|
||||
77: sp := @'~LOADSTRUCT'; {CC}
|
||||
78: sp := @'~DIV4'; {CC}
|
||||
79: sp := @'~MUL8';
|
||||
80: sp := @'~UMUL8';
|
||||
otherwise:
|
||||
Error(cge1);
|
||||
end; {case}
|
||||
|
Loading…
x
Reference in New Issue
Block a user