diff options
| author | Xiaolin Zhao <zhaoxiaolin@loongson.cn> | 2024-08-12 15:18:45 +0800 |
|---|---|---|
| committer | abner chenc <chenguoqi@loongson.cn> | 2024-08-23 00:53:08 +0000 |
| commit | ea08952aa2db17ce4c14d9f9cb0fab03380073a0 (patch) | |
| tree | f6732f08ae6679c2e4880b6340d9c6411327a350 /src/cmd/asm/internal | |
| parent | 10ed134afe1319403a9a6a8b6bb798f29e5a4d5e (diff) | |
| download | go-ea08952aa2db17ce4c14d9f9cb0fab03380073a0.tar.xz | |
cmd/internal/obj/loong64: add support for instructions BSTRPICK.{W/D} and BSTRINS.{W/D}
Go asm syntax:
BSTRPICK{W/V} $msb, RJ, $lsb, RD
BSTRINS{W/V} $msb, RJ, $lsb, RD
Equivalent platform assembler syntax:
bstrpick.{w/d} rd, rj, $msb, $lsb
bstrins.{w/d} rd, rj, $msb, $lsb
Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
Change-Id: I8b89b766ed22a96da7d8d5b2b2873382a49208de
Reviewed-on: https://go-review.googlesource.com/c/go/+/604735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/cmd/asm/internal')
| -rw-r--r-- | src/cmd/asm/internal/asm/asm.go | 7 | ||||
| -rw-r--r-- | src/cmd/asm/internal/asm/testdata/loong64enc1.s | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/asm/asm.go b/src/cmd/asm/internal/asm/asm.go index bdbb3e17e0..b960d8f022 100644 --- a/src/cmd/asm/internal/asm/asm.go +++ b/src/cmd/asm/internal/asm/asm.go @@ -822,6 +822,13 @@ func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) { prog.To = a[3] break } + if p.arch.Family == sys.Loong64 { + prog.From = a[0] + prog.Reg = p.getRegister(prog, op, &a[1]) + prog.AddRestSource(a[2]) + prog.To = a[3] + break + } if p.arch.Family == sys.PPC64 { prog.From = a[0] prog.To = a[3] diff --git a/src/cmd/asm/internal/asm/testdata/loong64enc1.s b/src/cmd/asm/internal/asm/testdata/loong64enc1.s index b24aa2fe7c..8d4231fa6c 100644 --- a/src/cmd/asm/internal/asm/testdata/loong64enc1.s +++ b/src/cmd/asm/internal/asm/testdata/loong64enc1.s @@ -332,3 +332,17 @@ lable2: // FSTX.{S,D} instructions MOVF F2, (R14)(R13) // c2353838 MOVD F2, (R14)(R13) // c2353c38 + + BSTRINSW $0, R4, $0, R5 // 85006000 + BSTRINSW $31, R4, $0, R5 // 85007f00 + BSTRINSW $15, R4, $6, R5 // 85186f00 + BSTRINSV $0, R4, $0, R5 // 85008000 + BSTRINSV $63, R4, $0, R5 // 8500bf00 + BSTRINSV $15, R4, $6, R5 // 85188f00 + + BSTRPICKW $0, R4, $0, R5 // 85806000 + BSTRPICKW $31, R4, $0, R5 // 85807f00 + BSTRPICKW $15, R4, $6, R5 // 85986f00 + BSTRPICKV $0, R4, $0, R5 // 8500c000 + BSTRPICKV $63, R4, $0, R5 // 8500ff00 + BSTRPICKV $15, R4, $6, R5 // 8518cf00 |
