public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse2.CompareScalarOrderedLessThan(_fld1, _fld2); ValidateResult(_fld1, _fld2, result); }
public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse2.CompareScalarOrderedLessThan(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); }
public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new BooleanBinaryOpTest__CompareScalarOrderedLessThanBoolean(); var result = Sse2.CompareScalarOrderedLessThan(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); }
public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Double *)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadAlignedVector128((Double *)(_dataTable.inArray2Ptr)); var result = Sse2.CompareScalarOrderedLessThan(op1, op2); ValidateResult(op1, op2, result); }
public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var left = Sse2.LoadVector128((Double *)(_dataTable.inArray1Ptr)); var right = Sse2.LoadVector128((Double *)(_dataTable.inArray2Ptr)); var result = Sse2.CompareScalarOrderedLessThan(left, right); ValidateResult(left, right, result); }
public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read <Vector128 <Double> >(_dataTable.inArray1Ptr); var op2 = Unsafe.Read <Vector128 <Double> >(_dataTable.inArray2Ptr); var result = Sse2.CompareScalarOrderedLessThan(op1, op2); ValidateResult(op1, op2, result); }
public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse2.CompareScalarOrderedLessThan( Sse2.LoadVector128((Double *)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Double *)(_dataTable.inArray2Ptr)) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); }
public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse2.CompareScalarOrderedLessThan( Unsafe.Read <Vector128 <Double> >(_dataTable.inArray1Ptr), Unsafe.Read <Vector128 <Double> >(_dataTable.inArray2Ptr) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); }
public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Sse2.CompareScalarOrderedLessThan( Sse2.LoadVector128((Double *)(&test._fld1)), Sse2.LoadVector128((Double *)(&test._fld2)) ); ValidateResult(test._fld1, test._fld2, result); }
public void RunStructFldScenario_Load(BooleanBinaryOpTest__CompareScalarOrderedLessThanBoolean testClass) { fixed(Vector128 <Double> *pFld1 = &_fld1) fixed(Vector128 <Double> *pFld2 = &_fld2) { var result = Sse2.CompareScalarOrderedLessThan( Sse2.LoadVector128((Double *)(pFld1)), Sse2.LoadVector128((Double *)(pFld2)) ); testClass.ValidateResult(_fld1, _fld2, result); } }
public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed(Vector128 <Double> *pFld1 = &_fld1) fixed(Vector128 <Double> *pFld2 = &_fld2) { var result = Sse2.CompareScalarOrderedLessThan( Sse2.LoadVector128((Double *)(pFld1)), Sse2.LoadVector128((Double *)(pFld2)) ); ValidateResult(_fld1, _fld2, result); } }
public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new BooleanBinaryOpTest__CompareScalarOrderedLessThanBoolean(); fixed(Vector128 <Double> *pFld1 = &test._fld1) fixed(Vector128 <Double> *pFld2 = &test._fld2) { var result = Sse2.CompareScalarOrderedLessThan( Sse2.LoadVector128((Double *)(pFld1)), Sse2.LoadVector128((Double *)(pFld2)) ); ValidateResult(test._fld1, test._fld2, result); } }
public (double near, double far) IntersectAVX(Ray ray) { Vector256 <double> origin = (Vector256 <double>)ray.Origin; Vector256 <double> direction = (Vector256 <double>)ray.Direction; Vector256 <double> zeroes = new Vector256 <double>(); Vector256 <double> min = (Vector256 <double>)Minimum; Vector256 <double> max = (Vector256 <double>)Maximum; // Replace slabs that won't be checked (0 direction axis) with infinity so that NaN doesn't propagate Vector256 <double> dirInfMask = Avx.And( Avx.Compare(direction, zeroes, FloatComparisonMode.OrderedEqualNonSignaling), Avx.And( Avx.Compare(origin, min, FloatComparisonMode.OrderedGreaterThanOrEqualNonSignaling), Avx.Compare(origin, max, FloatComparisonMode.OrderedLessThanOrEqualNonSignaling))); min = Avx.BlendVariable(min, SIMDHelpers.BroadcastScalar4(double.NegativeInfinity), dirInfMask); max = Avx.BlendVariable(max, SIMDHelpers.BroadcastScalar4(double.PositiveInfinity), dirInfMask); // Flip slabs in direction axes that are negative (using direction as mask takes the most significant bit, the sign.. probably includes -0) Vector256 <double> minMasked = Avx.BlendVariable(min, max, direction); Vector256 <double> maxMasked = Avx.BlendVariable(max, min, direction); direction = Avx.Divide(Vector256.Create(1D), direction); Vector256 <double> near4 = Avx.Multiply(Avx.Subtract(minMasked, origin), direction); Vector256 <double> far4 = Avx.Multiply(Avx.Subtract(maxMasked, origin), direction); Vector128 <double> near2 = Sse2.Max(near4.GetLower(), near4.GetUpper()); near2 = Sse2.MaxScalar(near2, SIMDHelpers.Swap(near2)); Vector128 <double> far2 = Sse2.Min(far4.GetLower(), far4.GetUpper()); far2 = Sse2.MinScalar(far2, SIMDHelpers.Swap(far2)); if (Sse2.CompareScalarOrderedGreaterThan(near2, far2) | Sse2.CompareScalarOrderedLessThan(far2, new Vector128 <double>())) { return(double.NaN, double.NaN); } return(near2.ToScalar(), far2.ToScalar()); }
public void RunStructFldScenario(BooleanBinaryOpTest__CompareScalarOrderedLessThanBoolean testClass) { var result = Sse2.CompareScalarOrderedLessThan(_fld1, _fld2); testClass.ValidateResult(_fld1, _fld2, result); }