Skip to content

Commit

Permalink
cmd/compile: reorder rotate lowering rules in AMD64.rules
Browse files Browse the repository at this point in the history
These rules should belong to lowering rules not optimizations.

Change-Id: I964d2c4b1d9bef0ede572978aff01cb11bf050ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/426197
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Wayne Zuo <[email protected]>
  • Loading branch information
wdvxdr1123 authored and gopherbot committed Sep 1, 2022
1 parent 1f8e94e commit af991a6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/cmd/compile/internal/ssa/gen/AMD64.rules
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,12 @@
(PanicBounds [kind] x y mem) && boundsABI(kind) == 1 => (LoweredPanicBoundsB [kind] x y mem)
(PanicBounds [kind] x y mem) && boundsABI(kind) == 2 => (LoweredPanicBoundsC [kind] x y mem)

// lowering rotates
(RotateLeft8 ...) => (ROLB ...)
(RotateLeft16 ...) => (ROLW ...)
(RotateLeft32 ...) => (ROLL ...)
(RotateLeft64 ...) => (ROLQ ...)

// ***************************
// Above: lowering rules
// Below: optimizations
Expand Down Expand Up @@ -853,11 +859,6 @@
((SHLL|SHRL|SARL|SHLXL|SHRXL|SARXL) x (ANDLconst [c] y)) && c & 31 == 31 => ((SHLL|SHRL|SARL|SHLXL|SHRXL|SARXL) x y)
((SHLL|SHRL|SARL|SHLXL|SHRXL|SARXL) x (NEGL <t> (ANDLconst [c] y))) && c & 31 == 31 => ((SHLL|SHRL|SARL|SHLXL|SHRXL|SARXL) x (NEGL <t> y))

(RotateLeft8 ...) => (ROLB ...)
(RotateLeft16 ...) => (ROLW ...)
(RotateLeft32 ...) => (ROLL ...)
(RotateLeft64 ...) => (ROLQ ...)

// rotate left negative = rotate right
(ROLQ x (NEG(Q|L) y)) => (RORQ x y)
(ROLL x (NEG(Q|L) y)) => (RORL x y)
Expand Down

0 comments on commit af991a6

Please sign in to comment.