mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd: avoid unnecessary type conversions
CL generated mechanically with github.com/mdempsky/unconvert. Also updated cmd/compile/internal/ssa/gen/*.rules manually. Change-Id: If721ef73cf0771ae83ce7e2d11623fc8d9155768 Reviewed-on: https://go-review.googlesource.com/97075 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
f4d9c30901
commit
0c471dfae2
29 changed files with 166 additions and 166 deletions
|
|
@ -133,49 +133,49 @@ func ARM64RegisterExtension(a *obj.Addr, ext string, reg, num int16, isAmount, i
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_UXTB + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_UXTB + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (uint32(num) << 10))
|
||||||
case "UXTH":
|
case "UXTH":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_UXTH + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_UXTH + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (1 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (1 << 13) | (uint32(num) << 10))
|
||||||
case "UXTW":
|
case "UXTW":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_UXTW + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_UXTW + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (2 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (2 << 13) | (uint32(num) << 10))
|
||||||
case "UXTX":
|
case "UXTX":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_UXTX + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_UXTX + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (3 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (3 << 13) | (uint32(num) << 10))
|
||||||
case "SXTB":
|
case "SXTB":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_SXTB + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_SXTB + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (4 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (4 << 13) | (uint32(num) << 10))
|
||||||
case "SXTH":
|
case "SXTH":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_SXTH + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_SXTH + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (5 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (5 << 13) | (uint32(num) << 10))
|
||||||
case "SXTW":
|
case "SXTW":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_SXTW + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_SXTW + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (6 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (6 << 13) | (uint32(num) << 10))
|
||||||
case "SXTX":
|
case "SXTX":
|
||||||
if !isAmount {
|
if !isAmount {
|
||||||
return errors.New("invalid register extension")
|
return errors.New("invalid register extension")
|
||||||
}
|
}
|
||||||
a.Reg = arm64.REG_SXTX + (reg & 31) + int16(num<<5)
|
a.Reg = arm64.REG_SXTX + (reg & 31) + num<<5
|
||||||
a.Offset = int64(((rm & 31) << 16) | (7 << 13) | (uint32(num) << 10))
|
a.Offset = int64(((rm & 31) << 16) | (7 << 13) | (uint32(num) << 10))
|
||||||
case "B8":
|
case "B8":
|
||||||
if isIndex {
|
if isIndex {
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ func (p *Parser) registerShift(name string, prefix rune) int64 {
|
||||||
p.errorf("unexpected %s in register shift", tok.String())
|
p.errorf("unexpected %s in register shift", tok.String())
|
||||||
}
|
}
|
||||||
if p.arch.Family == sys.ARM64 {
|
if p.arch.Family == sys.ARM64 {
|
||||||
return int64(int64(r1&31)<<16 | int64(op)<<22 | int64(uint16(count)))
|
return int64(r1&31)<<16 | int64(op)<<22 | int64(uint16(count))
|
||||||
} else {
|
} else {
|
||||||
return int64((r1 & 15) | op<<5 | count)
|
return int64((r1 & 15) | op<<5 | count)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1350,7 +1350,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||||
if len(data) <= strlen {
|
if len(data) <= strlen {
|
||||||
fatalf("invalid string literal")
|
fatalf("invalid string literal")
|
||||||
}
|
}
|
||||||
strs[n] = string(data[:strlen])
|
strs[n] = data[:strlen]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,8 +246,8 @@ func insertInlCall(dwcalls *dwarf.InlCalls, inlIdx int, imap map[int]int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new entry for this inline
|
// Create new entry for this inline
|
||||||
inlinedFn := Ctxt.InlTree.InlinedFunction(int(inlIdx))
|
inlinedFn := Ctxt.InlTree.InlinedFunction(inlIdx)
|
||||||
callXPos := Ctxt.InlTree.CallPos(int(inlIdx))
|
callXPos := Ctxt.InlTree.CallPos(inlIdx)
|
||||||
absFnSym := Ctxt.DwFixups.AbsFuncDwarfSym(inlinedFn)
|
absFnSym := Ctxt.DwFixups.AbsFuncDwarfSym(inlinedFn)
|
||||||
pb := Ctxt.PosTable.Pos(callXPos).Base()
|
pb := Ctxt.PosTable.Pos(callXPos).Base()
|
||||||
callFileSym := Ctxt.Lookup(pb.SymFilename())
|
callFileSym := Ctxt.Lookup(pb.SymFilename())
|
||||||
|
|
|
||||||
|
|
@ -1021,7 +1021,7 @@ Outer:
|
||||||
for _, v := range b.Values {
|
for _, v := range b.Values {
|
||||||
if issafepoint(v) {
|
if issafepoint(v) {
|
||||||
lv.showlive(v, lv.livevars[remap[pos]])
|
lv.showlive(v, lv.livevars[remap[pos]])
|
||||||
lv.stackMapIndex[v] = int(remap[pos])
|
lv.stackMapIndex[v] = remap[pos]
|
||||||
pos++
|
pos++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4752,11 +4752,11 @@ func genssa(f *ssa.Func, pp *Progs) {
|
||||||
e.curfn.Func.DebugInfo.GetPC = func(b, v ssa.ID) int64 {
|
e.curfn.Func.DebugInfo.GetPC = func(b, v ssa.ID) int64 {
|
||||||
switch v {
|
switch v {
|
||||||
case ssa.BlockStart.ID:
|
case ssa.BlockStart.ID:
|
||||||
return int64(bstart[b].Pc)
|
return bstart[b].Pc
|
||||||
case ssa.BlockEnd.ID:
|
case ssa.BlockEnd.ID:
|
||||||
return int64(e.curfn.Func.lsym.Size)
|
return e.curfn.Func.lsym.Size
|
||||||
default:
|
default:
|
||||||
return int64(valueToProgAfter[v].Pc)
|
return valueToProgAfter[v].Pc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3409,31 +3409,31 @@ func walkcompare(n *Node, init *Nodes) *Node {
|
||||||
}
|
}
|
||||||
if step == 1 {
|
if step == 1 {
|
||||||
compare(
|
compare(
|
||||||
nod(OINDEX, cmpl, nodintconst(int64(i))),
|
nod(OINDEX, cmpl, nodintconst(i)),
|
||||||
nod(OINDEX, cmpr, nodintconst(int64(i))),
|
nod(OINDEX, cmpr, nodintconst(i)),
|
||||||
)
|
)
|
||||||
i++
|
i++
|
||||||
remains -= t.Elem().Width
|
remains -= t.Elem().Width
|
||||||
} else {
|
} else {
|
||||||
elemType := t.Elem().ToUnsigned()
|
elemType := t.Elem().ToUnsigned()
|
||||||
cmplw := nod(OINDEX, cmpl, nodintconst(int64(i)))
|
cmplw := nod(OINDEX, cmpl, nodintconst(i))
|
||||||
cmplw = conv(cmplw, elemType) // convert to unsigned
|
cmplw = conv(cmplw, elemType) // convert to unsigned
|
||||||
cmplw = conv(cmplw, convType) // widen
|
cmplw = conv(cmplw, convType) // widen
|
||||||
cmprw := nod(OINDEX, cmpr, nodintconst(int64(i)))
|
cmprw := nod(OINDEX, cmpr, nodintconst(i))
|
||||||
cmprw = conv(cmprw, elemType)
|
cmprw = conv(cmprw, elemType)
|
||||||
cmprw = conv(cmprw, convType)
|
cmprw = conv(cmprw, convType)
|
||||||
// For code like this: uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 ...
|
// For code like this: uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 ...
|
||||||
// ssa will generate a single large load.
|
// ssa will generate a single large load.
|
||||||
for offset := int64(1); offset < step; offset++ {
|
for offset := int64(1); offset < step; offset++ {
|
||||||
lb := nod(OINDEX, cmpl, nodintconst(int64(i+offset)))
|
lb := nod(OINDEX, cmpl, nodintconst(i+offset))
|
||||||
lb = conv(lb, elemType)
|
lb = conv(lb, elemType)
|
||||||
lb = conv(lb, convType)
|
lb = conv(lb, convType)
|
||||||
lb = nod(OLSH, lb, nodintconst(int64(8*t.Elem().Width*offset)))
|
lb = nod(OLSH, lb, nodintconst(8*t.Elem().Width*offset))
|
||||||
cmplw = nod(OOR, cmplw, lb)
|
cmplw = nod(OOR, cmplw, lb)
|
||||||
rb := nod(OINDEX, cmpr, nodintconst(int64(i+offset)))
|
rb := nod(OINDEX, cmpr, nodintconst(i+offset))
|
||||||
rb = conv(rb, elemType)
|
rb = conv(rb, elemType)
|
||||||
rb = conv(rb, convType)
|
rb = conv(rb, convType)
|
||||||
rb = nod(OLSH, rb, nodintconst(int64(8*t.Elem().Width*offset)))
|
rb = nod(OLSH, rb, nodintconst(8*t.Elem().Width*offset))
|
||||||
cmprw = nod(OOR, cmprw, rb)
|
cmprw = nod(OOR, cmprw, rb)
|
||||||
}
|
}
|
||||||
compare(cmplw, cmprw)
|
compare(cmplw, cmprw)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func (state *stateAtPC) reset(live []liveSlot) {
|
||||||
reg := uint8(TrailingZeros64(mask))
|
reg := uint8(TrailingZeros64(mask))
|
||||||
mask &^= 1 << reg
|
mask &^= 1 << reg
|
||||||
|
|
||||||
registers[reg] = append(registers[reg], SlotID(live.slot))
|
registers[reg] = append(registers[reg], live.slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.slots, state.registers = slots, registers
|
state.slots, state.registers = slots, registers
|
||||||
|
|
@ -636,7 +636,7 @@ func (state *debugState) processValue(v *Value, vSlots []SlotID, vReg *Register)
|
||||||
state.f.Fatalf("at %v: slot %v in register %v with no location entry", v, state.slots[slot], &state.registers[reg])
|
state.f.Fatalf("at %v: slot %v in register %v with no location entry", v, state.slots[slot], &state.registers[reg])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
regs := last.Registers &^ (1 << uint8(reg))
|
regs := last.Registers &^ (1 << reg)
|
||||||
setSlot(slot, VarLoc{regs, last.StackOffset})
|
setSlot(slot, VarLoc{regs, last.StackOffset})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@
|
||||||
(Zero [s] {t} ptr mem)
|
(Zero [s] {t} ptr mem)
|
||||||
&& s%4 == 0 && s > 4 && s <= 512
|
&& s%4 == 0 && s > 4 && s <= 512
|
||||||
&& t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice ->
|
&& t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice ->
|
||||||
(DUFFZERO [4 * (128 - int64(s/4))] ptr (MOVWconst [0]) mem)
|
(DUFFZERO [4 * (128 - s/4)] ptr (MOVWconst [0]) mem)
|
||||||
|
|
||||||
// Large zeroing uses a loop
|
// Large zeroing uses a loop
|
||||||
(Zero [s] {t} ptr mem)
|
(Zero [s] {t} ptr mem)
|
||||||
|
|
@ -337,7 +337,7 @@
|
||||||
(Move [s] {t} dst src mem)
|
(Move [s] {t} dst src mem)
|
||||||
&& s%4 == 0 && s > 4 && s <= 512
|
&& s%4 == 0 && s > 4 && s <= 512
|
||||||
&& t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice ->
|
&& t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice ->
|
||||||
(DUFFCOPY [8 * (128 - int64(s/4))] dst src mem)
|
(DUFFCOPY [8 * (128 - s/4)] dst src mem)
|
||||||
|
|
||||||
// Large move uses a loop
|
// Large move uses a loop
|
||||||
(Move [s] {t} dst src mem)
|
(Move [s] {t} dst src mem)
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,7 @@
|
||||||
(Zero [s] ptr mem)
|
(Zero [s] ptr mem)
|
||||||
&& s%16 == 0 && s > 64 && s <= 16*64
|
&& s%16 == 0 && s > 64 && s <= 16*64
|
||||||
&& !config.noDuffDevice ->
|
&& !config.noDuffDevice ->
|
||||||
(DUFFZERO [4 * (64 - int64(s/16))] ptr mem)
|
(DUFFZERO [4 * (64 - s/16)] ptr mem)
|
||||||
|
|
||||||
// large zeroing uses a loop
|
// large zeroing uses a loop
|
||||||
(Zero [s] ptr mem)
|
(Zero [s] ptr mem)
|
||||||
|
|
@ -462,7 +462,7 @@
|
||||||
(Move [s] dst src mem)
|
(Move [s] dst src mem)
|
||||||
&& s%8 == 0 && s > 24 && s <= 8*128
|
&& s%8 == 0 && s > 24 && s <= 8*128
|
||||||
&& !config.noDuffDevice ->
|
&& !config.noDuffDevice ->
|
||||||
(DUFFCOPY [8 * (128 - int64(s/8))] dst src mem)
|
(DUFFCOPY [8 * (128 - s/8)] dst src mem)
|
||||||
|
|
||||||
// large move uses a loop
|
// large move uses a loop
|
||||||
(Move [s] dst src mem)
|
(Move [s] dst src mem)
|
||||||
|
|
@ -904,18 +904,18 @@
|
||||||
(SUBconst [c] (MOVDconst [d])) -> (MOVDconst [d-c])
|
(SUBconst [c] (MOVDconst [d])) -> (MOVDconst [d-c])
|
||||||
(SUBconst [c] (SUBconst [d] x)) -> (ADDconst [-c-d] x)
|
(SUBconst [c] (SUBconst [d] x)) -> (ADDconst [-c-d] x)
|
||||||
(SUBconst [c] (ADDconst [d] x)) -> (ADDconst [-c+d] x)
|
(SUBconst [c] (ADDconst [d] x)) -> (ADDconst [-c+d] x)
|
||||||
(SLLconst [c] (MOVDconst [d])) -> (MOVDconst [int64(d)<<uint64(c)])
|
(SLLconst [c] (MOVDconst [d])) -> (MOVDconst [d<<uint64(c)])
|
||||||
(SRLconst [c] (MOVDconst [d])) -> (MOVDconst [int64(uint64(d)>>uint64(c))])
|
(SRLconst [c] (MOVDconst [d])) -> (MOVDconst [int64(uint64(d)>>uint64(c))])
|
||||||
(SRAconst [c] (MOVDconst [d])) -> (MOVDconst [int64(d)>>uint64(c)])
|
(SRAconst [c] (MOVDconst [d])) -> (MOVDconst [d>>uint64(c)])
|
||||||
(MUL (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [c*d])
|
(MUL (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [c*d])
|
||||||
(MULW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(int32(c)*int32(d))])
|
(MULW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(int32(c)*int32(d))])
|
||||||
(MNEG (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [-c*d])
|
(MNEG (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [-c*d])
|
||||||
(MNEGW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [-int64(int32(c)*int32(d))])
|
(MNEGW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [-int64(int32(c)*int32(d))])
|
||||||
(DIV (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(c)/int64(d)])
|
(DIV (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [c/d])
|
||||||
(UDIV (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint64(c)/uint64(d))])
|
(UDIV (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint64(c)/uint64(d))])
|
||||||
(DIVW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(int32(c)/int32(d))])
|
(DIVW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(int32(c)/int32(d))])
|
||||||
(UDIVW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint32(c)/uint32(d))])
|
(UDIVW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint32(c)/uint32(d))])
|
||||||
(MOD (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(c)%int64(d)])
|
(MOD (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [c%d])
|
||||||
(UMOD (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint64(c)%uint64(d))])
|
(UMOD (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint64(c)%uint64(d))])
|
||||||
(MODW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(int32(c)%int32(d))])
|
(MODW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(int32(c)%int32(d))])
|
||||||
(UMODW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint32(c)%uint32(d))])
|
(UMODW (MOVDconst [c]) (MOVDconst [d])) -> (MOVDconst [int64(uint32(c)%uint32(d))])
|
||||||
|
|
@ -938,10 +938,10 @@
|
||||||
|
|
||||||
// constant comparisons
|
// constant comparisons
|
||||||
(CMPconst (MOVDconst [x]) [y]) && x==y -> (FlagEQ)
|
(CMPconst (MOVDconst [x]) [y]) && x==y -> (FlagEQ)
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)<int64(y) && uint64(x)<uint64(y) -> (FlagLT_ULT)
|
(CMPconst (MOVDconst [x]) [y]) && x<y && uint64(x)<uint64(y) -> (FlagLT_ULT)
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)<int64(y) && uint64(x)>uint64(y) -> (FlagLT_UGT)
|
(CMPconst (MOVDconst [x]) [y]) && x<y && uint64(x)>uint64(y) -> (FlagLT_UGT)
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)>int64(y) && uint64(x)<uint64(y) -> (FlagGT_ULT)
|
(CMPconst (MOVDconst [x]) [y]) && x>y && uint64(x)<uint64(y) -> (FlagGT_ULT)
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)>int64(y) && uint64(x)>uint64(y) -> (FlagGT_UGT)
|
(CMPconst (MOVDconst [x]) [y]) && x>y && uint64(x)>uint64(y) -> (FlagGT_UGT)
|
||||||
(CMPWconst (MOVDconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ)
|
(CMPWconst (MOVDconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ)
|
||||||
(CMPWconst (MOVDconst [x]) [y]) && int32(x)<int32(y) && uint32(x)<uint32(y) -> (FlagLT_ULT)
|
(CMPWconst (MOVDconst [x]) [y]) && int32(x)<int32(y) && uint32(x)<uint32(y) -> (FlagLT_ULT)
|
||||||
(CMPWconst (MOVDconst [x]) [y]) && int32(x)<int32(y) && uint32(x)>uint32(y) -> (FlagLT_UGT)
|
(CMPWconst (MOVDconst [x]) [y]) && int32(x)<int32(y) && uint32(x)>uint32(y) -> (FlagLT_UGT)
|
||||||
|
|
@ -1182,25 +1182,25 @@
|
||||||
// constant folding in *shift ops
|
// constant folding in *shift ops
|
||||||
(ADDshiftLL x (MOVDconst [c]) [d]) -> (ADDconst x [int64(uint64(c)<<uint64(d))])
|
(ADDshiftLL x (MOVDconst [c]) [d]) -> (ADDconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(ADDshiftRL x (MOVDconst [c]) [d]) -> (ADDconst x [int64(uint64(c)>>uint64(d))])
|
(ADDshiftRL x (MOVDconst [c]) [d]) -> (ADDconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(ADDshiftRA x (MOVDconst [c]) [d]) -> (ADDconst x [int64(int64(c)>>uint64(d))])
|
(ADDshiftRA x (MOVDconst [c]) [d]) -> (ADDconst x [c>>uint64(d)])
|
||||||
(SUBshiftLL x (MOVDconst [c]) [d]) -> (SUBconst x [int64(uint64(c)<<uint64(d))])
|
(SUBshiftLL x (MOVDconst [c]) [d]) -> (SUBconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(SUBshiftRL x (MOVDconst [c]) [d]) -> (SUBconst x [int64(uint64(c)>>uint64(d))])
|
(SUBshiftRL x (MOVDconst [c]) [d]) -> (SUBconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(SUBshiftRA x (MOVDconst [c]) [d]) -> (SUBconst x [int64(int64(c)>>uint64(d))])
|
(SUBshiftRA x (MOVDconst [c]) [d]) -> (SUBconst x [c>>uint64(d)])
|
||||||
(ANDshiftLL x (MOVDconst [c]) [d]) -> (ANDconst x [int64(uint64(c)<<uint64(d))])
|
(ANDshiftLL x (MOVDconst [c]) [d]) -> (ANDconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(ANDshiftRL x (MOVDconst [c]) [d]) -> (ANDconst x [int64(uint64(c)>>uint64(d))])
|
(ANDshiftRL x (MOVDconst [c]) [d]) -> (ANDconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(ANDshiftRA x (MOVDconst [c]) [d]) -> (ANDconst x [int64(int64(c)>>uint64(d))])
|
(ANDshiftRA x (MOVDconst [c]) [d]) -> (ANDconst x [c>>uint64(d)])
|
||||||
(ORshiftLL x (MOVDconst [c]) [d]) -> (ORconst x [int64(uint64(c)<<uint64(d))])
|
(ORshiftLL x (MOVDconst [c]) [d]) -> (ORconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(ORshiftRL x (MOVDconst [c]) [d]) -> (ORconst x [int64(uint64(c)>>uint64(d))])
|
(ORshiftRL x (MOVDconst [c]) [d]) -> (ORconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(ORshiftRA x (MOVDconst [c]) [d]) -> (ORconst x [int64(int64(c)>>uint64(d))])
|
(ORshiftRA x (MOVDconst [c]) [d]) -> (ORconst x [c>>uint64(d)])
|
||||||
(XORshiftLL x (MOVDconst [c]) [d]) -> (XORconst x [int64(uint64(c)<<uint64(d))])
|
(XORshiftLL x (MOVDconst [c]) [d]) -> (XORconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(XORshiftRL x (MOVDconst [c]) [d]) -> (XORconst x [int64(uint64(c)>>uint64(d))])
|
(XORshiftRL x (MOVDconst [c]) [d]) -> (XORconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(XORshiftRA x (MOVDconst [c]) [d]) -> (XORconst x [int64(int64(c)>>uint64(d))])
|
(XORshiftRA x (MOVDconst [c]) [d]) -> (XORconst x [c>>uint64(d)])
|
||||||
(BICshiftLL x (MOVDconst [c]) [d]) -> (BICconst x [int64(uint64(c)<<uint64(d))])
|
(BICshiftLL x (MOVDconst [c]) [d]) -> (BICconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(BICshiftRL x (MOVDconst [c]) [d]) -> (BICconst x [int64(uint64(c)>>uint64(d))])
|
(BICshiftRL x (MOVDconst [c]) [d]) -> (BICconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(BICshiftRA x (MOVDconst [c]) [d]) -> (BICconst x [int64(int64(c)>>uint64(d))])
|
(BICshiftRA x (MOVDconst [c]) [d]) -> (BICconst x [c>>uint64(d)])
|
||||||
(CMPshiftLL x (MOVDconst [c]) [d]) -> (CMPconst x [int64(uint64(c)<<uint64(d))])
|
(CMPshiftLL x (MOVDconst [c]) [d]) -> (CMPconst x [int64(uint64(c)<<uint64(d))])
|
||||||
(CMPshiftRL x (MOVDconst [c]) [d]) -> (CMPconst x [int64(uint64(c)>>uint64(d))])
|
(CMPshiftRL x (MOVDconst [c]) [d]) -> (CMPconst x [int64(uint64(c)>>uint64(d))])
|
||||||
(CMPshiftRA x (MOVDconst [c]) [d]) -> (CMPconst x [int64(int64(c)>>uint64(d))])
|
(CMPshiftRA x (MOVDconst [c]) [d]) -> (CMPconst x [c>>uint64(d)])
|
||||||
|
|
||||||
// simplification with *shift ops
|
// simplification with *shift ops
|
||||||
(SUBshiftLL x (SLLconst x [c]) [d]) && c==d -> (MOVDconst [0])
|
(SUBshiftLL x (SLLconst x [c]) [d]) && c==d -> (MOVDconst [0])
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@
|
||||||
(Zero [s] {t} ptr mem)
|
(Zero [s] {t} ptr mem)
|
||||||
&& s%8 == 0 && s > 24 && s <= 8*128
|
&& s%8 == 0 && s > 24 && s <= 8*128
|
||||||
&& t.(*types.Type).Alignment()%8 == 0 && !config.noDuffDevice ->
|
&& t.(*types.Type).Alignment()%8 == 0 && !config.noDuffDevice ->
|
||||||
(DUFFZERO [8 * (128 - int64(s/8))] ptr mem)
|
(DUFFZERO [8 * (128 - s/8)] ptr mem)
|
||||||
|
|
||||||
// large or unaligned zeroing uses a loop
|
// large or unaligned zeroing uses a loop
|
||||||
(Zero [s] {t} ptr mem)
|
(Zero [s] {t} ptr mem)
|
||||||
|
|
@ -618,13 +618,13 @@
|
||||||
(SUBVconst [c] (MOVVconst [d])) -> (MOVVconst [d-c])
|
(SUBVconst [c] (MOVVconst [d])) -> (MOVVconst [d-c])
|
||||||
(SUBVconst [c] (SUBVconst [d] x)) && is32Bit(-c-d) -> (ADDVconst [-c-d] x)
|
(SUBVconst [c] (SUBVconst [d] x)) && is32Bit(-c-d) -> (ADDVconst [-c-d] x)
|
||||||
(SUBVconst [c] (ADDVconst [d] x)) && is32Bit(-c+d) -> (ADDVconst [-c+d] x)
|
(SUBVconst [c] (ADDVconst [d] x)) && is32Bit(-c+d) -> (ADDVconst [-c+d] x)
|
||||||
(SLLVconst [c] (MOVVconst [d])) -> (MOVVconst [int64(d)<<uint64(c)])
|
(SLLVconst [c] (MOVVconst [d])) -> (MOVVconst [d<<uint64(c)])
|
||||||
(SRLVconst [c] (MOVVconst [d])) -> (MOVVconst [int64(uint64(d)>>uint64(c))])
|
(SRLVconst [c] (MOVVconst [d])) -> (MOVVconst [int64(uint64(d)>>uint64(c))])
|
||||||
(SRAVconst [c] (MOVVconst [d])) -> (MOVVconst [int64(d)>>uint64(c)])
|
(SRAVconst [c] (MOVVconst [d])) -> (MOVVconst [d>>uint64(c)])
|
||||||
(Select1 (MULVU (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [c*d])
|
(Select1 (MULVU (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [c*d])
|
||||||
(Select1 (DIVV (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [int64(c)/int64(d)])
|
(Select1 (DIVV (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [c/d])
|
||||||
(Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [int64(uint64(c)/uint64(d))])
|
(Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [int64(uint64(c)/uint64(d))])
|
||||||
(Select0 (DIVV (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [int64(c)%int64(d)]) // mod
|
(Select0 (DIVV (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [c%d]) // mod
|
||||||
(Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [int64(uint64(c)%uint64(d))]) // mod
|
(Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) -> (MOVVconst [int64(uint64(c)%uint64(d))]) // mod
|
||||||
(ANDconst [c] (MOVVconst [d])) -> (MOVVconst [c&d])
|
(ANDconst [c] (MOVVconst [d])) -> (MOVVconst [c&d])
|
||||||
(ANDconst [c] (ANDconst [d] x)) -> (ANDconst [c&d] x)
|
(ANDconst [c] (ANDconst [d] x)) -> (ANDconst [c&d] x)
|
||||||
|
|
@ -647,23 +647,23 @@
|
||||||
(LoweredAtomicAdd64 ptr (MOVVconst [c]) mem) && is32Bit(c) -> (LoweredAtomicAddconst64 [c] ptr mem)
|
(LoweredAtomicAdd64 ptr (MOVVconst [c]) mem) && is32Bit(c) -> (LoweredAtomicAddconst64 [c] ptr mem)
|
||||||
|
|
||||||
// constant comparisons
|
// constant comparisons
|
||||||
(SGTconst [c] (MOVVconst [d])) && int64(c)>int64(d) -> (MOVVconst [1])
|
(SGTconst [c] (MOVVconst [d])) && c>d -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVVconst [d])) && int64(c)<=int64(d) -> (MOVVconst [0])
|
(SGTconst [c] (MOVVconst [d])) && c<=d -> (MOVVconst [0])
|
||||||
(SGTUconst [c] (MOVVconst [d])) && uint64(c)>uint64(d) -> (MOVVconst [1])
|
(SGTUconst [c] (MOVVconst [d])) && uint64(c)>uint64(d) -> (MOVVconst [1])
|
||||||
(SGTUconst [c] (MOVVconst [d])) && uint64(c)<=uint64(d) -> (MOVVconst [0])
|
(SGTUconst [c] (MOVVconst [d])) && uint64(c)<=uint64(d) -> (MOVVconst [0])
|
||||||
|
|
||||||
// other known comparisons
|
// other known comparisons
|
||||||
(SGTconst [c] (MOVBreg _)) && 0x7f < int64(c) -> (MOVVconst [1])
|
(SGTconst [c] (MOVBreg _)) && 0x7f < c -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVBreg _)) && int64(c) <= -0x80 -> (MOVVconst [0])
|
(SGTconst [c] (MOVBreg _)) && c <= -0x80 -> (MOVVconst [0])
|
||||||
(SGTconst [c] (MOVBUreg _)) && 0xff < int64(c) -> (MOVVconst [1])
|
(SGTconst [c] (MOVBUreg _)) && 0xff < c -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVBUreg _)) && int64(c) < 0 -> (MOVVconst [0])
|
(SGTconst [c] (MOVBUreg _)) && c < 0 -> (MOVVconst [0])
|
||||||
(SGTUconst [c] (MOVBUreg _)) && 0xff < uint64(c) -> (MOVVconst [1])
|
(SGTUconst [c] (MOVBUreg _)) && 0xff < uint64(c) -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVHreg _)) && 0x7fff < int64(c) -> (MOVVconst [1])
|
(SGTconst [c] (MOVHreg _)) && 0x7fff < c -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVHreg _)) && int64(c) <= -0x8000 -> (MOVVconst [0])
|
(SGTconst [c] (MOVHreg _)) && c <= -0x8000 -> (MOVVconst [0])
|
||||||
(SGTconst [c] (MOVHUreg _)) && 0xffff < int64(c) -> (MOVVconst [1])
|
(SGTconst [c] (MOVHUreg _)) && 0xffff < c -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVHUreg _)) && int64(c) < 0 -> (MOVVconst [0])
|
(SGTconst [c] (MOVHUreg _)) && c < 0 -> (MOVVconst [0])
|
||||||
(SGTUconst [c] (MOVHUreg _)) && 0xffff < uint64(c) -> (MOVVconst [1])
|
(SGTUconst [c] (MOVHUreg _)) && 0xffff < uint64(c) -> (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVWUreg _)) && int64(c) < 0 -> (MOVVconst [0])
|
(SGTconst [c] (MOVWUreg _)) && c < 0 -> (MOVVconst [0])
|
||||||
(SGTconst [c] (ANDconst [m] _)) && 0 <= m && m < c -> (MOVVconst [1])
|
(SGTconst [c] (ANDconst [m] _)) && 0 <= m && m < c -> (MOVVconst [1])
|
||||||
(SGTUconst [c] (ANDconst [m] _)) && uint64(m) < uint64(c) -> (MOVVconst [1])
|
(SGTUconst [c] (ANDconst [m] _)) && uint64(m) < uint64(c) -> (MOVVconst [1])
|
||||||
(SGTconst [c] (SRLVconst _ [d])) && 0 <= c && 0 < d && d <= 63 && 1<<uint64(64-d) <= c -> (MOVVconst [1])
|
(SGTconst [c] (SRLVconst _ [d])) && 0 <= c && 0 < d && d <= 63 && 1<<uint64(64-d) <= c -> (MOVVconst [1])
|
||||||
|
|
|
||||||
|
|
@ -444,15 +444,15 @@
|
||||||
(CMPWconst (MOVDconst [x]) [y]) && int32(x)<int32(y) -> (FlagLT)
|
(CMPWconst (MOVDconst [x]) [y]) && int32(x)<int32(y) -> (FlagLT)
|
||||||
(CMPWconst (MOVDconst [x]) [y]) && int32(x)>int32(y) -> (FlagGT)
|
(CMPWconst (MOVDconst [x]) [y]) && int32(x)>int32(y) -> (FlagGT)
|
||||||
|
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)==int64(y) -> (FlagEQ)
|
(CMPconst (MOVDconst [x]) [y]) && x==y -> (FlagEQ)
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)<int64(y) -> (FlagLT)
|
(CMPconst (MOVDconst [x]) [y]) && x<y -> (FlagLT)
|
||||||
(CMPconst (MOVDconst [x]) [y]) && int64(x)>int64(y) -> (FlagGT)
|
(CMPconst (MOVDconst [x]) [y]) && x>y -> (FlagGT)
|
||||||
|
|
||||||
(CMPWUconst (MOVDconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ)
|
(CMPWUconst (MOVDconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ)
|
||||||
(CMPWUconst (MOVDconst [x]) [y]) && uint32(x)<uint32(y) -> (FlagLT)
|
(CMPWUconst (MOVDconst [x]) [y]) && uint32(x)<uint32(y) -> (FlagLT)
|
||||||
(CMPWUconst (MOVDconst [x]) [y]) && uint32(x)>uint32(y) -> (FlagGT)
|
(CMPWUconst (MOVDconst [x]) [y]) && uint32(x)>uint32(y) -> (FlagGT)
|
||||||
|
|
||||||
(CMPUconst (MOVDconst [x]) [y]) && int64(x)==int64(y) -> (FlagEQ)
|
(CMPUconst (MOVDconst [x]) [y]) && x==y -> (FlagEQ)
|
||||||
(CMPUconst (MOVDconst [x]) [y]) && uint64(x)<uint64(y) -> (FlagLT)
|
(CMPUconst (MOVDconst [x]) [y]) && uint64(x)<uint64(y) -> (FlagLT)
|
||||||
(CMPUconst (MOVDconst [x]) [y]) && uint64(x)>uint64(y) -> (FlagGT)
|
(CMPUconst (MOVDconst [x]) [y]) && uint64(x)>uint64(y) -> (FlagGT)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20066,7 +20066,7 @@ func rewriteValueARM_OpMove_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (Move [s] {t} dst src mem)
|
// match: (Move [s] {t} dst src mem)
|
||||||
// cond: s%4 == 0 && s > 4 && s <= 512 && t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice
|
// cond: s%4 == 0 && s > 4 && s <= 512 && t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice
|
||||||
// result: (DUFFCOPY [8 * (128 - int64(s/4))] dst src mem)
|
// result: (DUFFCOPY [8 * (128 - s/4)] dst src mem)
|
||||||
for {
|
for {
|
||||||
s := v.AuxInt
|
s := v.AuxInt
|
||||||
t := v.Aux
|
t := v.Aux
|
||||||
|
|
@ -20078,7 +20078,7 @@ func rewriteValueARM_OpMove_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARMDUFFCOPY)
|
v.reset(OpARMDUFFCOPY)
|
||||||
v.AuxInt = 8 * (128 - int64(s/4))
|
v.AuxInt = 8 * (128 - s/4)
|
||||||
v.AddArg(dst)
|
v.AddArg(dst)
|
||||||
v.AddArg(src)
|
v.AddArg(src)
|
||||||
v.AddArg(mem)
|
v.AddArg(mem)
|
||||||
|
|
@ -21985,7 +21985,7 @@ func rewriteValueARM_OpZero_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (Zero [s] {t} ptr mem)
|
// match: (Zero [s] {t} ptr mem)
|
||||||
// cond: s%4 == 0 && s > 4 && s <= 512 && t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice
|
// cond: s%4 == 0 && s > 4 && s <= 512 && t.(*types.Type).Alignment()%4 == 0 && !config.noDuffDevice
|
||||||
// result: (DUFFZERO [4 * (128 - int64(s/4))] ptr (MOVWconst [0]) mem)
|
// result: (DUFFZERO [4 * (128 - s/4)] ptr (MOVWconst [0]) mem)
|
||||||
for {
|
for {
|
||||||
s := v.AuxInt
|
s := v.AuxInt
|
||||||
t := v.Aux
|
t := v.Aux
|
||||||
|
|
@ -21996,7 +21996,7 @@ func rewriteValueARM_OpZero_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARMDUFFZERO)
|
v.reset(OpARMDUFFZERO)
|
||||||
v.AuxInt = 4 * (128 - int64(s/4))
|
v.AuxInt = 4 * (128 - s/4)
|
||||||
v.AddArg(ptr)
|
v.AddArg(ptr)
|
||||||
v0 := b.NewValue0(v.Pos, OpARMMOVWconst, typ.UInt32)
|
v0 := b.NewValue0(v.Pos, OpARMMOVWconst, typ.UInt32)
|
||||||
v0.AuxInt = 0
|
v0.AuxInt = 0
|
||||||
|
|
|
||||||
|
|
@ -1162,7 +1162,7 @@ func rewriteValueARM64_OpARM64ADDshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (ADDshiftRA x (MOVDconst [c]) [d])
|
// match: (ADDshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (ADDconst x [int64(int64(c)>>uint64(d))])
|
// result: (ADDconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -1173,7 +1173,7 @@ func rewriteValueARM64_OpARM64ADDshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64ADDconst)
|
v.reset(OpARM64ADDconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -1630,7 +1630,7 @@ func rewriteValueARM64_OpARM64ANDshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (ANDshiftRA x (MOVDconst [c]) [d])
|
// match: (ANDshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (ANDconst x [int64(int64(c)>>uint64(d))])
|
// result: (ANDconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -1641,7 +1641,7 @@ func rewriteValueARM64_OpARM64ANDshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64ANDconst)
|
v.reset(OpARM64ANDconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -1916,7 +1916,7 @@ func rewriteValueARM64_OpARM64BICshiftLL_0(v *Value) bool {
|
||||||
func rewriteValueARM64_OpARM64BICshiftRA_0(v *Value) bool {
|
func rewriteValueARM64_OpARM64BICshiftRA_0(v *Value) bool {
|
||||||
// match: (BICshiftRA x (MOVDconst [c]) [d])
|
// match: (BICshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (BICconst x [int64(int64(c)>>uint64(d))])
|
// result: (BICconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -1927,7 +1927,7 @@ func rewriteValueARM64_OpARM64BICshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64BICconst)
|
v.reset(OpARM64BICconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -2338,7 +2338,7 @@ func rewriteValueARM64_OpARM64CMPconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)<int64(y) && uint64(x)<uint64(y)
|
// cond: x<y && uint64(x)<uint64(y)
|
||||||
// result: (FlagLT_ULT)
|
// result: (FlagLT_ULT)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -2347,14 +2347,14 @@ func rewriteValueARM64_OpARM64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) < int64(y) && uint64(x) < uint64(y)) {
|
if !(x < y && uint64(x) < uint64(y)) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARM64FlagLT_ULT)
|
v.reset(OpARM64FlagLT_ULT)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)<int64(y) && uint64(x)>uint64(y)
|
// cond: x<y && uint64(x)>uint64(y)
|
||||||
// result: (FlagLT_UGT)
|
// result: (FlagLT_UGT)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -2363,14 +2363,14 @@ func rewriteValueARM64_OpARM64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) < int64(y) && uint64(x) > uint64(y)) {
|
if !(x < y && uint64(x) > uint64(y)) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARM64FlagLT_UGT)
|
v.reset(OpARM64FlagLT_UGT)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)>int64(y) && uint64(x)<uint64(y)
|
// cond: x>y && uint64(x)<uint64(y)
|
||||||
// result: (FlagGT_ULT)
|
// result: (FlagGT_ULT)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -2379,14 +2379,14 @@ func rewriteValueARM64_OpARM64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) > int64(y) && uint64(x) < uint64(y)) {
|
if !(x > y && uint64(x) < uint64(y)) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARM64FlagGT_ULT)
|
v.reset(OpARM64FlagGT_ULT)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)>int64(y) && uint64(x)>uint64(y)
|
// cond: x>y && uint64(x)>uint64(y)
|
||||||
// result: (FlagGT_UGT)
|
// result: (FlagGT_UGT)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -2395,7 +2395,7 @@ func rewriteValueARM64_OpARM64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) > int64(y) && uint64(x) > uint64(y)) {
|
if !(x > y && uint64(x) > uint64(y)) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARM64FlagGT_UGT)
|
v.reset(OpARM64FlagGT_UGT)
|
||||||
|
|
@ -2551,7 +2551,7 @@ func rewriteValueARM64_OpARM64CMPshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (CMPshiftRA x (MOVDconst [c]) [d])
|
// match: (CMPshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (CMPconst x [int64(int64(c)>>uint64(d))])
|
// result: (CMPconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -2562,7 +2562,7 @@ func rewriteValueARM64_OpARM64CMPshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64CMPconst)
|
v.reset(OpARM64CMPconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -2863,7 +2863,7 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool {
|
||||||
func rewriteValueARM64_OpARM64DIV_0(v *Value) bool {
|
func rewriteValueARM64_OpARM64DIV_0(v *Value) bool {
|
||||||
// match: (DIV (MOVDconst [c]) (MOVDconst [d]))
|
// match: (DIV (MOVDconst [c]) (MOVDconst [d]))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVDconst [int64(c)/int64(d)])
|
// result: (MOVDconst [c/d])
|
||||||
for {
|
for {
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
|
|
@ -2877,7 +2877,7 @@ func rewriteValueARM64_OpARM64DIV_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_1.AuxInt
|
d := v_1.AuxInt
|
||||||
v.reset(OpARM64MOVDconst)
|
v.reset(OpARM64MOVDconst)
|
||||||
v.AuxInt = int64(c) / int64(d)
|
v.AuxInt = c / d
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
@ -5379,7 +5379,7 @@ func rewriteValueARM64_OpARM64MNEGW_20(v *Value) bool {
|
||||||
func rewriteValueARM64_OpARM64MOD_0(v *Value) bool {
|
func rewriteValueARM64_OpARM64MOD_0(v *Value) bool {
|
||||||
// match: (MOD (MOVDconst [c]) (MOVDconst [d]))
|
// match: (MOD (MOVDconst [c]) (MOVDconst [d]))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVDconst [int64(c)%int64(d)])
|
// result: (MOVDconst [c%d])
|
||||||
for {
|
for {
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
|
|
@ -5393,7 +5393,7 @@ func rewriteValueARM64_OpARM64MOD_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_1.AuxInt
|
d := v_1.AuxInt
|
||||||
v.reset(OpARM64MOVDconst)
|
v.reset(OpARM64MOVDconst)
|
||||||
v.AuxInt = int64(c) % int64(d)
|
v.AuxInt = c % d
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
@ -10807,7 +10807,7 @@ func rewriteValueARM64_OpARM64ORshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (ORshiftRA x (MOVDconst [c]) [d])
|
// match: (ORshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (ORconst x [int64(int64(c)>>uint64(d))])
|
// result: (ORconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -10818,7 +10818,7 @@ func rewriteValueARM64_OpARM64ORshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64ORconst)
|
v.reset(OpARM64ORconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -10986,7 +10986,7 @@ func rewriteValueARM64_OpARM64SLL_0(v *Value) bool {
|
||||||
func rewriteValueARM64_OpARM64SLLconst_0(v *Value) bool {
|
func rewriteValueARM64_OpARM64SLLconst_0(v *Value) bool {
|
||||||
// match: (SLLconst [c] (MOVDconst [d]))
|
// match: (SLLconst [c] (MOVDconst [d]))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVDconst [int64(d)<<uint64(c)])
|
// result: (MOVDconst [d<<uint64(c)])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
|
|
@ -10995,7 +10995,7 @@ func rewriteValueARM64_OpARM64SLLconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_0.AuxInt
|
d := v_0.AuxInt
|
||||||
v.reset(OpARM64MOVDconst)
|
v.reset(OpARM64MOVDconst)
|
||||||
v.AuxInt = int64(d) << uint64(c)
|
v.AuxInt = d << uint64(c)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SLLconst [c] (SRLconst [c] x))
|
// match: (SLLconst [c] (SRLconst [c] x))
|
||||||
|
|
@ -11043,7 +11043,7 @@ func rewriteValueARM64_OpARM64SRA_0(v *Value) bool {
|
||||||
func rewriteValueARM64_OpARM64SRAconst_0(v *Value) bool {
|
func rewriteValueARM64_OpARM64SRAconst_0(v *Value) bool {
|
||||||
// match: (SRAconst [c] (MOVDconst [d]))
|
// match: (SRAconst [c] (MOVDconst [d]))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVDconst [int64(d)>>uint64(c)])
|
// result: (MOVDconst [d>>uint64(c)])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
|
|
@ -11052,7 +11052,7 @@ func rewriteValueARM64_OpARM64SRAconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_0.AuxInt
|
d := v_0.AuxInt
|
||||||
v.reset(OpARM64MOVDconst)
|
v.reset(OpARM64MOVDconst)
|
||||||
v.AuxInt = int64(d) >> uint64(c)
|
v.AuxInt = d >> uint64(c)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
@ -11454,7 +11454,7 @@ func rewriteValueARM64_OpARM64SUBshiftLL_0(v *Value) bool {
|
||||||
func rewriteValueARM64_OpARM64SUBshiftRA_0(v *Value) bool {
|
func rewriteValueARM64_OpARM64SUBshiftRA_0(v *Value) bool {
|
||||||
// match: (SUBshiftRA x (MOVDconst [c]) [d])
|
// match: (SUBshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (SUBconst x [int64(int64(c)>>uint64(d))])
|
// result: (SUBconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -11465,7 +11465,7 @@ func rewriteValueARM64_OpARM64SUBshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64SUBconst)
|
v.reset(OpARM64SUBconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -12142,7 +12142,7 @@ func rewriteValueARM64_OpARM64XORshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (XORshiftRA x (MOVDconst [c]) [d])
|
// match: (XORshiftRA x (MOVDconst [c]) [d])
|
||||||
// cond:
|
// cond:
|
||||||
// result: (XORconst x [int64(int64(c)>>uint64(d))])
|
// result: (XORconst x [c>>uint64(d)])
|
||||||
for {
|
for {
|
||||||
d := v.AuxInt
|
d := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -12153,7 +12153,7 @@ func rewriteValueARM64_OpARM64XORshiftRA_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
c := v_1.AuxInt
|
c := v_1.AuxInt
|
||||||
v.reset(OpARM64XORconst)
|
v.reset(OpARM64XORconst)
|
||||||
v.AuxInt = int64(int64(c) >> uint64(d))
|
v.AuxInt = c >> uint64(d)
|
||||||
v.AddArg(x)
|
v.AddArg(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -15759,7 +15759,7 @@ func rewriteValueARM64_OpMove_10(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (Move [s] dst src mem)
|
// match: (Move [s] dst src mem)
|
||||||
// cond: s%8 == 0 && s > 24 && s <= 8*128 && !config.noDuffDevice
|
// cond: s%8 == 0 && s > 24 && s <= 8*128 && !config.noDuffDevice
|
||||||
// result: (DUFFCOPY [8 * (128 - int64(s/8))] dst src mem)
|
// result: (DUFFCOPY [8 * (128 - s/8)] dst src mem)
|
||||||
for {
|
for {
|
||||||
s := v.AuxInt
|
s := v.AuxInt
|
||||||
_ = v.Args[2]
|
_ = v.Args[2]
|
||||||
|
|
@ -15770,7 +15770,7 @@ func rewriteValueARM64_OpMove_10(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARM64DUFFCOPY)
|
v.reset(OpARM64DUFFCOPY)
|
||||||
v.AuxInt = 8 * (128 - int64(s/8))
|
v.AuxInt = 8 * (128 - s/8)
|
||||||
v.AddArg(dst)
|
v.AddArg(dst)
|
||||||
v.AddArg(src)
|
v.AddArg(src)
|
||||||
v.AddArg(mem)
|
v.AddArg(mem)
|
||||||
|
|
@ -18460,7 +18460,7 @@ func rewriteValueARM64_OpZero_20(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (Zero [s] ptr mem)
|
// match: (Zero [s] ptr mem)
|
||||||
// cond: s%16 == 0 && s > 64 && s <= 16*64 && !config.noDuffDevice
|
// cond: s%16 == 0 && s > 64 && s <= 16*64 && !config.noDuffDevice
|
||||||
// result: (DUFFZERO [4 * (64 - int64(s/16))] ptr mem)
|
// result: (DUFFZERO [4 * (64 - s/16)] ptr mem)
|
||||||
for {
|
for {
|
||||||
s := v.AuxInt
|
s := v.AuxInt
|
||||||
_ = v.Args[1]
|
_ = v.Args[1]
|
||||||
|
|
@ -18470,7 +18470,7 @@ func rewriteValueARM64_OpZero_20(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpARM64DUFFZERO)
|
v.reset(OpARM64DUFFZERO)
|
||||||
v.AuxInt = 4 * (64 - int64(s/16))
|
v.AuxInt = 4 * (64 - s/16)
|
||||||
v.AddArg(ptr)
|
v.AddArg(ptr)
|
||||||
v.AddArg(mem)
|
v.AddArg(mem)
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -6012,7 +6012,7 @@ func rewriteValueMIPS64_OpMIPS64SGTUconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
// match: (SGTconst [c] (MOVVconst [d]))
|
// match: (SGTconst [c] (MOVVconst [d]))
|
||||||
// cond: int64(c)>int64(d)
|
// cond: c>d
|
||||||
// result: (MOVVconst [1])
|
// result: (MOVVconst [1])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6021,7 +6021,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
d := v_0.AuxInt
|
d := v_0.AuxInt
|
||||||
if !(int64(c) > int64(d)) {
|
if !(c > d) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6029,7 +6029,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVVconst [d]))
|
// match: (SGTconst [c] (MOVVconst [d]))
|
||||||
// cond: int64(c)<=int64(d)
|
// cond: c<=d
|
||||||
// result: (MOVVconst [0])
|
// result: (MOVVconst [0])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6038,7 +6038,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
d := v_0.AuxInt
|
d := v_0.AuxInt
|
||||||
if !(int64(c) <= int64(d)) {
|
if !(c <= d) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6046,7 +6046,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVBreg _))
|
// match: (SGTconst [c] (MOVBreg _))
|
||||||
// cond: 0x7f < int64(c)
|
// cond: 0x7f < c
|
||||||
// result: (MOVVconst [1])
|
// result: (MOVVconst [1])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6054,7 +6054,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVBreg {
|
if v_0.Op != OpMIPS64MOVBreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(0x7f < int64(c)) {
|
if !(0x7f < c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6062,7 +6062,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVBreg _))
|
// match: (SGTconst [c] (MOVBreg _))
|
||||||
// cond: int64(c) <= -0x80
|
// cond: c <= -0x80
|
||||||
// result: (MOVVconst [0])
|
// result: (MOVVconst [0])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6070,7 +6070,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVBreg {
|
if v_0.Op != OpMIPS64MOVBreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(int64(c) <= -0x80) {
|
if !(c <= -0x80) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6078,7 +6078,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVBUreg _))
|
// match: (SGTconst [c] (MOVBUreg _))
|
||||||
// cond: 0xff < int64(c)
|
// cond: 0xff < c
|
||||||
// result: (MOVVconst [1])
|
// result: (MOVVconst [1])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6086,7 +6086,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVBUreg {
|
if v_0.Op != OpMIPS64MOVBUreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(0xff < int64(c)) {
|
if !(0xff < c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6094,7 +6094,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVBUreg _))
|
// match: (SGTconst [c] (MOVBUreg _))
|
||||||
// cond: int64(c) < 0
|
// cond: c < 0
|
||||||
// result: (MOVVconst [0])
|
// result: (MOVVconst [0])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6102,7 +6102,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVBUreg {
|
if v_0.Op != OpMIPS64MOVBUreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(int64(c) < 0) {
|
if !(c < 0) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6110,7 +6110,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVHreg _))
|
// match: (SGTconst [c] (MOVHreg _))
|
||||||
// cond: 0x7fff < int64(c)
|
// cond: 0x7fff < c
|
||||||
// result: (MOVVconst [1])
|
// result: (MOVVconst [1])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6118,7 +6118,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVHreg {
|
if v_0.Op != OpMIPS64MOVHreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(0x7fff < int64(c)) {
|
if !(0x7fff < c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6126,7 +6126,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVHreg _))
|
// match: (SGTconst [c] (MOVHreg _))
|
||||||
// cond: int64(c) <= -0x8000
|
// cond: c <= -0x8000
|
||||||
// result: (MOVVconst [0])
|
// result: (MOVVconst [0])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6134,7 +6134,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVHreg {
|
if v_0.Op != OpMIPS64MOVHreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(int64(c) <= -0x8000) {
|
if !(c <= -0x8000) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6142,7 +6142,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVHUreg _))
|
// match: (SGTconst [c] (MOVHUreg _))
|
||||||
// cond: 0xffff < int64(c)
|
// cond: 0xffff < c
|
||||||
// result: (MOVVconst [1])
|
// result: (MOVVconst [1])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6150,7 +6150,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVHUreg {
|
if v_0.Op != OpMIPS64MOVHUreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(0xffff < int64(c)) {
|
if !(0xffff < c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6158,7 +6158,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (SGTconst [c] (MOVHUreg _))
|
// match: (SGTconst [c] (MOVHUreg _))
|
||||||
// cond: int64(c) < 0
|
// cond: c < 0
|
||||||
// result: (MOVVconst [0])
|
// result: (MOVVconst [0])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6166,7 +6166,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVHUreg {
|
if v_0.Op != OpMIPS64MOVHUreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(int64(c) < 0) {
|
if !(c < 0) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6177,7 +6177,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
func rewriteValueMIPS64_OpMIPS64SGTconst_10(v *Value) bool {
|
func rewriteValueMIPS64_OpMIPS64SGTconst_10(v *Value) bool {
|
||||||
// match: (SGTconst [c] (MOVWUreg _))
|
// match: (SGTconst [c] (MOVWUreg _))
|
||||||
// cond: int64(c) < 0
|
// cond: c < 0
|
||||||
// result: (MOVVconst [0])
|
// result: (MOVVconst [0])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
|
|
@ -6185,7 +6185,7 @@ func rewriteValueMIPS64_OpMIPS64SGTconst_10(v *Value) bool {
|
||||||
if v_0.Op != OpMIPS64MOVWUreg {
|
if v_0.Op != OpMIPS64MOVWUreg {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !(int64(c) < 0) {
|
if !(c < 0) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
|
|
@ -6267,7 +6267,7 @@ func rewriteValueMIPS64_OpMIPS64SLLV_0(v *Value) bool {
|
||||||
func rewriteValueMIPS64_OpMIPS64SLLVconst_0(v *Value) bool {
|
func rewriteValueMIPS64_OpMIPS64SLLVconst_0(v *Value) bool {
|
||||||
// match: (SLLVconst [c] (MOVVconst [d]))
|
// match: (SLLVconst [c] (MOVVconst [d]))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVVconst [int64(d)<<uint64(c)])
|
// result: (MOVVconst [d<<uint64(c)])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
|
|
@ -6276,7 +6276,7 @@ func rewriteValueMIPS64_OpMIPS64SLLVconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_0.AuxInt
|
d := v_0.AuxInt
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
v.AuxInt = int64(d) << uint64(c)
|
v.AuxInt = d << uint64(c)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
@ -6322,7 +6322,7 @@ func rewriteValueMIPS64_OpMIPS64SRAV_0(v *Value) bool {
|
||||||
func rewriteValueMIPS64_OpMIPS64SRAVconst_0(v *Value) bool {
|
func rewriteValueMIPS64_OpMIPS64SRAVconst_0(v *Value) bool {
|
||||||
// match: (SRAVconst [c] (MOVVconst [d]))
|
// match: (SRAVconst [c] (MOVVconst [d]))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVVconst [int64(d)>>uint64(c)])
|
// result: (MOVVconst [d>>uint64(c)])
|
||||||
for {
|
for {
|
||||||
c := v.AuxInt
|
c := v.AuxInt
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
|
|
@ -6331,7 +6331,7 @@ func rewriteValueMIPS64_OpMIPS64SRAVconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_0.AuxInt
|
d := v_0.AuxInt
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
v.AuxInt = int64(d) >> uint64(c)
|
v.AuxInt = d >> uint64(c)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
@ -8961,7 +8961,7 @@ func rewriteValueMIPS64_OpSelect0_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (Select0 (DIVV (MOVVconst [c]) (MOVVconst [d])))
|
// match: (Select0 (DIVV (MOVVconst [c]) (MOVVconst [d])))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVVconst [int64(c)%int64(d)])
|
// result: (MOVVconst [c%d])
|
||||||
for {
|
for {
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
if v_0.Op != OpMIPS64DIVV {
|
if v_0.Op != OpMIPS64DIVV {
|
||||||
|
|
@ -8979,7 +8979,7 @@ func rewriteValueMIPS64_OpSelect0_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_0_1.AuxInt
|
d := v_0_1.AuxInt
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
v.AuxInt = int64(c) % int64(d)
|
v.AuxInt = c % d
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d])))
|
// match: (Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d])))
|
||||||
|
|
@ -9451,7 +9451,7 @@ func rewriteValueMIPS64_OpSelect1_10(v *Value) bool {
|
||||||
func rewriteValueMIPS64_OpSelect1_20(v *Value) bool {
|
func rewriteValueMIPS64_OpSelect1_20(v *Value) bool {
|
||||||
// match: (Select1 (DIVV (MOVVconst [c]) (MOVVconst [d])))
|
// match: (Select1 (DIVV (MOVVconst [c]) (MOVVconst [d])))
|
||||||
// cond:
|
// cond:
|
||||||
// result: (MOVVconst [int64(c)/int64(d)])
|
// result: (MOVVconst [c/d])
|
||||||
for {
|
for {
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
if v_0.Op != OpMIPS64DIVV {
|
if v_0.Op != OpMIPS64DIVV {
|
||||||
|
|
@ -9469,7 +9469,7 @@ func rewriteValueMIPS64_OpSelect1_20(v *Value) bool {
|
||||||
}
|
}
|
||||||
d := v_0_1.AuxInt
|
d := v_0_1.AuxInt
|
||||||
v.reset(OpMIPS64MOVVconst)
|
v.reset(OpMIPS64MOVVconst)
|
||||||
v.AuxInt = int64(c) / int64(d)
|
v.AuxInt = c / d
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d])))
|
// match: (Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d])))
|
||||||
|
|
@ -10419,7 +10419,7 @@ func rewriteValueMIPS64_OpZero_10(v *Value) bool {
|
||||||
}
|
}
|
||||||
// match: (Zero [s] {t} ptr mem)
|
// match: (Zero [s] {t} ptr mem)
|
||||||
// cond: s%8 == 0 && s > 24 && s <= 8*128 && t.(*types.Type).Alignment()%8 == 0 && !config.noDuffDevice
|
// cond: s%8 == 0 && s > 24 && s <= 8*128 && t.(*types.Type).Alignment()%8 == 0 && !config.noDuffDevice
|
||||||
// result: (DUFFZERO [8 * (128 - int64(s/8))] ptr mem)
|
// result: (DUFFZERO [8 * (128 - s/8)] ptr mem)
|
||||||
for {
|
for {
|
||||||
s := v.AuxInt
|
s := v.AuxInt
|
||||||
t := v.Aux
|
t := v.Aux
|
||||||
|
|
@ -10430,7 +10430,7 @@ func rewriteValueMIPS64_OpZero_10(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpMIPS64DUFFZERO)
|
v.reset(OpMIPS64DUFFZERO)
|
||||||
v.AuxInt = 8 * (128 - int64(s/8))
|
v.AuxInt = 8 * (128 - s/8)
|
||||||
v.AddArg(ptr)
|
v.AddArg(ptr)
|
||||||
v.AddArg(mem)
|
v.AddArg(mem)
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -5805,7 +5805,7 @@ func rewriteValuePPC64_OpPPC64CMPU_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
func rewriteValuePPC64_OpPPC64CMPUconst_0(v *Value) bool {
|
func rewriteValuePPC64_OpPPC64CMPUconst_0(v *Value) bool {
|
||||||
// match: (CMPUconst (MOVDconst [x]) [y])
|
// match: (CMPUconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)==int64(y)
|
// cond: x==y
|
||||||
// result: (FlagEQ)
|
// result: (FlagEQ)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -5814,7 +5814,7 @@ func rewriteValuePPC64_OpPPC64CMPUconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) == int64(y)) {
|
if !(x == y) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpPPC64FlagEQ)
|
v.reset(OpPPC64FlagEQ)
|
||||||
|
|
@ -6112,7 +6112,7 @@ func rewriteValuePPC64_OpPPC64CMPWconst_0(v *Value) bool {
|
||||||
}
|
}
|
||||||
func rewriteValuePPC64_OpPPC64CMPconst_0(v *Value) bool {
|
func rewriteValuePPC64_OpPPC64CMPconst_0(v *Value) bool {
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)==int64(y)
|
// cond: x==y
|
||||||
// result: (FlagEQ)
|
// result: (FlagEQ)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -6121,14 +6121,14 @@ func rewriteValuePPC64_OpPPC64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) == int64(y)) {
|
if !(x == y) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpPPC64FlagEQ)
|
v.reset(OpPPC64FlagEQ)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)<int64(y)
|
// cond: x<y
|
||||||
// result: (FlagLT)
|
// result: (FlagLT)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -6137,14 +6137,14 @@ func rewriteValuePPC64_OpPPC64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) < int64(y)) {
|
if !(x < y) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpPPC64FlagLT)
|
v.reset(OpPPC64FlagLT)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match: (CMPconst (MOVDconst [x]) [y])
|
// match: (CMPconst (MOVDconst [x]) [y])
|
||||||
// cond: int64(x)>int64(y)
|
// cond: x>y
|
||||||
// result: (FlagGT)
|
// result: (FlagGT)
|
||||||
for {
|
for {
|
||||||
y := v.AuxInt
|
y := v.AuxInt
|
||||||
|
|
@ -6153,7 +6153,7 @@ func rewriteValuePPC64_OpPPC64CMPconst_0(v *Value) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x := v_0.AuxInt
|
x := v_0.AuxInt
|
||||||
if !(int64(x) > int64(y)) {
|
if !(x > y) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpPPC64FlagGT)
|
v.reset(OpPPC64FlagGT)
|
||||||
|
|
|
||||||
|
|
@ -622,7 +622,7 @@ func (pkg *Package) symbolDoc(symbol string) bool {
|
||||||
// This a standalone identifier, as in the case of iota usage.
|
// This a standalone identifier, as in the case of iota usage.
|
||||||
// Thus, assume the type comes from the previous type.
|
// Thus, assume the type comes from the previous type.
|
||||||
vspec.Type = &ast.Ident{
|
vspec.Type = &ast.Ident{
|
||||||
Name: string(pkg.oneLineNode(typ)),
|
Name: pkg.oneLineNode(typ),
|
||||||
NamePos: vspec.End() - 1,
|
NamePos: vspec.End() - 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ func readELF(name string, f *os.File, data []byte) (buildid string, err error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
off += notesz
|
off += notesz
|
||||||
align := uint64(p.Align)
|
align := p.Align
|
||||||
alignedOff := (off + align - 1) &^ (align - 1)
|
alignedOff := (off + align - 1) &^ (align - 1)
|
||||||
notesz += alignedOff - off
|
notesz += alignedOff - off
|
||||||
off = alignedOff
|
off = alignedOff
|
||||||
|
|
|
||||||
|
|
@ -776,7 +776,7 @@ func GetAbbrev() []byte {
|
||||||
// See section 7.5.3
|
// See section 7.5.3
|
||||||
buf = AppendUleb128(buf, uint64(i))
|
buf = AppendUleb128(buf, uint64(i))
|
||||||
buf = AppendUleb128(buf, uint64(abbrevs[i].tag))
|
buf = AppendUleb128(buf, uint64(abbrevs[i].tag))
|
||||||
buf = append(buf, byte(abbrevs[i].children))
|
buf = append(buf, abbrevs[i].children)
|
||||||
for _, f := range abbrevs[i].attr {
|
for _, f := range abbrevs[i].attr {
|
||||||
buf = AppendUleb128(buf, uint64(f.attr))
|
buf = AppendUleb128(buf, uint64(f.attr))
|
||||||
buf = AppendUleb128(buf, uint64(f.form))
|
buf = AppendUleb128(buf, uint64(f.form))
|
||||||
|
|
@ -1454,7 +1454,7 @@ func putvar(ctxt Context, s *FnState, v *Var, absfn Sym, fnabbrev, inlIndex int,
|
||||||
}
|
}
|
||||||
|
|
||||||
if abbrevUsesLoclist(abbrev) {
|
if abbrevUsesLoclist(abbrev) {
|
||||||
putattr(ctxt, s.Info, abbrev, DW_FORM_sec_offset, DW_CLS_PTR, int64(s.Loc.Len()), s.Loc)
|
putattr(ctxt, s.Info, abbrev, DW_FORM_sec_offset, DW_CLS_PTR, s.Loc.Len(), s.Loc)
|
||||||
v.PutLocationList(s.Loc, s.StartPC)
|
v.PutLocationList(s.Loc, s.StartPC)
|
||||||
} else {
|
} else {
|
||||||
loc := encbuf[:0]
|
loc := encbuf[:0]
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ func (r *objReader) parseObject(prefix []byte) error {
|
||||||
f.FuncData[i].Sym = r.readSymID()
|
f.FuncData[i].Sym = r.readSymID()
|
||||||
}
|
}
|
||||||
for i := range f.FuncData {
|
for i := range f.FuncData {
|
||||||
f.FuncData[i].Offset = int64(r.readInt()) // TODO
|
f.FuncData[i].Offset = r.readInt() // TODO
|
||||||
}
|
}
|
||||||
f.File = make([]string, r.readInt())
|
f.File = make([]string, r.readInt())
|
||||||
for i := range f.File {
|
for i := range f.File {
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
|
||||||
o := p.As
|
o := p.As
|
||||||
switch o {
|
switch o {
|
||||||
case obj.ATEXT:
|
case obj.ATEXT:
|
||||||
autosize = int32(autoffset)
|
autosize = autoffset
|
||||||
|
|
||||||
if p.Mark&LEAF != 0 && autosize == 0 {
|
if p.Mark&LEAF != 0 && autosize == 0 {
|
||||||
// A leaf function with no locals has no frame.
|
// A leaf function with no locals has no frame.
|
||||||
|
|
|
||||||
|
|
@ -861,7 +861,7 @@ func (c *ctxt7) addpool(p *obj.Prog, a *obj.Addr) {
|
||||||
// MOVD addr, REGTMP
|
// MOVD addr, REGTMP
|
||||||
// MOVD REGTMP, R
|
// MOVD REGTMP, R
|
||||||
// where addr is the address of the DWORD containing the address of foo.
|
// where addr is the address of the DWORD containing the address of foo.
|
||||||
if p.As == AMOVD && a.Type != obj.TYPE_MEM || cls == C_ADDR || cls == C_VCON || int64(lit) != int64(int32(lit)) || uint64(lit) != uint64(uint32(lit)) {
|
if p.As == AMOVD && a.Type != obj.TYPE_MEM || cls == C_ADDR || cls == C_VCON || lit != int64(int32(lit)) || uint64(lit) != uint64(uint32(lit)) {
|
||||||
// conservative: don't know if we want signed or unsigned extension.
|
// conservative: don't know if we want signed or unsigned extension.
|
||||||
// in case of ambiguity, store 64-bit
|
// in case of ambiguity, store 64-bit
|
||||||
t.As = ADWORD
|
t.As = ADWORD
|
||||||
|
|
@ -2838,7 +2838,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
||||||
if v == 0 {
|
if v == 0 {
|
||||||
c.ctxt.Diag("illegal system register:\n%v", p)
|
c.ctxt.Diag("illegal system register:\n%v", p)
|
||||||
}
|
}
|
||||||
if (o1 & uint32(v&^(3<<19))) != 0 {
|
if (o1 & (v &^ (3 << 19))) != 0 {
|
||||||
c.ctxt.Diag("MRS register value overlap\n%v", p)
|
c.ctxt.Diag("MRS register value overlap\n%v", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2858,7 +2858,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
||||||
if v == 0 {
|
if v == 0 {
|
||||||
c.ctxt.Diag("illegal system register:\n%v", p)
|
c.ctxt.Diag("illegal system register:\n%v", p)
|
||||||
}
|
}
|
||||||
if (o1 & uint32(v&^(3<<19))) != 0 {
|
if (o1 & (v &^ (3 << 19))) != 0 {
|
||||||
c.ctxt.Diag("MSR register value overlap\n%v", p)
|
c.ctxt.Diag("MSR register value overlap\n%v", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3360,7 +3360,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
||||||
size = 2
|
size = 2
|
||||||
} else if p.As == AVAND || p.As == AVEOR {
|
} else if p.As == AVAND || p.As == AVEOR {
|
||||||
size = 0
|
size = 0
|
||||||
} else if (p.As == AVFMLA || p.As == AVFMLS) {
|
} else if p.As == AVFMLA || p.As == AVFMLS {
|
||||||
if af == ARNG_2D {
|
if af == ARNG_2D {
|
||||||
size = 1
|
size = 1
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3512,7 +3512,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
||||||
rt := int(p.To.Reg)
|
rt := int(p.To.Reg)
|
||||||
imm5 := 0
|
imm5 := 0
|
||||||
o1 = 1<<30 | 7<<25 | 7<<10
|
o1 = 1<<30 | 7<<25 | 7<<10
|
||||||
index :=int(p.From.Index)
|
index := int(p.From.Index)
|
||||||
switch (p.To.Reg >> 5) & 15 {
|
switch (p.To.Reg >> 5) & 15 {
|
||||||
case ARNG_B:
|
case ARNG_B:
|
||||||
c.checkindex(p, index, 15)
|
c.checkindex(p, index, 15)
|
||||||
|
|
@ -3662,7 +3662,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
||||||
default:
|
default:
|
||||||
c.ctxt.Diag("invalid arrangement on VMOV Rn, Vd.<T>: %v\n", p)
|
c.ctxt.Diag("invalid arrangement on VMOV Rn, Vd.<T>: %v\n", p)
|
||||||
}
|
}
|
||||||
o1 |= (uint32(Q&1) << 30) | (uint32(imm5&0x1f) << 16)
|
o1 |= (Q & 1 << 30) | (imm5 & 0x1f << 16)
|
||||||
o1 |= (uint32(rf&31) << 5) | uint32(rt&31)
|
o1 |= (uint32(rf&31) << 5) | uint32(rt&31)
|
||||||
|
|
||||||
case 83: /* vmov Vn.<T>, Vd.<T> */
|
case 83: /* vmov Vn.<T>, Vd.<T> */
|
||||||
|
|
@ -3883,7 +3883,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
o1 = c.opldrpp(p, p.As)
|
o1 = c.opldrpp(p, p.As)
|
||||||
o1 |= (uint32(r&31) << 5) | (uint32((imm>>3)&0xfff) << 10) | (uint32(v & 31))
|
o1 |= (uint32(r&31) << 5) | ((imm >> 3) & 0xfff << 10) | (v & 31)
|
||||||
|
|
||||||
}
|
}
|
||||||
out[0] = o1
|
out[0] = o1
|
||||||
|
|
|
||||||
|
|
@ -524,7 +524,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
|
||||||
q.To.Type = obj.TYPE_MEM
|
q.To.Type = obj.TYPE_MEM
|
||||||
q.To.Offset = int64(-autosize)
|
q.To.Offset = int64(-autosize)
|
||||||
q.To.Reg = REGSP
|
q.To.Reg = REGSP
|
||||||
q.Spadj = int32(autosize)
|
q.Spadj = autosize
|
||||||
} else {
|
} else {
|
||||||
// Frame size is too large for a MOVDU instruction.
|
// Frame size is too large for a MOVDU instruction.
|
||||||
// Store link register before decrementing SP, so if a signal comes
|
// Store link register before decrementing SP, so if a signal comes
|
||||||
|
|
|
||||||
|
|
@ -3930,7 +3930,7 @@ func (asmbuf *AsmBuf) doasm(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog) {
|
||||||
} else {
|
} else {
|
||||||
regnum &= byte(p.GetFrom3().Reg - REG_Y0)
|
regnum &= byte(p.GetFrom3().Reg - REG_Y0)
|
||||||
}
|
}
|
||||||
asmbuf.Put1(byte(o.op[z+2]) | regnum)
|
asmbuf.Put1(o.op[z+2] | regnum)
|
||||||
asmbuf.Put1(byte(p.From.Offset))
|
asmbuf.Put1(byte(p.From.Offset))
|
||||||
|
|
||||||
case Zvex_i_rm_v_r:
|
case Zvex_i_rm_v_r:
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ func (f *goobjFile) symbols() ([]Sym, error) {
|
||||||
var syms []Sym
|
var syms []Sym
|
||||||
for _, s := range f.goobj.Syms {
|
for _, s := range f.goobj.Syms {
|
||||||
seen[s.SymID] = true
|
seen[s.SymID] = true
|
||||||
sym := Sym{Addr: uint64(s.Data.Offset), Name: goobjName(s.SymID), Size: int64(s.Size), Type: s.Type.Name, Code: '?'}
|
sym := Sym{Addr: uint64(s.Data.Offset), Name: goobjName(s.SymID), Size: s.Size, Type: s.Type.Name, Code: '?'}
|
||||||
switch s.Kind {
|
switch s.Kind {
|
||||||
case objabi.STEXT:
|
case objabi.STEXT:
|
||||||
sym.Code = 'T'
|
sym.Code = 'T'
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,7 @@ func trampoline(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol) {
|
||||||
func gentramp(arch *sys.Arch, linkmode ld.LinkMode, tramp, target *sym.Symbol, offset int64) {
|
func gentramp(arch *sys.Arch, linkmode ld.LinkMode, tramp, target *sym.Symbol, offset int64) {
|
||||||
tramp.Size = 12 // 3 instructions
|
tramp.Size = 12 // 3 instructions
|
||||||
tramp.P = make([]byte, tramp.Size)
|
tramp.P = make([]byte, tramp.Size)
|
||||||
t := ld.Symaddr(target) + int64(offset)
|
t := ld.Symaddr(target) + offset
|
||||||
o1 := uint32(0xe5900000 | 11<<12 | 15<<16) // MOVW (R15), R11 // R15 is actual pc + 8
|
o1 := uint32(0xe5900000 | 11<<12 | 15<<16) // MOVW (R15), R11 // R15 is actual pc + 8
|
||||||
o2 := uint32(0xe12fff10 | 11) // JMP (R11)
|
o2 := uint32(0xe12fff10 | 11) // JMP (R11)
|
||||||
o3 := uint32(t) // WORD $target
|
o3 := uint32(t) // WORD $target
|
||||||
|
|
@ -538,8 +538,8 @@ func gentrampdyn(arch *sys.Arch, tramp, target *sym.Symbol, offset int64) {
|
||||||
tramp.Size = 24 // 6 instructions
|
tramp.Size = 24 // 6 instructions
|
||||||
o6 = o5
|
o6 = o5
|
||||||
o5 = o4
|
o5 = o4
|
||||||
o4 = uint32(0xe2800000 | 11<<12 | 11<<16 | immrot(uint32(offset))) // ADD $offset, R11, R11
|
o4 = 0xe2800000 | 11<<12 | 11<<16 | immrot(uint32(offset)) // ADD $offset, R11, R11
|
||||||
o1 = uint32(0xe5900000 | 11<<12 | 15<<16 | 12) // MOVW 12(R15), R11
|
o1 = uint32(0xe5900000 | 11<<12 | 15<<16 | 12) // MOVW 12(R15), R11
|
||||||
}
|
}
|
||||||
tramp.P = make([]byte, tramp.Size)
|
tramp.P = make([]byte, tramp.Size)
|
||||||
arch.ByteOrder.PutUint32(tramp.P, o1)
|
arch.ByteOrder.PutUint32(tramp.P, o1)
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
|
||||||
o -= int64(r.Off) // relative to section offset, not symbol
|
o -= int64(r.Off) // relative to section offset, not symbol
|
||||||
} else if ctxt.Arch.Family == sys.ARM {
|
} else if ctxt.Arch.Family == sys.ARM {
|
||||||
// see ../arm/asm.go:/machoreloc1
|
// see ../arm/asm.go:/machoreloc1
|
||||||
o += Symaddr(rs) - int64(s.Value) - int64(r.Off)
|
o += Symaddr(rs) - s.Value - int64(r.Off)
|
||||||
} else {
|
} else {
|
||||||
o += int64(r.Siz)
|
o += int64(r.Siz)
|
||||||
}
|
}
|
||||||
|
|
@ -2006,7 +2006,7 @@ func (ctxt *Link) address() {
|
||||||
Segdwarf.Fileoff = Segdata.Fileoff + uint64(Rnd(int64(Segdata.Filelen), int64(*FlagRound)))
|
Segdwarf.Fileoff = Segdata.Fileoff + uint64(Rnd(int64(Segdata.Filelen), int64(*FlagRound)))
|
||||||
Segdwarf.Filelen = 0
|
Segdwarf.Filelen = 0
|
||||||
if ctxt.HeadType == objabi.Hwindows {
|
if ctxt.HeadType == objabi.Hwindows {
|
||||||
Segdwarf.Fileoff = Segdata.Fileoff + uint64(Rnd(int64(Segdata.Filelen), int64(PEFILEALIGN)))
|
Segdwarf.Fileoff = Segdata.Fileoff + uint64(Rnd(int64(Segdata.Filelen), PEFILEALIGN))
|
||||||
}
|
}
|
||||||
for i, s := range Segdwarf.Sections {
|
for i, s := range Segdwarf.Sections {
|
||||||
vlen := int64(s.Length)
|
vlen := int64(s.Length)
|
||||||
|
|
|
||||||
|
|
@ -1013,7 +1013,7 @@ func putpclcdelta(linkctxt *Link, ctxt dwarf.Context, s *sym.Symbol, deltaPC uin
|
||||||
|
|
||||||
// Subtract from deltaPC and deltaLC the amounts that the opcode will add.
|
// Subtract from deltaPC and deltaLC the amounts that the opcode will add.
|
||||||
deltaPC -= uint64((opcode - OPCODE_BASE) / LINE_RANGE)
|
deltaPC -= uint64((opcode - OPCODE_BASE) / LINE_RANGE)
|
||||||
deltaLC -= int64((opcode-OPCODE_BASE)%LINE_RANGE + LINE_BASE)
|
deltaLC -= (opcode-OPCODE_BASE)%LINE_RANGE + LINE_BASE
|
||||||
|
|
||||||
// Encode deltaPC.
|
// Encode deltaPC.
|
||||||
if deltaPC != 0 {
|
if deltaPC != 0 {
|
||||||
|
|
|
||||||
|
|
@ -575,7 +575,7 @@ func trampoline(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol) {
|
||||||
ld.Errorf(s, "unexpected trampoline for shared or dynamic linking\n")
|
ld.Errorf(s, "unexpected trampoline for shared or dynamic linking\n")
|
||||||
} else {
|
} else {
|
||||||
ctxt.AddTramp(tramp)
|
ctxt.AddTramp(tramp)
|
||||||
gentramp(ctxt.Arch, ctxt.LinkMode, tramp, r.Sym, int64(r.Add))
|
gentramp(ctxt.Arch, ctxt.LinkMode, tramp, r.Sym, r.Add)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.Sym = tramp
|
r.Sym = tramp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue