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// cmp_ssa.go tests compare simplification operations. 6package main 7 8import "testing" 9 10//go:noinline 11func eq_ssa(a int64) bool { 12 return 4+a == 10 13} 14 15//go:noinline 16func neq_ssa(a int64) bool { 17 return 10 != a+4 18} 19 20func testCmp(t *testing.T) { 21 if wanted, got := true, eq_ssa(6); wanted != got { 22 t.Errorf("eq_ssa: expected %v, got %v\n", wanted, got) 23 } 24 if wanted, got := false, eq_ssa(7); wanted != got { 25 t.Errorf("eq_ssa: expected %v, got %v\n", wanted, got) 26 } 27 if wanted, got := false, neq_ssa(6); wanted != got { 28 t.Errorf("neq_ssa: expected %v, got %v\n", wanted, got) 29 } 30 if wanted, got := true, neq_ssa(7); wanted != got { 31 t.Errorf("neq_ssa: expected %v, got %v\n", wanted, got) 32 } 33} 34 35func TestCmp(t *testing.T) { 36 testCmp(t) 37} 38