Source file src/simd/archsimd/_gen/sgutil/stableapi_test.go

     1  // Copyright 2026 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 sgutil
     6  
     7  import "testing"
     8  
     9  func TestNonSpecAPI(t *testing.T) {
    10  	tests := []struct {
    11  		pkg, recv, name string
    12  		want            bool
    13  	}{
    14  		{"archsimd", "", "X86Features", true},
    15  		{"archsimd", "", "X86", true},
    16  		{"archsimd", "", "ARM64", true},
    17  		{"archsimd", "X86Features", "AVX512", true},
    18  		{"archsimd", "ARM64Features", "SVE", true},
    19  		{"simd", "", "VectorBits", true},
    20  		{"simd", "", "Emulated", true},
    21  		{"simd", "Int8s", "ToArch", true},
    22  		{"simd", "Mask64s", "ToArch", true},
    23  		{"simd", "", "Float32sFromArch", true},
    24  
    25  		{"simd", "Int8x16", "ToArch", false}, // not a portable type
    26  		{"archsimd", "Int8s", "ToArch", false},
    27  		{"simd", "", "Int8x16FromArch", false},
    28  		{"simd", "", "FromArch", false},
    29  		{"simd", "Int8s", "FromArch", false},
    30  		{"simd", "", "X86", false},
    31  		{"archsimd", "", "VectorBits", false},
    32  		{"archsimd", "Int32x8", "Merge", false}, // deprecated, not GA
    33  		{"simd", "", "VectorBitSize", false},    // deprecated, not GA
    34  		{"archsimd", "", "ClearAVXUpperBits", false},
    35  	}
    36  	for _, tt := range tests {
    37  		if got := NonSpecAPI(tt.pkg, tt.recv, tt.name); got != tt.want {
    38  			t.Errorf("NonSpecAPI(%q, %q, %q) = %v, want %v", tt.pkg, tt.recv, tt.name, got, tt.want)
    39  		}
    40  	}
    41  }
    42  

View as plain text