aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlimeidan <limeidan@loongson.cn>2024-01-11 15:12:50 +0800
committerGopher Robot <gobot@golang.org>2024-07-31 15:39:35 +0000
commitb53809d75dced5729f30d247d8694bfc2940da18 (patch)
treedcd8bb728f76c26d5d15f8573832ca3fcad835eb /src
parent5ca7d4645ffcb01c9a8497ced818b25911ab3cbf (diff)
downloadgo-b53809d75dced5729f30d247d8694bfc2940da18.tar.xz
cmd/internal/obj/loong64: optimize instruction implementation
The plan9 instructions ASLLV and -ASLLV are translated into the same assembly instructions, so -ASLLV can be removed and replaced with ASLLV in the corresponding position. ASRLV and -ASRLV have the same reason as the above two instructions. Change-Id: I4bd79ca7bb070f7a924a0205ef2f19cf2b9ae2c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/565623 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/internal/obj/loong64/asm.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go
index fe71b90e88..ee4a8bb8cb 100644
--- a/src/cmd/internal/obj/loong64/asm.go
+++ b/src/cmd/internal/obj/loong64/asm.go
@@ -1453,8 +1453,8 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
case 14: // movwu r,r
// NOTE: this case does not use REGTMP. If it ever does,
// remove the NOTUSETMP flag in optab.
- o1 = OP_16IRR(c.opirr(-ASLLV), uint32(32)&0x3f, uint32(p.From.Reg), uint32(p.To.Reg))
- o2 = OP_16IRR(c.opirr(-ASRLV), uint32(32)&0x3f, uint32(p.To.Reg), uint32(p.To.Reg))
+ o1 = OP_16IRR(c.opirr(ASLLV), uint32(32)&0x3f, uint32(p.From.Reg), uint32(p.To.Reg))
+ o2 = OP_16IRR(c.opirr(ASRLV), uint32(32)&0x3f, uint32(p.To.Reg), uint32(p.To.Reg))
case 15: // teq $c r,r
v := c.regoff(&p.From)
@@ -2169,17 +2169,13 @@ func (c *ctxt0) opirr(a obj.As) uint32 {
case -AMOVD:
return 0x0ae << 22
- case ASLLV,
- -ASLLV:
+ case ASLLV:
return 0x0041 << 16
- case ASRLV,
- -ASRLV:
+ case ASRLV:
return 0x0045 << 16
- case ASRAV,
- -ASRAV:
+ case ASRAV:
return 0x0049 << 16
- case AROTRV,
- -AROTRV:
+ case AROTRV:
return 0x004d << 16
case -ALL:
return 0x020 << 24