github.com/euank/go@v0.0.0-20160829210321-495514729181/src/cmd/compile/internal/ssa/regalloc_test.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ssa
     6  
     7  import "testing"
     8  
     9  func TestLiveControlOps(t *testing.T) {
    10  	c := testConfig(t)
    11  	f := Fun(c, "entry",
    12  		Bloc("entry",
    13  			Valu("mem", OpInitMem, TypeMem, 0, nil),
    14  			Valu("x", OpAMD64MOVLconst, TypeInt8, 1, nil),
    15  			Valu("y", OpAMD64MOVLconst, TypeInt8, 2, nil),
    16  			Valu("a", OpAMD64TESTB, TypeFlags, 0, nil, "x", "y"),
    17  			Valu("b", OpAMD64TESTB, TypeFlags, 0, nil, "y", "x"),
    18  			Eq("a", "if", "exit"),
    19  		),
    20  		Bloc("if",
    21  			Eq("b", "plain", "exit"),
    22  		),
    23  		Bloc("plain",
    24  			Goto("exit"),
    25  		),
    26  		Bloc("exit",
    27  			Exit("mem"),
    28  		),
    29  	)
    30  	flagalloc(f.f)
    31  	regalloc(f.f)
    32  	checkFunc(f.f)
    33  }