Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/jit/hwintrinsiccodegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,6 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)

case NI_SSE2_SetZeroVector128:
{
assert(baseType != TYP_FLOAT);
assert(baseType >= TYP_BYTE && baseType <= TYP_DOUBLE);
assert(op1 == nullptr);
assert(op2 == nullptr);
Expand Down
2 changes: 1 addition & 1 deletion src/jit/hwintrinsiclistxarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ HARDWARE_INTRINSIC(SSE2_Or, "Or",
HARDWARE_INTRINSIC(SSE2_PackSignedSaturate, "PackSignedSaturate", SSE2, -1, 16, 2, {INS_invalid, INS_invalid, INS_packsswb, INS_invalid, INS_packssdw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
HARDWARE_INTRINSIC(SSE2_PackUnsignedSaturate, "PackUnsignedSaturate", SSE2, -1, 16, 2, {INS_invalid, INS_invalid, INS_packuswb, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
HARDWARE_INTRINSIC(SSE2_SetScalarVector128, "SetScalarVector128", SSE2, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movsdsse2}, HW_Category_Helper, HW_Flag_MultiIns|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(SSE2_SetZeroVector128, "SetZeroVector128", SSE2, -1, 16, 0, {INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_invalid, INS_xorpd}, HW_Category_Helper, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(SSE2_SetZeroVector128, "SetZeroVector128", SSE2, -1, 16, 0, {INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_xorps, INS_xorpd}, HW_Category_Helper, HW_Flag_OneTypeGeneric|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(SSE2_SumAbsoluteDifferences, "SumAbsoluteDifferences", SSE2, -1, 16, 2, {INS_invalid, INS_psadbw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
HARDWARE_INTRINSIC(SSE2_ShiftLeftLogical, "ShiftLeftLogical", SSE2, -1, 16, 2, {INS_invalid, INS_invalid, INS_psllw, INS_psllw, INS_pslld, INS_pslld, INS_psllq, INS_psllq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_MaybeIMM|HW_Flag_NoJmpTableIMM|HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(SSE2_ShiftLeftLogical128BitLane, "ShiftLeftLogical128BitLane", SSE2, -1, 16, 2, {INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM)
Expand Down
23 changes: 23 additions & 0 deletions tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static unsafe int Main(string[] args)
if (Sse2.IsSupported)
{
using (var doubleTable = TestTableSse2<double>.Create(testsCount))
using (var floatTable = TestTableSse2<float>.Create(testsCount))
using (var longTable = TestTableSse2<long>.Create(testsCount))
using (var ulongTable = TestTableSse2<ulong>.Create(testsCount))
using (var intTable = TestTableSse2<int>.Create(testsCount))
Expand All @@ -38,6 +39,12 @@ static unsafe int Main(string[] args)
doubleTable.SetOutArray(result, i);
}

for (int i = 0; i < testsCount; i++)
{
Vector128<float> result = Sse2.SetZeroVector128<float>();
floatTable.SetOutArray(result, i);
}

for (int i = 0; i < testsCount; i++)
{
Vector128<long> result = Sse2.SetZeroVector128<long>();
Expand Down Expand Up @@ -94,6 +101,14 @@ static unsafe int Main(string[] args)
testResult = Fail;
}

CheckMethod<float> checkFloat = (float x, float y, float z, ref float a) => (a = BitwiseXor(x, x)) == z;

if (!floatTable.CheckResult(checkFloat))
{
PrintError(floatTable, methodUnderTestName, "(float x, float y, float z, ref float a) => (a = BitwiseXor(x, y)) == z", checkFloat);
testResult = Fail;
}

CheckMethod<long> checkLong = (long x, long y, long z, ref long a) => (a = x ^ x) == z;

if (!longTable.CheckResult(checkLong))
Expand Down Expand Up @@ -174,5 +189,13 @@ public static unsafe double BitwiseXor(double x, double y)
var longAnd = xUlong ^ yUlong;
return BitConverter.ToDouble(BitConverter.GetBytes(longAnd));
}

public static unsafe float BitwiseXor(float x, float y)
{
var xUint = BitConverter.ToUInt32(BitConverter.GetBytes(x));
var yUint = BitConverter.ToUInt32(BitConverter.GetBytes(y));
var intAnd = xUint ^ yUint;
return BitConverter.ToSingle(BitConverter.GetBytes(intAnd));
}
}
}