]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/x86: remove redundant code (fix TODO)
authorisharipo <iskander.sharipov@intel.com>
Fri, 6 Apr 2018 19:22:03 +0000 (22:22 +0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 9 Apr 2018 19:10:00 +0000 (19:10 +0000)
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: Cherry Zhang <cherryyz@google.com>
src/cmd/internal/obj/x86/asm6.go

index d817a89af7cf1f48d36d9cadcd5ae5f7c9cf4fb1..29a87d79a3866be5447db3e57deb9bb0d25f86ec 100644 (file)
@@ -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,