mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
load floating point with * operator (#21129)
This commit is contained in:
parent
869266c2ef
commit
dd2fc8c8bb
3 changed files with 34 additions and 13 deletions
|
@ -1111,7 +1111,8 @@ void getlvalue(ref CodeBuilder cdb,ref code pcs,elem* e,regm_t keepmsk,RM rm = R
|
|||
}
|
||||
pcs.IEV1.Vsym = s;
|
||||
pcs.IEV1.Voffset = e.Voffset;
|
||||
pcs.Sextend = cast(ubyte)tyToExtend(ty); // sign or zero extension
|
||||
if (!tyfloating(ty))
|
||||
pcs.Sextend = cast(ubyte)tyToExtend(ty); // sign or zero extension
|
||||
if (sz == 1)
|
||||
{
|
||||
s.Sflags |= GTbyte;
|
||||
|
|
|
@ -183,7 +183,7 @@ void cdorth(ref CGstate cg, ref CodeBuilder cdb,elem* e,ref regm_t pretregs)
|
|||
*/
|
||||
Extend tyToExtend(tym_t ty)
|
||||
{
|
||||
//debug printf("ty: %x\n", ty);
|
||||
//debug printf("ty: %s\n", tym_str(ty));
|
||||
assert(tyintegral(ty) || ty == TYnptr);
|
||||
Extend extend;
|
||||
const sz = tysize(ty);
|
||||
|
@ -1040,33 +1040,46 @@ void cdind(ref CGstate cg, ref CodeBuilder cdb,elem* e,ref regm_t pretregs)
|
|||
}
|
||||
const tym = tybasic(e.Ety);
|
||||
const sz = _tysize[tym];
|
||||
if (tyfloating(tym))
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
const uns = tyuns(tym) != 0;
|
||||
|
||||
const tym1 = tybasic(e.E1.Ety);
|
||||
const sz1 = _tysize[tym1];
|
||||
const uns = tyuns(tym1) != 0;
|
||||
|
||||
const posregs = cgstate.allregs;
|
||||
const posregs = cg.allregs;
|
||||
regm_t retregs1 = posregs;
|
||||
codelem(cgstate,cdb,e.E1,retregs1,false);
|
||||
codelem(cg,cdb,e.E1,retregs1,false);
|
||||
const Rn = findreg(retregs1); // Rn is the pointer
|
||||
|
||||
if (tyfloating(tym))
|
||||
{
|
||||
regm_t retregs = pretregs & INSTR.FLOATREGS;
|
||||
if (retregs == 0) /* if no return regs speced (such as mPSW) */
|
||||
retregs = INSTR.FLOATREGS; // give us some
|
||||
reg_t Rt = allocreg(cdb, retregs, tym);
|
||||
|
||||
code cs;
|
||||
cs.base = Rn;
|
||||
cs.reg = NOREG;
|
||||
cs.index = NOREG;
|
||||
loadFromEA(cs, Rt, sz, sz); // LDR reg,[cs.base]
|
||||
cdb.gen1(cs.Iop);
|
||||
|
||||
fixresult(cdb,e,retregs,pretregs);
|
||||
return;
|
||||
}
|
||||
|
||||
regm_t retregs = pretregs & cg.allregs;
|
||||
if (retregs == 0) /* if no return regs speced */
|
||||
/* (like if wanted flags only) */
|
||||
if (retregs == 0) /* if no return regs speced (such as mPSW) */
|
||||
retregs = ALLREGS & posregs; // give us some
|
||||
reg_t Rt = allocreg(cdb, retregs, tym);
|
||||
|
||||
const Rn = findreg(retregs1);
|
||||
|
||||
uint size;
|
||||
uint VR = 0;
|
||||
uint opc;
|
||||
|
||||
uint decode(uint to, uint from, bool uns) { return to * 4 * 2 + from * 2 + uns; }
|
||||
|
||||
// TODO AArch64 consider loadFromEA() instead
|
||||
switch (decode(sz == 8 ? 8 : 4, sz, uns))
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -3799,6 +3799,7 @@ void prolog_setupalloca(ref CodeBuilder cdb)
|
|||
*
|
||||
* Emit Dwarf info for these saves.
|
||||
* Params:
|
||||
* cg = code state
|
||||
* cdb = append generated instructions to this
|
||||
* topush = mask of registers to push
|
||||
* cfa_offset = offset of frame pointer from CFA
|
||||
|
@ -3807,6 +3808,9 @@ void prolog_setupalloca(ref CodeBuilder cdb)
|
|||
@trusted
|
||||
void prolog_saveregs(ref CGstate cg, ref CodeBuilder cdb, regm_t topush, int cfa_offset)
|
||||
{
|
||||
//printf("prolog_saveregs() topush: %s pushoffuse: %d\n", regm_str(topush), cg.pushoffuse);
|
||||
if (cg.AArch64) return; // TODO AArch64: implement
|
||||
|
||||
if (cg.pushoffuse)
|
||||
{
|
||||
// Save to preallocated section in the stack frame
|
||||
|
@ -3905,6 +3909,9 @@ void prolog_saveregs(ref CGstate cg, ref CodeBuilder cdb, regm_t topush, int cfa
|
|||
@trusted
|
||||
private void epilog_restoreregs(ref CGstate cg, ref CodeBuilder cdb, regm_t topop)
|
||||
{
|
||||
//printf("epilog_restoreregs() topop: %s pushoffuse: %d\n", regm_str(topop), cg.pushoffuse);
|
||||
if (cg.AArch64) return; // TODO AArch64: implement
|
||||
|
||||
debug
|
||||
if (topop & ~(XMMREGS | 0xFFFF))
|
||||
printf("fregsaved = %s, mfuncreg = %s\n",regm_str(fregsaved),regm_str(cg.mfuncreg));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue