aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/gen/RISCV64.rules
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2020-03-31 02:00:50 +1100
committerJoel Sing <joel@sing.id.au>2020-04-27 17:49:30 +0000
commit40f2dab0e1740965c014ce22d194cc3fa2976868 (patch)
treed552aa65bd4012d4af90d7353c53fc3c631ea8a5 /src/cmd/compile/internal/ssa/gen/RISCV64.rules
parent1518123114d12d852d92793bd986e8856ac13e25 (diff)
downloadgo-40f2dab0e1740965c014ce22d194cc3fa2976868.tar.gz
go-40f2dab0e1740965c014ce22d194cc3fa2976868.zip
cmd/compile: implement multi-control branches for riscv64
Implement multi-control branches for riscv64, switching to using the BNEZ pseudo-instruction when rewriting conditionals. This will allow for further branch optimisations to later be performed via rewrites. Change-Id: I7f2c69f3c77494b403f26058c6bc8432d8070ad0 Reviewed-on: https://go-review.googlesource.com/c/go/+/226399 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au>
Diffstat (limited to 'src/cmd/compile/internal/ssa/gen/RISCV64.rules')
-rw-r--r--src/cmd/compile/internal/ssa/gen/RISCV64.rules6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/RISCV64.rules b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
index f18283680f..845ca58b6e 100644
--- a/src/cmd/compile/internal/ssa/gen/RISCV64.rules
+++ b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
@@ -447,13 +447,13 @@
// Conditional branches
//
-// cond is 1 if true. BNE compares against 0.
+// cond is 1 if true.
//
// TODO(prattmic): RISCV branch instructions take two operands to compare,
// so we could generate more efficient code by computing the condition in the
// branch itself. This should be revisited now that the compiler has support
// for two control values (https://golang.org/cl/196557).
-(If cond yes no) => (BNE cond yes no)
+(If cond yes no) => (BNEZ cond yes no)
// Calls
(StaticCall ...) => (CALLstatic ...)
@@ -483,7 +483,7 @@
// Optimizations
// Absorb SNEZ into branch.
-(BNE (SNEZ x) yes no) => (BNE x yes no)
+(BNEZ (SNEZ x) yes no) => (BNEZ x yes no)
// Store zero
(MOVBstore [off] {sym} ptr (MOVBconst [0]) mem) => (MOVBstorezero [off] {sym} ptr mem)