]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal: stop lowering OpConvert on riscv64
authorJoel Sing <joel@sing.id.au>
Fri, 6 Oct 2023 05:45:12 +0000 (16:45 +1100)
committerJoel Sing <joel@sing.id.au>
Sat, 7 Oct 2023 12:31:59 +0000 (12:31 +0000)
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>
src/cmd/compile/internal/riscv64/ssa.go
src/cmd/compile/internal/ssa/_gen/RISCV64.rules
src/cmd/compile/internal/ssa/_gen/RISCV64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteRISCV64.go

index 63dfc04d40dd014b00ffbf0d61f9398880c0a698..332f5841b755febdb11cf9e60742e1970b7f42ba 100644 (file)
@@ -193,7 +193,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
                // input args need no code
        case ssa.OpPhi:
                ssagen.CheckLoweredPhi(v)
-       case ssa.OpCopy, ssa.OpRISCV64MOVconvert, ssa.OpRISCV64MOVDreg:
+       case ssa.OpCopy, ssa.OpRISCV64MOVDreg:
                if v.Type.IsMemory() {
                        return
                }
index 837c0e18f6018951e409449235fd87ba06af29c7..4cacabb2369c9e575b213e4a013ad3cfbeef9c13 100644 (file)
                (ADD <ptr.Type> ptr (MOVDconst [s-moveSize(t.Alignment(), config)]))
                mem)
 
-(Convert ...) => (MOVconvert ...)
-
 // Checks
 (IsNonNil ...) => (SNEZ ...)
 (IsInBounds ...) => (Less64U ...)
index 47ba20a66bd97cb191953b88dcfa6c7b0998329c..360eff6bcfceb3b301d021c91ac32dee6c89024c 100644 (file)
@@ -233,12 +233,6 @@ func init() {
                {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
 
-               // 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.
                {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true},
                {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true},
index 2e4b376cb06d6f1bdc2e5bffe1df961fbb2fb772..ded1bc648c39a3aa97b55525722ce5ace6c79813 100644 (file)
@@ -2401,7 +2401,6 @@ const (
        OpRISCV64SLTI
        OpRISCV64SLTU
        OpRISCV64SLTIU
-       OpRISCV64MOVconvert
        OpRISCV64LoweredRound32F
        OpRISCV64LoweredRound64F
        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",
                argLen:       1,
index 02629de3ae76ba381d982258912ecf84e6a94b82..7d16fe887f2cc6dbf32d8d2ec86cf3baf7fad88b 100644 (file)
@@ -132,9 +132,6 @@ func rewriteValueRISCV64(v *Value) bool {
                return rewriteValueRISCV64_OpConstBool(v)
        case OpConstNil:
                return rewriteValueRISCV64_OpConstNil(v)
-       case OpConvert:
-               v.Op = OpRISCV64MOVconvert
-               return true
        case OpCopysign:
                v.Op = OpRISCV64FSGNJD
                return true