Commit cc71aa9a authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile/internal/ssa: make ARM's udiv like other calls

Passes toolstash-check -all.

Change-Id: Id389f8158cf33a3c0fcef373615b5351e7c74b5b
Reviewed-on: https://go-review.googlesource.com/38082
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent b59a4056
...@@ -167,11 +167,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -167,11 +167,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.From.Type = obj.TYPE_REG p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg() p.From.Reg = v.Args[0].Reg()
gc.AddrAuto(&p.To, v) gc.AddrAuto(&p.To, v)
case ssa.OpARMUDIVrtcall:
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = obj.Linklookup(gc.Ctxt, "udiv", 0)
case ssa.OpARMADD, case ssa.OpARMADD,
ssa.OpARMADC, ssa.OpARMADC,
ssa.OpARMSUB, ssa.OpARMSUB,
...@@ -625,7 +620,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -625,7 +620,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.From.Offset = v.AuxInt p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg() p.To.Reg = v.Reg()
case ssa.OpARMCALLstatic, ssa.OpARMCALLclosure, ssa.OpARMCALLinter: case ssa.OpARMCALLstatic, ssa.OpARMCALLclosure, ssa.OpARMCALLinter, ssa.OpARMCALLudiv:
s.Call(v) s.Call(v)
case ssa.OpARMDUFFZERO: case ssa.OpARMDUFFZERO:
p := gc.Prog(obj.ADUFFZERO) p := gc.Prog(obj.ADUFFZERO)
......
...@@ -286,7 +286,7 @@ func NewConfig(arch string, fe Frontend, ctxt *obj.Link, optimize bool) *Config ...@@ -286,7 +286,7 @@ func NewConfig(arch string, fe Frontend, ctxt *obj.Link, optimize bool) *Config
c.noDuffDevice = true // Don't use Duff's device on NaCl c.noDuffDevice = true // Don't use Duff's device on NaCl
// runtime call clobber R12 on nacl // runtime call clobber R12 on nacl
opcodeTable[OpARMUDIVrtcall].reg.clobbers |= 1 << 12 // R12 opcodeTable[OpARMCALLudiv].reg.clobbers |= 1 << 12 // R12
} }
// Assign IDs to preallocated values/blocks. // Assign IDs to preallocated values/blocks.
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
(Div32 x y) -> (Div32 x y) ->
(SUB (XOR <config.fe.TypeUInt32()> // negate the result if one operand is negative (SUB (XOR <config.fe.TypeUInt32()> // negate the result if one operand is negative
(Select0 <config.fe.TypeUInt32()> (UDIVrtcall (Select0 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)}
(SUB <config.fe.TypeUInt32()> (XOR x <config.fe.TypeUInt32()> (Signmask x)) (Signmask x)) // negate x if negative (SUB <config.fe.TypeUInt32()> (XOR x <config.fe.TypeUInt32()> (Signmask x)) (Signmask x)) // negate x if negative
(SUB <config.fe.TypeUInt32()> (XOR y <config.fe.TypeUInt32()> (Signmask y)) (Signmask y)))) // negate y if negative (SUB <config.fe.TypeUInt32()> (XOR y <config.fe.TypeUInt32()> (Signmask y)) (Signmask y)))) // negate y if negative
(Signmask (XOR <config.fe.TypeUInt32()> x y))) (Signmask (XOR <config.fe.TypeUInt32()> x y))) (Signmask (XOR <config.fe.TypeUInt32()> x y))) (Signmask (XOR <config.fe.TypeUInt32()> x y)))
(Div32u x y) -> (Select0 <config.fe.TypeUInt32()> (UDIVrtcall x y)) (Div32u x y) -> (Select0 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)} x y))
(Div16 x y) -> (Div32 (SignExt16to32 x) (SignExt16to32 y)) (Div16 x y) -> (Div32 (SignExt16to32 x) (SignExt16to32 y))
(Div16u x y) -> (Div32u (ZeroExt16to32 x) (ZeroExt16to32 y)) (Div16u x y) -> (Div32u (ZeroExt16to32 x) (ZeroExt16to32 y))
(Div8 x y) -> (Div32 (SignExt8to32 x) (SignExt8to32 y)) (Div8 x y) -> (Div32 (SignExt8to32 x) (SignExt8to32 y))
...@@ -49,11 +49,11 @@ ...@@ -49,11 +49,11 @@
(Mod32 x y) -> (Mod32 x y) ->
(SUB (XOR <config.fe.TypeUInt32()> // negate the result if x is negative (SUB (XOR <config.fe.TypeUInt32()> // negate the result if x is negative
(Select1 <config.fe.TypeUInt32()> (UDIVrtcall (Select1 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)}
(SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> x (Signmask x)) (Signmask x)) // negate x if negative (SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> x (Signmask x)) (Signmask x)) // negate x if negative
(SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> y (Signmask y)) (Signmask y)))) // negate y if negative (SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> y (Signmask y)) (Signmask y)))) // negate y if negative
(Signmask x)) (Signmask x)) (Signmask x)) (Signmask x))
(Mod32u x y) -> (Select1 <config.fe.TypeUInt32()> (UDIVrtcall x y)) (Mod32u x y) -> (Select1 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)} x y))
(Mod16 x y) -> (Mod32 (SignExt16to32 x) (SignExt16to32 y)) (Mod16 x y) -> (Mod32 (SignExt16to32 x) (SignExt16to32 y))
(Mod16u x y) -> (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y)) (Mod16u x y) -> (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y))
(Mod8 x y) -> (Mod32 (SignExt8to32 x) (SignExt8to32 y)) (Mod8 x y) -> (Mod32 (SignExt8to32 x) (SignExt8to32 y))
...@@ -593,10 +593,10 @@ ...@@ -593,10 +593,10 @@
(MULA (MOVWconst [c]) x a) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) -> (ADD (SLLconst <x.Type> [log2(c/9)] (ADDshiftLL <x.Type> x x [3])) a) (MULA (MOVWconst [c]) x a) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) -> (ADD (SLLconst <x.Type> [log2(c/9)] (ADDshiftLL <x.Type> x x [3])) a)
// div by constant // div by constant
(Select0 (UDIVrtcall x (MOVWconst [1]))) -> x (Select0 (CALLudiv x (MOVWconst [1]))) -> x
(Select1 (UDIVrtcall _ (MOVWconst [1]))) -> (MOVWconst [0]) (Select1 (CALLudiv _ (MOVWconst [1]))) -> (MOVWconst [0])
(Select0 (UDIVrtcall x (MOVWconst [c]))) && isPowerOfTwo(c) -> (SRLconst [log2(c)] x) (Select0 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo(c) -> (SRLconst [log2(c)] x)
(Select1 (UDIVrtcall x (MOVWconst [c]))) && isPowerOfTwo(c) -> (ANDconst [c-1] x) (Select1 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo(c) -> (ANDconst [c-1] x)
// constant comparisons // constant comparisons
(CMPconst (MOVWconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ) (CMPconst (MOVWconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ)
...@@ -814,8 +814,8 @@ ...@@ -814,8 +814,8 @@
(SRAconst [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(d)>>uint64(c))]) (SRAconst [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(d)>>uint64(c))])
(MUL (MOVWconst [c]) (MOVWconst [d])) -> (MOVWconst [int64(int32(c*d))]) (MUL (MOVWconst [c]) (MOVWconst [d])) -> (MOVWconst [int64(int32(c*d))])
(MULA (MOVWconst [c]) (MOVWconst [d]) a) -> (ADDconst [int64(int32(c*d))] a) (MULA (MOVWconst [c]) (MOVWconst [d]) a) -> (ADDconst [int64(int32(c*d))] a)
(Select0 (UDIVrtcall (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(uint32(c)/uint32(d))]) (Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(uint32(c)/uint32(d))])
(Select1 (UDIVrtcall (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(uint32(c)%uint32(d))]) (Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(uint32(c)%uint32(d))])
(ANDconst [c] (MOVWconst [d])) -> (MOVWconst [c&d]) (ANDconst [c] (MOVWconst [d])) -> (MOVWconst [c&d])
(ANDconst [c] (ANDconst [d] x)) -> (ANDconst [c&d] x) (ANDconst [c] (ANDconst [d] x)) -> (ANDconst [c&d] x)
(ORconst [c] (MOVWconst [d])) -> (MOVWconst [c|d]) (ORconst [c] (MOVWconst [d])) -> (MOVWconst [c|d])
......
...@@ -143,7 +143,7 @@ func init() { ...@@ -143,7 +143,7 @@ func init() {
// output0 = arg0/arg1, output1 = arg0%arg1 // output0 = arg0/arg1, output1 = arg0%arg1
// see ../../../../../runtime/vlop_arm.s // see ../../../../../runtime/vlop_arm.s
{ {
name: "UDIVrtcall", name: "CALLudiv",
argLength: 2, argLength: 2,
reg: regInfo{ reg: regInfo{
inputs: []regMask{buildReg("R1"), buildReg("R0")}, inputs: []regMask{buildReg("R1"), buildReg("R0")},
...@@ -152,6 +152,9 @@ func init() { ...@@ -152,6 +152,9 @@ func init() {
}, },
clobberFlags: true, clobberFlags: true,
typ: "(UInt32,UInt32)", typ: "(UInt32,UInt32)",
aux: "SymOff",
// TODO(mdempsky): Should this be true?
call: false,
}, },
{name: "ADDS", argLength: 2, reg: gp21carry, asm: "ADD", commutative: true}, // arg0 + arg1, set carry flag {name: "ADDS", argLength: 2, reg: gp21carry, asm: "ADD", commutative: true}, // arg0 + arg1, set carry flag
......
...@@ -660,7 +660,7 @@ const ( ...@@ -660,7 +660,7 @@ const (
OpARMMUL OpARMMUL
OpARMHMUL OpARMHMUL
OpARMHMULU OpARMHMULU
OpARMUDIVrtcall OpARMCALLudiv
OpARMADDS OpARMADDS
OpARMADDSconst OpARMADDSconst
OpARMADC OpARMADC
...@@ -7784,7 +7784,8 @@ var opcodeTable = [...]opInfo{ ...@@ -7784,7 +7784,8 @@ var opcodeTable = [...]opInfo{
}, },
}, },
{ {
name: "UDIVrtcall", name: "CALLudiv",
auxType: auxSymOff,
argLen: 2, argLen: 2,
clobberFlags: true, clobberFlags: true,
reg: regInfo{ reg: regInfo{
......
...@@ -13427,14 +13427,15 @@ func rewriteValueARM_OpDiv32(v *Value, config *Config) bool { ...@@ -13427,14 +13427,15 @@ func rewriteValueARM_OpDiv32(v *Value, config *Config) bool {
_ = b _ = b
// match: (Div32 x y) // match: (Div32 x y)
// cond: // cond:
// result: (SUB (XOR <config.fe.TypeUInt32()> (Select0 <config.fe.TypeUInt32()> (UDIVrtcall (SUB <config.fe.TypeUInt32()> (XOR x <config.fe.TypeUInt32()> (Signmask x)) (Signmask x)) (SUB <config.fe.TypeUInt32()> (XOR y <config.fe.TypeUInt32()> (Signmask y)) (Signmask y)))) (Signmask (XOR <config.fe.TypeUInt32()> x y))) (Signmask (XOR <config.fe.TypeUInt32()> x y))) // result: (SUB (XOR <config.fe.TypeUInt32()> (Select0 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)} (SUB <config.fe.TypeUInt32()> (XOR x <config.fe.TypeUInt32()> (Signmask x)) (Signmask x)) (SUB <config.fe.TypeUInt32()> (XOR y <config.fe.TypeUInt32()> (Signmask y)) (Signmask y)))) (Signmask (XOR <config.fe.TypeUInt32()> x y))) (Signmask (XOR <config.fe.TypeUInt32()> x y)))
for { for {
x := v.Args[0] x := v.Args[0]
y := v.Args[1] y := v.Args[1]
v.reset(OpARMSUB) v.reset(OpARMSUB)
v0 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32()) v0 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32())
v1 := b.NewValue0(v.Pos, OpSelect0, config.fe.TypeUInt32()) v1 := b.NewValue0(v.Pos, OpSelect0, config.fe.TypeUInt32())
v2 := b.NewValue0(v.Pos, OpARMUDIVrtcall, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32())) v2 := b.NewValue0(v.Pos, OpARMCALLudiv, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32()))
v2.Aux = config.ctxt.Lookup("udiv", 0)
v3 := b.NewValue0(v.Pos, OpARMSUB, config.fe.TypeUInt32()) v3 := b.NewValue0(v.Pos, OpARMSUB, config.fe.TypeUInt32())
v4 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32()) v4 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32())
v4.AddArg(x) v4.AddArg(x)
...@@ -13495,13 +13496,14 @@ func rewriteValueARM_OpDiv32u(v *Value, config *Config) bool { ...@@ -13495,13 +13496,14 @@ func rewriteValueARM_OpDiv32u(v *Value, config *Config) bool {
_ = b _ = b
// match: (Div32u x y) // match: (Div32u x y)
// cond: // cond:
// result: (Select0 <config.fe.TypeUInt32()> (UDIVrtcall x y)) // result: (Select0 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)} x y))
for { for {
x := v.Args[0] x := v.Args[0]
y := v.Args[1] y := v.Args[1]
v.reset(OpSelect0) v.reset(OpSelect0)
v.Type = config.fe.TypeUInt32() v.Type = config.fe.TypeUInt32()
v0 := b.NewValue0(v.Pos, OpARMUDIVrtcall, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32())) v0 := b.NewValue0(v.Pos, OpARMCALLudiv, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32()))
v0.Aux = config.ctxt.Lookup("udiv", 0)
v0.AddArg(x) v0.AddArg(x)
v0.AddArg(y) v0.AddArg(y)
v.AddArg(v0) v.AddArg(v0)
...@@ -14885,14 +14887,15 @@ func rewriteValueARM_OpMod32(v *Value, config *Config) bool { ...@@ -14885,14 +14887,15 @@ func rewriteValueARM_OpMod32(v *Value, config *Config) bool {
_ = b _ = b
// match: (Mod32 x y) // match: (Mod32 x y)
// cond: // cond:
// result: (SUB (XOR <config.fe.TypeUInt32()> (Select1 <config.fe.TypeUInt32()> (UDIVrtcall (SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> x (Signmask x)) (Signmask x)) (SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> y (Signmask y)) (Signmask y)))) (Signmask x)) (Signmask x)) // result: (SUB (XOR <config.fe.TypeUInt32()> (Select1 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)} (SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> x (Signmask x)) (Signmask x)) (SUB <config.fe.TypeUInt32()> (XOR <config.fe.TypeUInt32()> y (Signmask y)) (Signmask y)))) (Signmask x)) (Signmask x))
for { for {
x := v.Args[0] x := v.Args[0]
y := v.Args[1] y := v.Args[1]
v.reset(OpARMSUB) v.reset(OpARMSUB)
v0 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32()) v0 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32())
v1 := b.NewValue0(v.Pos, OpSelect1, config.fe.TypeUInt32()) v1 := b.NewValue0(v.Pos, OpSelect1, config.fe.TypeUInt32())
v2 := b.NewValue0(v.Pos, OpARMUDIVrtcall, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32())) v2 := b.NewValue0(v.Pos, OpARMCALLudiv, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32()))
v2.Aux = config.ctxt.Lookup("udiv", 0)
v3 := b.NewValue0(v.Pos, OpARMSUB, config.fe.TypeUInt32()) v3 := b.NewValue0(v.Pos, OpARMSUB, config.fe.TypeUInt32())
v4 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32()) v4 := b.NewValue0(v.Pos, OpARMXOR, config.fe.TypeUInt32())
v4.AddArg(x) v4.AddArg(x)
...@@ -14932,13 +14935,14 @@ func rewriteValueARM_OpMod32u(v *Value, config *Config) bool { ...@@ -14932,13 +14935,14 @@ func rewriteValueARM_OpMod32u(v *Value, config *Config) bool {
_ = b _ = b
// match: (Mod32u x y) // match: (Mod32u x y)
// cond: // cond:
// result: (Select1 <config.fe.TypeUInt32()> (UDIVrtcall x y)) // result: (Select1 <config.fe.TypeUInt32()> (CALLudiv {config.ctxt.Lookup("udiv", 0)} x y))
for { for {
x := v.Args[0] x := v.Args[0]
y := v.Args[1] y := v.Args[1]
v.reset(OpSelect1) v.reset(OpSelect1)
v.Type = config.fe.TypeUInt32() v.Type = config.fe.TypeUInt32()
v0 := b.NewValue0(v.Pos, OpARMUDIVrtcall, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32())) v0 := b.NewValue0(v.Pos, OpARMCALLudiv, MakeTuple(config.fe.TypeUInt32(), config.fe.TypeUInt32()))
v0.Aux = config.ctxt.Lookup("udiv", 0)
v0.AddArg(x) v0.AddArg(x)
v0.AddArg(y) v0.AddArg(y)
v.AddArg(v0) v.AddArg(v0)
...@@ -16331,12 +16335,12 @@ func rewriteValueARM_OpRsh8x8(v *Value, config *Config) bool { ...@@ -16331,12 +16335,12 @@ func rewriteValueARM_OpRsh8x8(v *Value, config *Config) bool {
func rewriteValueARM_OpSelect0(v *Value, config *Config) bool { func rewriteValueARM_OpSelect0(v *Value, config *Config) bool {
b := v.Block b := v.Block
_ = b _ = b
// match: (Select0 (UDIVrtcall x (MOVWconst [1]))) // match: (Select0 (CALLudiv x (MOVWconst [1])))
// cond: // cond:
// result: x // result: x
for { for {
v_0 := v.Args[0] v_0 := v.Args[0]
if v_0.Op != OpARMUDIVrtcall { if v_0.Op != OpARMCALLudiv {
break break
} }
x := v_0.Args[0] x := v_0.Args[0]
...@@ -16352,12 +16356,12 @@ func rewriteValueARM_OpSelect0(v *Value, config *Config) bool { ...@@ -16352,12 +16356,12 @@ func rewriteValueARM_OpSelect0(v *Value, config *Config) bool {
v.AddArg(x) v.AddArg(x)
return true return true
} }
// match: (Select0 (UDIVrtcall x (MOVWconst [c]))) // match: (Select0 (CALLudiv x (MOVWconst [c])))
// cond: isPowerOfTwo(c) // cond: isPowerOfTwo(c)
// result: (SRLconst [log2(c)] x) // result: (SRLconst [log2(c)] x)
for { for {
v_0 := v.Args[0] v_0 := v.Args[0]
if v_0.Op != OpARMUDIVrtcall { if v_0.Op != OpARMCALLudiv {
break break
} }
x := v_0.Args[0] x := v_0.Args[0]
...@@ -16374,12 +16378,12 @@ func rewriteValueARM_OpSelect0(v *Value, config *Config) bool { ...@@ -16374,12 +16378,12 @@ func rewriteValueARM_OpSelect0(v *Value, config *Config) bool {
v.AddArg(x) v.AddArg(x)
return true return true
} }
// match: (Select0 (UDIVrtcall (MOVWconst [c]) (MOVWconst [d]))) // match: (Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d])))
// cond: // cond:
// result: (MOVWconst [int64(uint32(c)/uint32(d))]) // result: (MOVWconst [int64(uint32(c)/uint32(d))])
for { for {
v_0 := v.Args[0] v_0 := v.Args[0]
if v_0.Op != OpARMUDIVrtcall { if v_0.Op != OpARMCALLudiv {
break break
} }
v_0_0 := v_0.Args[0] v_0_0 := v_0.Args[0]
...@@ -16401,12 +16405,12 @@ func rewriteValueARM_OpSelect0(v *Value, config *Config) bool { ...@@ -16401,12 +16405,12 @@ func rewriteValueARM_OpSelect0(v *Value, config *Config) bool {
func rewriteValueARM_OpSelect1(v *Value, config *Config) bool { func rewriteValueARM_OpSelect1(v *Value, config *Config) bool {
b := v.Block b := v.Block
_ = b _ = b
// match: (Select1 (UDIVrtcall _ (MOVWconst [1]))) // match: (Select1 (CALLudiv _ (MOVWconst [1])))
// cond: // cond:
// result: (MOVWconst [0]) // result: (MOVWconst [0])
for { for {
v_0 := v.Args[0] v_0 := v.Args[0]
if v_0.Op != OpARMUDIVrtcall { if v_0.Op != OpARMCALLudiv {
break break
} }
v_0_1 := v_0.Args[1] v_0_1 := v_0.Args[1]
...@@ -16420,12 +16424,12 @@ func rewriteValueARM_OpSelect1(v *Value, config *Config) bool { ...@@ -16420,12 +16424,12 @@ func rewriteValueARM_OpSelect1(v *Value, config *Config) bool {
v.AuxInt = 0 v.AuxInt = 0
return true return true
} }
// match: (Select1 (UDIVrtcall x (MOVWconst [c]))) // match: (Select1 (CALLudiv x (MOVWconst [c])))
// cond: isPowerOfTwo(c) // cond: isPowerOfTwo(c)
// result: (ANDconst [c-1] x) // result: (ANDconst [c-1] x)
for { for {
v_0 := v.Args[0] v_0 := v.Args[0]
if v_0.Op != OpARMUDIVrtcall { if v_0.Op != OpARMCALLudiv {
break break
} }
x := v_0.Args[0] x := v_0.Args[0]
...@@ -16442,12 +16446,12 @@ func rewriteValueARM_OpSelect1(v *Value, config *Config) bool { ...@@ -16442,12 +16446,12 @@ func rewriteValueARM_OpSelect1(v *Value, config *Config) bool {
v.AddArg(x) v.AddArg(x)
return true return true
} }
// match: (Select1 (UDIVrtcall (MOVWconst [c]) (MOVWconst [d]))) // match: (Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d])))
// cond: // cond:
// result: (MOVWconst [int64(uint32(c)%uint32(d))]) // result: (MOVWconst [int64(uint32(c)%uint32(d))])
for { for {
v_0 := v.Args[0] v_0 := v.Args[0]
if v_0.Op != OpARMUDIVrtcall { if v_0.Op != OpARMCALLudiv {
break break
} }
v_0_0 := v_0.Args[0] v_0_0 := v_0.Args[0]
......
...@@ -66,7 +66,7 @@ func Linknew(arch *LinkArch) *Link { ...@@ -66,7 +66,7 @@ func Linknew(arch *LinkArch) *Link {
return ctxt return ctxt
} }
func Linklookup(ctxt *Link, name string, v int) *LSym { func (ctxt *Link) Lookup(name string, v int) *LSym {
s := ctxt.Hash[SymVer{name, v}] s := ctxt.Hash[SymVer{name, v}]
if s != nil { if s != nil {
return s return s
...@@ -82,6 +82,10 @@ func Linklookup(ctxt *Link, name string, v int) *LSym { ...@@ -82,6 +82,10 @@ func Linklookup(ctxt *Link, name string, v int) *LSym {
return s return s
} }
func Linklookup(ctxt *Link, name string, v int) *LSym {
return ctxt.Lookup(name, v)
}
func Linksymfmt(s *LSym) string { func Linksymfmt(s *LSym) string {
if s == nil { if s == nil {
return "<nil>" return "<nil>"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment