Skip to content

Commit

Permalink
[Arm64] Implement AbsoluteDifference hardware intrinsics (dotnet#1334)
Browse files Browse the repository at this point in the history
And use VecBinOpTest.template in AbsoluteCompare* tests to remove duplicated logic in validation
  • Loading branch information
echesakov authored Jan 9, 2020
1 parent 66621e7 commit 5c88019
Show file tree
Hide file tree
Showing 44 changed files with 8,336 additions and 168 deletions.
2 changes: 2 additions & 0 deletions src/coreclr/src/jit/hwintrinsiclistarm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ HARDWARE_INTRINSIC(AdvSimd, AbsoluteCompareGreaterThan, -
HARDWARE_INTRINSIC(AdvSimd, AbsoluteCompareGreaterThanOrEqual, -1, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_facge, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize)
HARDWARE_INTRINSIC(AdvSimd, AbsoluteCompareLessThan, -1, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_facgt, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize|HW_Flag_SpecialCodeGen)
HARDWARE_INTRINSIC(AdvSimd, AbsoluteCompareLessThanOrEqual, -1, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_facge, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize|HW_Flag_SpecialCodeGen)
HARDWARE_INTRINSIC(AdvSimd, AbsoluteDifference, -1, -1, 2, {INS_sabd, INS_uabd, INS_sabd, INS_uabd, INS_sabd, INS_uabd, INS_invalid, INS_invalid, INS_fabd, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize)
HARDWARE_INTRINSIC(AdvSimd, AbsScalar, -1, 8, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_fabs, INS_fabs}, HW_Category_SIMDScalar, HW_Flag_NoContainment)
HARDWARE_INTRINSIC(AdvSimd, Add, -1, -1, 2, {INS_add, INS_add, INS_add, INS_add, INS_add, INS_add, INS_add, INS_add, INS_fadd, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_Commutative|HW_Flag_UnfixedSIMDSize)
HARDWARE_INTRINSIC(AdvSimd, AddScalar, -1, 8, 2, {INS_add, INS_add, INS_add, INS_add, INS_add, INS_add, INS_add, INS_add, INS_fadd, INS_fadd}, HW_Category_SIMDScalar, HW_Flag_NoContainment|HW_Flag_Commutative)
Expand All @@ -79,6 +80,7 @@ HARDWARE_INTRINSIC(AdvSimd_Arm64, AbsoluteCompareGreaterThan, -
HARDWARE_INTRINSIC(AdvSimd_Arm64, AbsoluteCompareGreaterThanOrEqual, -1, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_facge}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize)
HARDWARE_INTRINSIC(AdvSimd_Arm64, AbsoluteCompareLessThan, -1, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_facgt}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize|HW_Flag_SpecialCodeGen)
HARDWARE_INTRINSIC(AdvSimd_Arm64, AbsoluteCompareLessThanOrEqual, -1, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_facge}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize|HW_Flag_SpecialCodeGen)
HARDWARE_INTRINSIC(AdvSimd_Arm64, AbsoluteDifference, -1, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_fabd}, HW_Category_SimpleSIMD, HW_Flag_NoContainment)
HARDWARE_INTRINSIC(AdvSimd_Arm64, AbsScalar, -1, 8, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_abs, INS_invalid, INS_invalid}, HW_Category_SIMDScalar, HW_Flag_NoContainment)
HARDWARE_INTRINSIC(AdvSimd_Arm64, Add, -1, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_fadd}, HW_Category_SIMDScalar, HW_Flag_NoContainment|HW_Flag_Commutative)
HARDWARE_INTRINSIC(AdvSimd_Arm64, AddAcross, -1, -1, 1, {INS_addv, INS_addv, INS_addv, INS_addv, INS_addv, INS_addv, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_UnfixedSIMDSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,12 @@ private void ValidateResult(Double[] left, Double[] right, Double[] result, [Cal
{
bool succeeded = true;

if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareGreaterThan(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0]))
for (var i = 0; i < RetElementCount; i++)
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareGreaterThan(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareGreaterThan(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
succeeded = false;
break;
}
succeeded = false;
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,12 @@ private void ValidateResult(Double[] left, Double[] right, Double[] result, [Cal
{
bool succeeded = true;

if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareGreaterThanOrEqual(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0]))
for (var i = 0; i < RetElementCount; i++)
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareGreaterThanOrEqual(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareGreaterThanOrEqual(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
succeeded = false;
break;
}
succeeded = false;
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,12 @@ private void ValidateResult(Double[] left, Double[] right, Double[] result, [Cal
{
bool succeeded = true;

if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareLessThan(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0]))
for (var i = 0; i < RetElementCount; i++)
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareLessThan(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareLessThan(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
succeeded = false;
break;
}
succeeded = false;
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,12 @@ private void ValidateResult(Double[] left, Double[] right, Double[] result, [Cal
{
bool succeeded = true;

if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareLessThanOrEqual(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0]))
for (var i = 0; i < RetElementCount; i++)
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareLessThanOrEqual(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
if (BitConverter.DoubleToInt64Bits(Helpers.AbsoluteCompareLessThanOrEqual(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i]))
{
succeeded = false;
break;
}
succeeded = false;
break;
}
}

Expand Down
Loading

0 comments on commit 5c88019

Please sign in to comment.