mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.simd] cmd/compile: test for int-to-mask conversion
Change-Id: If341cb2c25dc535cdebe6f539db3cab8917d5afe Reviewed-on: https://go-review.googlesource.com/c/go/+/689937 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
08bec02907
commit
f39711a03d
1 changed files with 16 additions and 0 deletions
|
|
@ -428,3 +428,19 @@ func TestBitMaskStore(t *testing.T) {
|
|||
t.Errorf("Result incorrect: want %b, got %b", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBitMaskFromBits(t *testing.T) {
|
||||
if !simd.HasAVX512() {
|
||||
t.Skip("Test requires HasAVX512, not available on this hardware")
|
||||
return
|
||||
}
|
||||
results := [2]int64{}
|
||||
want := [2]int64{0, 6}
|
||||
m := simd.Mask64x2FromBits(0b10)
|
||||
simd.LoadInt64x2Slice([]int64{1, 2}).AddMasked(simd.LoadInt64x2Slice([]int64{3, 4}), m).Store(&results)
|
||||
for i := range 2 {
|
||||
if results[i] != want[i] {
|
||||
t.Errorf("Result at %d incorrect: want %v, got %v", i, want[i], results[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue