mirror of
https://github.com/golang/go
synced 2024-11-23 18:40:03 -07:00
cmd/compile: absorb SNEZ into branch on riscv64
Change-Id: I55fd93843a7fb574a7dd66ebb87fdd96e944d555 Reviewed-on: https://go-review.googlesource.com/c/go/+/221682 Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
d28b8524a4
commit
c9ece81cc8
@ -458,6 +458,9 @@
|
||||
|
||||
// Optimizations
|
||||
|
||||
// Absorb SNEZ into branch.
|
||||
(BNE (SNEZ x) yes no) -> (BNE x yes no)
|
||||
|
||||
// Fold ADD+MOVDconst into ADDI where possible.
|
||||
(ADD (MOVDconst [off]) ptr) && is32Bit(off) -> (ADDI [off] ptr)
|
||||
|
||||
|
@ -4387,6 +4387,15 @@ 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)
|
||||
for b.Controls[0].Op == OpRISCV64SNEZ {
|
||||
v_0 := b.Controls[0]
|
||||
x := v_0.Args[0]
|
||||
b.resetWithControl(BlockRISCV64BNE, x)
|
||||
return true
|
||||
}
|
||||
case BlockIf:
|
||||
// match: (If cond yes no)
|
||||
// result: (BNE cond yes no)
|
||||
|
Loading…
Reference in New Issue
Block a user