From 356b87fa7bbba02debea59d2d03e1eca1750ccb6 Mon Sep 17 00:00:00 2001 From: Junyang Shao Date: Fri, 10 Apr 2026 17:14:35 +0000 Subject: cmd/asm, cmd/internal/obj/arm64: support memory with MUL VL imm offset This CL is generated by CL 765440. This CL supports this addressing pattern: (VL*imm)(Reg) (-VL*imm)(Reg) Change-Id: I4d1bab2ef6c4141699a47b28aa14b28cdee6cb3f Reviewed-on: https://go-review.googlesource.com/c/go/+/765420 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com Reviewed-by: David Chase Commit-Queue: Junyang Shao --- src/cmd/internal/obj/util.go | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'src/cmd/internal/obj/util.go') diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go index fffafeba05..2b7c1f99a8 100644 --- a/src/cmd/internal/obj/util.go +++ b/src/cmd/internal/obj/util.go @@ -304,24 +304,32 @@ func writeDconv(w io.Writer, p *Prog, a *Addr, abiDetail bool) { case TYPE_MEM: if buildcfg.GOARCH == "arm64" && (a.Scale < 0 || (a.Index != REG_NONE && (isZReg(int(a.Reg)) || isZReg(int(a.Index))))) { // SVE extended addressing pattern - amount := 0 - mod := 0 - if a.Scale < 0 { - amount = int((a.Scale >> 12) & 0x7) - mod = int((a.Scale >> 9) & 0x7) - } - modStr := "" - switch mod { - case 1: - modStr = ".UXTW" - case 2: - modStr = ".SXTW" - } - amountStr := "" - if amount != 0 { - amountStr = fmt.Sprintf("<<%d", amount) + if a.Index == REG_NONE { + if a.Offset < 0 { + fmt.Fprintf(w, "(-VL*%d)(%v)", -a.Offset, Rconv(int(a.Reg))) + } else { + fmt.Fprintf(w, "(VL*%d)(%v)", a.Offset, Rconv(int(a.Reg))) + } + } else { + amount := 0 + mod := 0 + if a.Scale < 0 { + amount = int((a.Scale >> 12) & 0x7) + mod = int((a.Scale >> 9) & 0x7) + } + modStr := "" + switch mod { + case 1: + modStr = ".UXTW" + case 2: + modStr = ".SXTW" + } + amountStr := "" + if amount != 0 { + amountStr = fmt.Sprintf("<<%d", amount) + } + fmt.Fprintf(w, "(%v%s%s)(%v)", Rconv(int(a.Reg)), modStr, amountStr, Rconv(int(a.Index))) } - fmt.Fprintf(w, "(%v%s%s)(%v)", Rconv(int(a.Reg)), modStr, amountStr, Rconv(int(a.Index))) } else { a.WriteNameTo(w) if a.Index != REG_NONE { -- cgit v1.3