cmd/compile/internal: Optimization with RBIT and REV

By checking GOARM in ssa/gen/ARM.rules, each intermediate operator
can be implemented via different instruction serials.

It is up to the user to choose between compitability and efficiency.

The Bswap32(x) is optimized to REV(x) when GOARM >= 6.
The CTZ(x) is optimized to CLZ(RBIT x) when GOARM == 7.

Change-Id: Ie9ee645fa39333fa79ad84ed4d1cefac30422814
Reviewed-on: https://go-review.googlesource.com/35610
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Ben Shi 2017-01-24 09:48:58 +00:00 committed by Cherry Zhang
parent 4a1140472b
commit 8577f81a10
16 changed files with 105 additions and 7 deletions

View file

@ -4,8 +4,10 @@
package ssa
import "math"
import "cmd/internal/obj"
var _ = math.MinInt8 // in case not otherwise used
var _ = obj.ANOP // in case not otherwise used
func rewriteValuegeneric(v *Value) bool {
switch v.Op {
case OpAdd16: