Skip to content

Commit

Permalink
enlarge register mask to 64 bits (#16619)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Jun 25, 2024
1 parent 4e24178 commit 17527b3
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/cdef.d
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ struct Configv
}

alias reg_t = ubyte; // register number
alias regm_t = uint; // Register mask type
alias regm_t = ulong; // Register mask type
struct immed_t
{
targ_size_t[REGMAX] value; // immediate values in registers
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/code.d
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ enum BackendPass

public import dmd.backend.x86.cgcod : findreg;

reg_t findregmsw(uint regm) { return findreg(regm & mMSW); }
reg_t findreglsw(uint regm) { return findreg(regm & (mLSW | mBP)); }
reg_t findregmsw(regm_t regm) { return findreg(regm & mMSW); }
reg_t findreglsw(regm_t regm) { return findreg(regm & (mLSW | mBP)); }

public import dmd.backend.x86.cod1;
public import dmd.backend.x86.cod2;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/global.d
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int REGSIZE() @trusted { return _tysize[TYnptr]; }
public import dmd.backend.var : debuga, debugb, debugc, debugd, debuge, debugf,
debugr, debugs, debugt, debugu, debugw, debugx, debugy;

extern (D) uint mask(uint m) { return 1 << m; }
extern (D) regm_t mask(uint m) { return cast(regm_t)1 << m; }

public import dmd.backend.var : OPTIMIZER, PARSER, globsym, controlc_saw, pointertype, sytab;
public import dmd.backend.cg : fregsaved, localgot, tls_get_addr_sym;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/x86/cgcod.d
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,7 @@ const(char)* regm_str(regm_t rm)
{
const pstrlen = strlen(p);
char *s = p + pstrlen;
snprintf(s, SMAX - pstrlen, "x%02x",rm);
snprintf(s, SMAX - pstrlen, "x%02llx", cast(ulong)rm);
}
assert(strlen(p) <= SMAX);
return strdup(p);
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/x86/cod1.d
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ void fltregs(ref CodeBuilder cdb, code* pcs, tym_t tym)
*/

@trusted
void tstresult(ref CodeBuilder cdb, regm_t regm, tym_t tym, uint saveflag)
void tstresult(ref CodeBuilder cdb, regm_t regm, tym_t tym, bool saveflag)
{
reg_t scrreg; // scratch register
regm_t scrregm;
Expand Down Expand Up @@ -2036,7 +2036,7 @@ void fixresult(ref CodeBuilder cdb, elem *e, regm_t retregs, ref regm_t outretre
fixresult87(cdb, e, retregs, outretregs);
}
else
tstresult(cdb, retregs, tym, forregs);
tstresult(cdb, retregs, tym, forregs != 0);
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/x86/cod2.d
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ void cdmul(ref CGstate cg, ref CodeBuilder cdb,elem *e,regm_t *pretregs)
{
regm_t rretregs = cgstate.allregs & ~retregs; // second arg
scodelem(cgstate,cdb,e2,&rretregs,retregs,true); // get rvalue
regm_t rlo = findreglsw(rretregs);
regm_t rhi = findregmsw(rretregs);
reg_t rlo = findreglsw(rretregs);
reg_t rhi = findregmsw(rretregs);
/* IMUL rhi,EAX
IMUL EDX,rlo
ADD rhi,EDX
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/x86/cod4.d
Original file line number Diff line number Diff line change
Expand Up @@ -1639,8 +1639,8 @@ void cdmulass(ref CGstate cg, ref CodeBuilder cdb,elem *e,regm_t *pretregs)
getlvalue_lsw(cs);
if (config.target_cpu >= TARGET_PentiumPro)
{
regm_t rlo = findreglsw(rretregs);
regm_t rhi = findregmsw(rretregs);
reg_t rlo = findreglsw(rretregs);
reg_t rhi = findregmsw(rretregs);
/* IMUL rhi,EAX
IMUL EDX,rlo
ADD rhi,EDX
Expand Down

0 comments on commit 17527b3

Please sign in to comment.