diff options
author | Joel Sing <joel@sing.id.au> | 2020-03-31 02:00:50 +1100 |
---|---|---|
committer | Joel Sing <joel@sing.id.au> | 2020-04-27 17:49:30 +0000 |
commit | 40f2dab0e1740965c014ce22d194cc3fa2976868 (patch) | |
tree | d552aa65bd4012d4af90d7353c53fc3c631ea8a5 /src/cmd/compile/internal/ssa/rewriteRISCV64.go | |
parent | 1518123114d12d852d92793bd986e8856ac13e25 (diff) | |
download | go-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/rewriteRISCV64.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewriteRISCV64.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteRISCV64.go b/src/cmd/compile/internal/ssa/rewriteRISCV64.go index bfc00309fe..db9f529bae 100644 --- a/src/cmd/compile/internal/ssa/rewriteRISCV64.go +++ b/src/cmd/compile/internal/ssa/rewriteRISCV64.go @@ -5132,21 +5132,21 @@ func rewriteValueRISCV64_OpZeroExt8to64(v *Value) bool { } func rewriteBlockRISCV64(b *Block) bool { switch b.Kind { - case BlockRISCV64BNE: - // match: (BNE (SNEZ x) yes no) - // result: (BNE x yes no) + case BlockRISCV64BNEZ: + // match: (BNEZ (SNEZ x) yes no) + // result: (BNEZ x yes no) for b.Controls[0].Op == OpRISCV64SNEZ { v_0 := b.Controls[0] x := v_0.Args[0] - b.resetWithControl(BlockRISCV64BNE, x) + b.resetWithControl(BlockRISCV64BNEZ, x) return true } case BlockIf: // match: (If cond yes no) - // result: (BNE cond yes no) + // result: (BNEZ cond yes no) for { cond := b.Controls[0] - b.resetWithControl(BlockRISCV64BNE, cond) + b.resetWithControl(BlockRISCV64BNEZ, cond) return true } } |