// Copyright 2025 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.

//go:build goexperiment.simd && amd64

package test_helpers

import (
	
	
)

type signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type float interface {
	~float32 | ~float64
}

type number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64
}

func [ number]( *testing.T, ,  []) bool {
	.Helper()
	return CheckSlicesLogInput[](, , , 0.0, nil)
}

// CheckSlices compares two slices for equality,
// reporting a test error if there is a problem,
// and also consumes the two slices so that a
// test/benchmark won't be dead-code eliminated.
func [ number]( *testing.T, ,  [],  float64,  func()) bool {
	.Helper()
	var  
	for  := range  {
		if [] != [] {
			var  any = []
			var  any = []
			switch x := .(type) {
			case float32:
				 := .(float32)
				if math.IsNaN(float64()) && math.IsNaN(float64()) {
					continue
				}
				if  > 0 {
					if  == 0 {
						if math.Abs(float64()) <  {
							continue
						}
					} else {
						if math.Abs(float64((-)/)) <  {
							continue
						}
					}
				}
			case float64:
				 := .(float64)
				if math.IsNaN() && math.IsNaN() {
					continue
				}
				if  > 0 {
					if  == 0 {
						if math.Abs() <  {
							continue
						}
					} else if math.Abs((-)/) <  {
						continue
					}
				}

			default:
			}

			.Logf("For %T vector elements:", )
			.Logf("got =%v", )
			.Logf("want=%v", )
			if  != nil {
				()
			}
			.Errorf("at index %d, got=%v, want=%v", , [], [])
			return false
		} else if [] == 0 { // for floating point, 0.0 == -0.0 but a bitwise check can see the difference
			var  any = []
			var  any = []
			switch x := .(type) {
			case float32:
				 := .(float32)
				if math.Float32bits() != math.Float32bits() {
					.Logf("For %T vector elements:", )
					.Logf("got =%v", )
					.Logf("want=%v", )
					if  != nil {
						()
					}
					.Errorf("at index %d, different signs of zero", )
					return false
				}
			case float64:
				 := .(float64)
				if math.Float64bits() != math.Float64bits() {
					.Logf("For %T vector elements:", )
					.Logf("got =%v", )
					.Logf("want=%v", )
					if  != nil {
						()
					}
					.Errorf("at index %d, different signs of zero", )
					return false
				}
			default:
			}

		}
	}
	return true
}