]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove likely bits from generated assembly
authorKeith Randall <khr@golang.org>
Sat, 25 Mar 2017 23:55:42 +0000 (16:55 -0700)
committerKeith Randall <khr@golang.org>
Sun, 26 Mar 2017 04:40:20 +0000 (04:40 +0000)
We don't need them any more since #15837 was fixed.

Fixes #19718

Change-Id: I13e46c62b321b2c9265f44c977b63bfb23163ca2
Reviewed-on: https://go-review.googlesource.com/38664
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/amd64/ssa.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ppc64/ssa.go
src/cmd/compile/internal/s390x/ssa.go
src/cmd/compile/internal/x86/ssa.go

index df99e9e3e05c22ec43aeb721ac481deb8ba62dfb..20fc49c926ff8c24289ea817c928e9f1ed2a5b37 100644 (file)
@@ -956,12 +956,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                ssa.BlockAMD64ULT, ssa.BlockAMD64UGT,
                ssa.BlockAMD64ULE, ssa.BlockAMD64UGE:
                jmp := blockJump[b.Kind]
-               likely := b.Likely
                var p *obj.Prog
                switch next {
                case b.Succs[0].Block():
                        p = s.Prog(jmp.invasm)
-                       likely *= -1
                        p.To.Type = obj.TYPE_BRANCH
                        s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
                case b.Succs[1].Block():
@@ -977,19 +975,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                        s.Branches = append(s.Branches, gc.Branch{P: q, B: b.Succs[1].Block()})
                }
 
-               // liblink reorders the instruction stream as it sees fit.
-               // Pass along what we know so liblink can make use of it.
-               // TODO: Once we've fully switched to SSA,
-               // make liblink leave our output alone.
-               switch likely {
-               case ssa.BranchUnlikely:
-                       p.From.Type = obj.TYPE_CONST
-                       p.From.Offset = 0
-               case ssa.BranchLikely:
-                       p.From.Type = obj.TYPE_CONST
-                       p.From.Offset = 1
-               }
-
        default:
                b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
        }
index 5c932c786f1dc26be558e5b99308481cab579c31..23aa436543fa0b21c9faa8e4adffbcdefe44267a 100644 (file)
@@ -4419,40 +4419,24 @@ type FloatingEQNEJump struct {
        Index int
 }
 
