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 04:01:29 +1100
committerJoel Sing <joel@sing.id.au>2020-02-26 18:00:53 +0000
commit025a4faf5fd70b8be4a77d19762eb2b4da8754b0 (patch)
tree1d9216724ceee9b848a44cceffb7dead05d028bd /src/cmd/compile/internal/ssa/gen/RISCV64.rules
parentc27dd0c9e581edb71c834e161db6a920ca239997 (diff)
downloadgo-025a4faf5fd70b8be4a77d19762eb2b4da8754b0.tar.gz
go-025a4faf5fd70b8be4a77d19762eb2b4da8754b0.zip
cmd/compile: simplify Slicemask on riscv64
Slicemask can be performed with three immediate instructions, rather than the six currently in use. Change-Id: I3f8ca2d5affd1403db8fa79b356f248e6e9332c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/220923 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.rules3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/RISCV64.rules b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
index 1ffb9575e0..316e5f3726 100644
--- a/src/cmd/compile/internal/ssa/gen/RISCV64.rules
+++ b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
@@ -141,8 +141,7 @@
// For positive x, bit 63 of x-1 is always 0, so the result is -1.
// For zero x, bit 63 of x-1 is 1, so the result is 0.
//
-// TODO(prattmic): Use XORconst etc instead of XOR (MOVDconst).
-(Slicemask <t> x) -> (XOR (MOVDconst [-1]) (SRA <t> (SUB <t> x (MOVDconst [1])) (MOVDconst [63])))
+(Slicemask <t> x) -> (XORI [-1] (SRAI <t> [63] (ADDI <t> [-1] x)))
// Truncations
// We ignore the unused high parts of registers, so truncates are just copies.