2015-08-04 14:22:29 -07:00
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
package ssa
|
|
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
|
|
func TestLiveControlOps(t *testing.T) {
|
|
|
|
|
c := testConfig(t)
|
|
|
|
|
f := Fun(c, "entry",
|
|
|
|
|
Bloc("entry",
|
2016-01-31 11:39:39 -08:00
|
|
|
Valu("mem", OpInitMem, TypeMem, 0, nil),
|
2016-04-22 13:09:18 -07:00
|
|
|
Valu("x", OpAMD64MOVLconst, TypeInt8, 1, nil),
|
|
|
|
|
Valu("y", OpAMD64MOVLconst, TypeInt8, 2, nil),
|
2015-12-09 15:58:18 -08:00
|
|
|
Valu("a", OpAMD64TESTB, TypeFlags, 0, nil, "x", "y"),
|
|
|
|
|
Valu("b", OpAMD64TESTB, TypeFlags, 0, nil, "y", "x"),
|
|
|
|
|
Eq("a", "if", "exit"),
|
2015-08-04 14:22:29 -07:00
|
|
|
),
|
|
|
|
|
Bloc("if",
|
2015-12-09 15:58:18 -08:00
|
|
|
Eq("b", "plain", "exit"),
|
2015-08-04 14:22:29 -07:00
|
|
|
),
|
|
|
|
|
Bloc("plain",
|
|
|
|
|
Goto("exit"),
|
|
|
|
|
),
|
|
|
|
|
Bloc("exit",
|
|
|
|
|
Exit("mem"),
|
|
|
|
|
),
|
|
|
|
|
)
|
2015-12-09 15:58:18 -08:00
|
|
|
flagalloc(f.f)
|
2015-08-04 14:22:29 -07:00
|
|
|
regalloc(f.f)
|
|
|
|
|
checkFunc(f.f)
|
|
|
|
|
}
|