-func (s *SSAGenState) oneFPJump(b *ssa.Block, jumps *FloatingEQNEJump, likely ssa.BranchPrediction) {
+func (s *SSAGenState) oneFPJump(b *ssa.Block, jumps *FloatingEQNEJump) {
        p := s.Prog(jumps.Jump)
        p.To.Type = obj.TYPE_BRANCH
        to := jumps.Index
        s.Branches = append(s.Branches, Branch{p, b.Succs[to].Block()})
-       if to == 1 {
-               likely = -likely
-       }
-       // liblink reorders the instruction stream as it sees fit.
-       // Pass along what we know so liblink can make use of it.
-       // TODO: Once we've fully switched to SSA,
-       // make liblink leave our output alone.
-       switch likely {
-       case ssa.BranchUnlikely:
-               p.From.Type = obj.TYPE_CONST
-               p.From.Offset = 0
-       case ssa.BranchLikely:
-               p.From.Type = obj.TYPE_CONST
-               p.From.Offset = 1
-       }
 }
 
 func (s *SSAGenState) FPJump(b, next *ssa.Block, jumps *[2][2]FloatingEQNEJump) {
-       likely := b.Likely
        switch next {
        case b.Succs[0].Block():
-               s.oneFPJump(b, &jumps[0][0], likely)
-               s.oneFPJump(b, &jumps[0][1], likely)
+               s.oneFPJump(b, &jumps[0][0])
+               s.oneFPJump(b, &jumps[0][1])
        case b.Succs[1].Block():
-               s.oneFPJump(b, &jumps[1][0], likely)
-               s.oneFPJump(b, &jumps[1][1], likely)
+               s.oneFPJump(b, &jumps[1][0])
+               s.oneFPJump(b, &jumps[1][1])
        default:
-               s.oneFPJump(b, &jumps[1][0], likely)
-               s.oneFPJump(b, &jumps[1][1], likely)
+               s.oneFPJump(b, &jumps[1][0])
+               s.oneFPJump(b, &jumps[1][1])
                q := s.Prog(obj.AJMP)
                q.To.Type = obj.TYPE_BRANCH
                s.Branches = append(s.Branches, Branch{q, b.Succs[1].Block()})
index 2d7ea63a767ed4db31f9da397153f6e0ba4aa7ae..5f7b168ef76cf8fd0ba42b05e2784b936f4b3207 100644 (file)
@@ -1110,12 +1110,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                ssa.BlockPPC64FLT, ssa.BlockPPC64FGE,
                ssa.BlockPPC64FLE, ssa.BlockPPC64FGT:
                jmp := blockJump[b.Kind]
-               likely := b.Likely
                var p *obj.Prog
                switch next {
                case b.Succs[0].Block():
                        p = s.Prog(jmp.invasm)
-                       likely *= -1
                        p.To.Type = obj.TYPE_BRANCH
                        s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
                        if jmp.invasmun {
@@ -1147,19 +1145,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                        s.Branches = append(s.Branches, gc.Branch{P: q, B: b.Succs[1].Block()})
                }
 
-               // liblink reorders the instruction stream as it sees fit.
-               // Pass along what we know so liblink can make use of it.
-               // TODO: Once we've fully switched to SSA,
-               // make liblink leave our output alone.
-               //switch likely {
-               //case ssa.BranchUnlikely:
-               //      p.From.Type = obj.TYPE_CONST
-               //      p.From.Offset = 0
-               //case ssa.BranchLikely:
-               //      p.From.Type = obj.TYPE_CONST
-               //      p.From.Offset = 1
-               //}
-
        default:
                b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
        }
index 422ac614ce4314e6afed947f7da2525aefca6602..3c26dc4f4e70f5b4c1e351ffdedc086194fa926a 100644 (file)
@@ -789,12 +789,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                ssa.BlockS390XLE, ssa.BlockS390XGT,
                ssa.BlockS390XGEF, ssa.BlockS390XGTF:
                jmp := blockJump[b.Kind]
-               likely := b.Likely
                var p *obj.Prog
                switch next {
                case b.Succs[0].Block():
                        p = s.Prog(jmp.invasm)
-                       likely *= -1
                        p.To.Type = obj.TYPE_BRANCH
                        s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
                case b.Succs[1].Block():
index 906534b4cfaf98ea730942e9534ac7109026499a..d11cf5cad7ad675b481db8197b1eb70919a3b1e4 100644 (file)
@@ -818,12 +818,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                ssa.Block386ULT, ssa.Block386UGT,
                ssa.Block386ULE, ssa.Block386UGE:
                jmp := blockJump[b.Kind]
-               likely := b.Likely
                var p *obj.Prog
                switch next {
                case b.Succs[0].Block():
                        p = s.Prog(jmp.invasm)
-                       likely *= -1
                        p.To.Type = obj.TYPE_BRANCH
                        s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
                case b.Succs[1].Block():
@@ -839,19 +837,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
                        s.Branches = append(s.Branches, gc.Branch{P: q, B: b.Succs[1].Block()})
                }
 
-               // liblink reorders the instruction stream as it sees fit.
-               // Pass along what we know so liblink can make use of it.
-               // TODO: Once we've fully switched to SSA,
-               // make liblink leave our output alone.
-               switch likely {
-               case ssa.BranchUnlikely:
-                       p.From.Type = obj.TYPE_CONST
-                       p.From.Offset = 0
-               case ssa.BranchLikely:
-                       p.From.Type = obj.TYPE_CONST
-                       p.From.Offset = 1
-               }
-
        default:
                b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
        }