p.Reg = r1
p.To.Type = obj.TYPE_REG
p.To.Reg = r
+ case ssa.OpARMSRR:
+ genregshift(s, arm.AMOVW, 0, v.Args[0].Reg(), v.Args[1].Reg(), v.Reg(), arm.SHIFT_RR)
case ssa.OpARMMULAF, ssa.OpARMMULAD, ssa.OpARMMULSF, ssa.OpARMMULSD:
r := v.Reg()
r0 := v.Args[0].Reg()
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
return s.newValue2(ssa.OpRotateLeft32, types.Types[TUINT32], args[0], args[1])
},
- sys.AMD64, sys.ARM64, sys.S390X, sys.PPC64)
+ sys.AMD64, sys.ARM, sys.ARM64, sys.S390X, sys.PPC64)
addF("math/bits", "RotateLeft64",
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
return s.newValue2(ssa.OpRotateLeft64, types.Types[TUINT64], args[0], args[1])
(RotateLeft32 x (MOVWconst [c])) -> (SRRconst [-c&31] x)
(RotateLeft16 <t> x (MOVWconst [c])) -> (Or16 (Lsh16x32 <t> x (MOVWconst [c&15])) (Rsh16Ux32 <t> x (MOVWconst [-c&15])))
(RotateLeft8 <t> x (MOVWconst [c])) -> (Or8 (Lsh8x32 <t> x (MOVWconst [c&7])) (Rsh8Ux32 <t> x (MOVWconst [-c&7])))
+(RotateLeft32 x y) -> (SRR x (RSBconst [0] <y.Type> y))
// ((x>>8) | (x<<8)) -> (REV16 x), the type of x is uint16, "|" can also be "^" or "+".
// UBFX instruction is supported by ARMv6T2, ARMv7 and above versions, REV16 is supported by
{name: "SRLconst", argLength: 1, reg: gp11, asm: "SRL", aux: "Int32"}, // arg0 >> auxInt, unsigned
{name: "SRA", argLength: 2, reg: gp21, asm: "SRA"}, // arg0 >> arg1, signed, shift amount is mod 256
{name: "SRAconst", argLength: 1, reg: gp11, asm: "SRA", aux: "Int32"}, // arg0 >> auxInt, signed
+ {name: "SRR", argLength: 2, reg: gp21}, // arg0 right rotate by arg1 bits
{name: "SRRconst", argLength: 1, reg: gp11, aux: "Int32"}, // arg0 right rotate by auxInt bits
{name: "ADDshiftLL", argLength: 2, reg: gp21, asm: "ADD", aux: "Int32"}, // arg0 + arg1<<auxInt
OpARMSRLconst
OpARMSRA
OpARMSRAconst
+ OpARMSRR
OpARMSRRconst
OpARMADDshiftLL
OpARMADDshiftRL
},
},
},
+ {
+ name: "SRR",
+ argLen: 2,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 22527}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 g R12 R14
+ {1, 22527}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 g R12 R14
+ },
+ outputs: []outputInfo{
+ {0, 21503}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 R14
+ },
+ },
+ },
{
name: "SRRconst",
auxType: auxInt32,
return false
}
func rewriteValueARM_OpRotateLeft32_0(v *Value) bool {
+ b := v.Block
// match: (RotateLeft32 x (MOVWconst [c]))
// cond:
// result: (SRRconst [-c&31] x)
v.AddArg(x)
return true
}
- return false
+ // match: (RotateLeft32 x y)
+ // cond:
+ // result: (SRR x (RSBconst [0] <y.Type> y))
+ for {
+ y := v.Args[1]
+ x := v.Args[0]
+ v.reset(OpARMSRR)
+ v.AddArg(x)
+ v0 := b.NewValue0(v.Pos, OpARMRSBconst, y.Type)
+ v0.AuxInt = 0
+ v0.AddArg(y)
+ v.AddArg(v0)
+ return true
+ }
}
func rewriteValueARM_OpRotateLeft8_0(v *Value) bool {
b := v.Block
func RotateLeft32(n uint32) uint32 {
// amd64:"ROLL" 386:"ROLL"
+ // arm:`MOVW\tR[0-9]+@>[$]23`
// arm64:"RORW"
// ppc64:"ROTLW"
// ppc64le:"ROTLW"
}
func RotateLeftVariable32(n uint32, m int) uint32 {
+ // arm:`MOVW\tR[0-9]+@>R[0-9]+`
// amd64:"ROLL"
// arm64:"RORW"
// ppc64:"ROTLW"