aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/gen/RISCV64.rules
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2020-02-26 03:58:59 +1100
committerJoel Sing <joel@sing.id.au>2020-02-26 17:59:57 +0000
commitc27dd0c9e581edb71c834e161db6a920ca239997 (patch)
tree8aec1a1484bf4c31e853a7c2db9f5a3b80c4f8f9 /src/cmd/compile/internal/ssa/gen/RISCV64.rules
parenta1103dcc27b9c85800624367ebb89ef46d4307af (diff)
downloadgo-c27dd0c9e581edb71c834e161db6a920ca239997.tar.gz
go-c27dd0c9e581edb71c834e161db6a920ca239997.zip
cmd/compile: improve Eq32/Neq32 on riscv64
Use SUBW to perform a 32-bit subtraction, rather than zero extending from 32 to 64 bits. This reduces Eq32 and Neq32 to two instructions, rather than the four instructions required previously. Change-Id: Ib2798324881e9db842c864e91a0c1b1e48c4b67b Reviewed-on: https://go-review.googlesource.com/c/go/+/220921 Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/gen/RISCV64.rules')
-rw-r--r--src/cmd/compile/internal/ssa/gen/RISCV64.rules4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/RISCV64.rules b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
index 711f904f0d..1ffb9575e0 100644
--- a/src/cmd/compile/internal/ssa/gen/RISCV64.rules
+++ b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
@@ -267,7 +267,7 @@
(EqPtr x y) -> (SEQZ (SUB <x.Type> x y))
(Eq64 x y) -> (SEQZ (SUB <x.Type> x y))
-(Eq32 x y) -> (SEQZ (ZeroExt32to64 (SUB <x.Type> x y)))
+(Eq32 x y) -> (SEQZ (SUBW <x.Type> x y))
(Eq16 x y) -> (SEQZ (ZeroExt16to64 (SUB <x.Type> x y)))
(Eq8 x y) -> (SEQZ (ZeroExt8to64 (SUB <x.Type> x y)))
(Eq64F ...) -> (FEQD ...)
@@ -275,7 +275,7 @@
(NeqPtr x y) -> (SNEZ (SUB <x.Type> x y))
(Neq64 x y) -> (SNEZ (SUB <x.Type> x y))
-(Neq32 x y) -> (SNEZ (ZeroExt32to64 (SUB <x.Type> x y)))
+(Neq32 x y) -> (SNEZ (SUBW <x.Type> x y))
(Neq16 x y) -> (SNEZ (ZeroExt16to64 (SUB <x.Type> x y)))
(Neq8 x y) -> (SNEZ (ZeroExt8to64 (SUB <x.Type> x y)))
(Neq64F ...) -> (FNED ...)