Commit 67cc1af1 authored by isharipo's avatar isharipo Committed by Brad Fitzpatrick

cmd/internal/obj/x86: remove redundant code (fix TODO)

Special cases described in TODO comments are
fixed in https://golang.org/cl/6901.

One of those blocks was needed until old 6a assembler was removed.
This happened in https://golang.org/cl/12784.

Fixes #24734 (Also contains more details and reasoning)

Change-Id: If1f2f155d36ab236b16ae6f309a0716e00aa6371
Reviewed-on: https://go-review.googlesource.com/105156
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
parent c90e0504
......@@ -3739,7 +3739,7 @@ func regIndex(r int16) int {
// Reports errors via ctxt.
func avx2gatherValid(ctxt *obj.Link, p *obj.Prog) bool {
// If any pair of the index, mask, or destination registers
// are the same, this instruction results a #UD fault.
// are the same, illegal instruction trap (#UD) is triggered.
index := regIndex(p.GetFrom3().Index)
mask := regIndex(p.From.Reg)
dest := regIndex(p.To.Reg)
......@@ -3768,38 +3768,9 @@ func (ab *AsmBuf) doasm(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog) {
ab.Put1(byte(pre))
}
// TODO(rsc): This special case is for SHRQ $3, AX:DX,
// which encodes as SHRQ $32(DX*0), AX.
// Similarly SHRQ CX, AX:DX is really SHRQ CX(DX*0), AX.
// Change encoding generated by assemblers and compilers and remove.
if (p.From.Type == obj.TYPE_CONST || p.From.Type == obj.TYPE_REG) && p.From.Index != REG_NONE && p.From.Scale == 0 {
p.SetFrom3(obj.Addr{
Type: obj.TYPE_REG,
Reg: p.From.Index,
})
p.From.Index = 0
}
// TODO(rsc): This special case is for PINSRQ etc, CMPSD etc.
// Change encoding generated by assemblers and compilers (if any) and remove.
// Сhecks to warn about instruction/arguments combinations that
// will unconditionally trigger illegal instruction trap (#UD).
switch p.As {
case AIMUL3Q, APEXTRW, APINSRW, APINSRD, APINSRQ, APSHUFHW, APSHUFL, APSHUFW, ASHUFPD, ASHUFPS, AAESKEYGENASSIST, APSHUFD, APCLMULQDQ:
if p.From3Type() == obj.TYPE_NONE {
p.SetFrom3(p.From)
p.From = obj.Addr{}
p.From.Type = obj.TYPE_CONST
p.From.Offset = p.To.Offset
p.To.Offset = 0
}
case ACMPSD, ACMPSS, ACMPPS, ACMPPD:
if p.From3Type() == obj.TYPE_NONE {
p.SetFrom3(p.To)
p.To = obj.Addr{}
p.To.Type = obj.TYPE_CONST
p.To.Offset = p.GetFrom3().Offset
p.GetFrom3().Offset = 0
}
case AVGATHERDPD,
AVGATHERQPD,
AVGATHERDPS,
......
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