diff --git a/compiler/src/dmd/backend/arm/instr.d b/compiler/src/dmd/backend/arm/instr.d index e8f5cfc79e4..f40420fce9d 100644 --- a/compiler/src/dmd/backend/arm/instr.d +++ b/compiler/src/dmd/backend/arm/instr.d @@ -868,9 +868,19 @@ struct INSTR Rt; } - /* Load/store register pair (unprivileged) - * Load/store register pair (immediate pre-indexed) - * Atomic memory operation + /* STR ,[],# Post-index https://www.scs.stanford.edu/~zyedidia/arm64/str_imm_fpsimd.html + */ + + /* Load/store register (unprivileged) + */ + + /* Load/store register (immediate pre-indexed) + */ + + /* STR ,[,#]! 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 ,[,#] 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 **********************************/ diff --git a/compiler/src/dmd/backend/codebuilder.d b/compiler/src/dmd/backend/codebuilder.d index 93f9d16b33f..f668ac00981 100644 --- a/compiler/src/dmd/backend/codebuilder.d +++ b/compiler/src/dmd/backend/codebuilder.d @@ -35,7 +35,7 @@ struct CodeBuilder code** pTail; enum BADINS = 0x1234_5678; -// enum BADINS = 0xF940_03A8; +// enum BADINS = 0xF900_0FA0; nothrow: public: diff --git a/compiler/src/dmd/backend/x86/cod3.d b/compiler/src/dmd/backend/x86/cod3.d index d51c6e6fa75..ef67fdbdef2 100644 --- a/compiler/src/dmd/backend/x86/cod3.d +++ b/compiler/src/dmd/backend/x86/cod3.d @@ -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.