load fp register parameter (#20828)

This commit is contained in:
Walter Bright 2025-02-05 23:47:41 -08:00 committed by GitHub
parent 6d6e170cf2
commit da0fc14189
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 9 deletions

View file

@ -868,9 +868,19 @@ struct INSTR
Rt;
}
/* Load/store register pair (unprivileged)
* Load/store register pair (immediate pre-indexed)
* Atomic memory operation
/* STR <Vt>,[<Xn|SP>],#<simm> Post-index https://www.scs.stanford.edu/~zyedidia/arm64/str_imm_fpsimd.html
*/
/* Load/store register (unprivileged)
*/
/* Load/store register (immediate pre-indexed)
*/
/* STR <Vt>,[<Xn|SP>,#<simm>]! Pre-index https://www.scs.stanford.edu/~zyedidia/arm64/str_imm_fpsimd.html
*/
/* Atomic memory operation
*/
/* Load/store register (register offset)
@ -897,8 +907,10 @@ struct INSTR
/* Load/store register (unsigned immediate)
* https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#ldst_pos
*/
static uint ldst_pos(uint size, uint VR, uint opc, uint imm12, ubyte Rn, ubyte Rt)
static uint ldst_pos(uint size, uint VR, uint opc, uint imm12, reg_t Rn, reg_t Vt)
{
assert(Vt > 31);
reg_t Rt = Vt & 31;
return (size << 30) |
(7 << 27) |
(VR << 26) |
@ -909,6 +921,11 @@ struct INSTR
Rt;
}
/* https://www.scs.stanford.edu/~zyedidia/arm64/str_imm_fpsimd.html
* STR <Vt>,[<Xn|SP>,#<simm>] Unsigned offset
*/
static uint str_imm_fpsimd(uint size, uint opc, uint imm12, reg_t Rn, reg_t Vt) { return ldst_pos(size,1,opc,imm12,Rn,Vt); }
/* } */
/* { ************************** Data Processing -- Register **********************************/

View file

@ -35,7 +35,7 @@ struct CodeBuilder
code** pTail;
enum BADINS = 0x1234_5678;
// enum BADINS = 0xF940_03A8;
// enum BADINS = 0xF900_0FA0;
nothrow:
public:

View file

@ -1142,7 +1142,7 @@ static if (NTEXCEPTIONS)
case BC.retexp:
reg_t reg1, reg2;
retregs = allocretregs(cgstate, e.Ety, e.ET, funcsym_p.ty(), reg1, reg2);
//printf("reg1: %d, reg2: %d\n", reg1, reg2);
//printf("reg1: %d, reg2: %d\n", reg1, reg2);
//printf("allocretregs returns %llx %s\n", retregs, regm_str(retregs));
reg_t lreg = NOREG;
@ -4196,6 +4196,8 @@ void prolog_gen_win64_varargs(ref CodeBuilder cdb)
}
/************************************
* Take the parameters passed in registers, and put them into the function's local
* symbol table.
* Params:
* cdb = generated code sink
* tf = what's the type of the function
@ -4297,8 +4299,12 @@ void prolog_loadparams(ref CodeBuilder cdb, tym_t tyf, bool pushalloc)
{
if (AArch64)
{
// STR preg,bp,#offset
cdb.gen1(INSTR.str_imm_gen(sz > 4, preg, 29, offset + localsize + 16));
if (tyfloating(t.Tty))
// STR preg,[bp,#offset]
cdb.gen1(INSTR.str_imm_fpsimd(2 + (sz == 8),0,cast(uint)(offset + localsize + 16) >> 3,29,preg));
else
// STR preg,bp,#offset
cdb.gen1(INSTR.str_imm_gen(sz > 4, preg, 29, offset + localsize + 16));
}
else
{
@ -4448,7 +4454,7 @@ void prolog_loadparams(ref CodeBuilder cdb, tym_t tyf, bool pushalloc)
}
}
/* For parameters that were passed on the stack, but are enregistered,
/* For parameters that were passed on the stack, but are enregistered by the function,
* initialize the registers with the parameter stack values.
* Do not use assignaddr(), as it will replace the stack reference with
* the register.