1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:26:15 -07:00

cmd/compile/internal: stop lowering OpConvert on riscv64

Lowering for OpConvert was removed for all architectures in CL#108496,
prior to the riscv64 port being upstreamed. Remove lowering of OpConvert
on riscv64, which brings it inline with all other architectures. This
results in 1,600+ instructions being removed from the riscv64 go binary.

Change-Id: Iaaf1f8b397875926604048b66ad8ac91a98c871e
Reviewed-on: https://go-review.googlesource.com/c/go/+/533335
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Joel Sing 2023-10-06 16:45:12 +11:00
parent 561bf0457f
commit f711892a8a
5 changed files with 1 additions and 26 deletions

View File

@ -193,7 +193,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
// input args need no code // input args need no code
case ssa.OpPhi: case ssa.OpPhi:
ssagen.CheckLoweredPhi(v) ssagen.CheckLoweredPhi(v)
case ssa.OpCopy, ssa.OpRISCV64MOVconvert, ssa.OpRISCV64MOVDreg: case ssa.OpCopy, ssa.OpRISCV64MOVDreg:
if v.Type.IsMemory() { if v.Type.IsMemory() {
return return
} }

View File

@ -397,8 +397,6 @@
(ADD <ptr.Type> ptr (MOVDconst [s-moveSize(t.Alignment(), config)])) (ADD <ptr.Type> ptr (MOVDconst [s-moveSize(t.Alignment(), config)]))
mem) mem)
(Convert ...) => (MOVconvert ...)
// Checks // Checks
(IsNonNil ...) => (SNEZ ...) (IsNonNil ...) => (SNEZ ...)
(IsInBounds ...) => (Less64U ...) (IsInBounds ...) => (Less64U ...)

View File

@ -233,12 +233,6 @@ func init() {
{name: "SLTU", argLength: 2, reg: gp21, asm: "SLTU"}, // arg0 < arg1, unsigned, result is 0 or 1 {name: "SLTU", argLength: 2, reg: gp21, asm: "SLTU"}, // arg0 < arg1, unsigned, result is 0 or 1
{name: "SLTIU", argLength: 1, reg: gp11, asm: "SLTIU", aux: "Int64"}, // arg0 < auxint, unsigned, result is 0 or 1 {name: "SLTIU", argLength: 1, reg: gp11, asm: "SLTIU", aux: "Int64"}, // arg0 < auxint, unsigned, result is 0 or 1
// MOVconvert converts between pointers and integers.
// We have a special op for this so as to not confuse GC
// (particularly stack maps). It takes a memory arg so it
// gets correctly ordered with respect to GC safepoints.
{name: "MOVconvert", argLength: 2, reg: gp11, asm: "MOV"}, // arg0, but converted to int/ptr as appropriate; arg1=mem
// Round ops to block fused-multiply-add extraction. // Round ops to block fused-multiply-add extraction.
{name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true}, {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true},
{name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true}, {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true},

View File

@ -2401,7 +2401,6 @@ const (
OpRISCV64SLTI OpRISCV64SLTI
OpRISCV64SLTU OpRISCV64SLTU
OpRISCV64SLTIU OpRISCV64SLTIU
OpRISCV64MOVconvert
OpRISCV64LoweredRound32F OpRISCV64LoweredRound32F
OpRISCV64LoweredRound64F OpRISCV64LoweredRound64F
OpRISCV64CALLstatic OpRISCV64CALLstatic
@ -32222,19 +32221,6 @@ var opcodeTable = [...]opInfo{
}, },
}, },
}, },
{
name: "MOVconvert",
argLen: 2,
asm: riscv.AMOV,
reg: regInfo{
inputs: []inputInfo{
{0, 1006632944}, // X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X28 X29 X30
},
outputs: []outputInfo{
{0, 1006632944}, // X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X28 X29 X30
},
},
},
{ {
name: "LoweredRound32F", name: "LoweredRound32F",
argLen: 1, argLen: 1,

View File

@ -132,9 +132,6 @@ func rewriteValueRISCV64(v *Value) bool {
return rewriteValueRISCV64_OpConstBool(v) return rewriteValueRISCV64_OpConstBool(v)
case OpConstNil: case OpConstNil:
return rewriteValueRISCV64_OpConstNil(v) return rewriteValueRISCV64_OpConstNil(v)
case OpConvert:
v.Op = OpRISCV64MOVconvert
return true
case OpCopysign: case OpCopysign:
v.Op = OpRISCV64FSGNJD v.Op = OpRISCV64FSGNJD
return true return true