1
2
3
4
5 package test
6
7 import (
8 "cmd/compile/internal/ssa"
9 "cmd/compile/internal/types"
10 "internal/buildcfg"
11 "testing"
12 )
13
14
15
16 func TestCanSSA(t *testing.T) {
17 i64 := types.Types[types.TINT64]
18 v128 := types.TypeVec128
19 s1 := mkstruct(i64, mkstruct(i64, i64, i64, i64))
20 if ssa.CanSSA(s1) {
21
22 t.Errorf("CanSSA(%v) returned true, expected false", s1)
23 }
24 a1 := types.NewArray(s1, 1)
25 if ssa.CanSSA(a1) {
26
27 t.Errorf("CanSSA(%v) returned true, expected false", a1)
28 }
29 if buildcfg.Experiment.SIMD {
30 s2 := mkstruct(v128, v128, v128, v128)
31 if !ssa.CanSSA(s2) {
32
33 t.Errorf("CanSSA(%v) returned false, expected true", s2)
34 }
35 a2 := types.NewArray(s2, 1)
36 if !ssa.CanSSA(a2) {
37
38 t.Errorf("CanSSA(%v) returned false, expected true", a2)
39 }
40 }
41 }
42
View as plain text