Skip to content

Commit

Permalink
Treat TZCNT/POPCNT/LZCNT as never negative (#64951)
Browse files Browse the repository at this point in the history
  • Loading branch information
trympet authored Feb 21, 2022
1 parent 2e353d1 commit dc99791
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,35 @@ bool IntegralRange::Contains(int64_t value) const
case GT_CAST:
return ForCastOutput(node->AsCast());

#if defined(FEATURE_HW_INTRINSICS)
case GT_HWINTRINSIC:
switch (node->AsHWIntrinsic()->GetHWIntrinsicId())
{
#if defined(TARGET_XARCH)
case NI_BMI1_TrailingZeroCount:
case NI_BMI1_X64_TrailingZeroCount:
case NI_LZCNT_LeadingZeroCount:
case NI_LZCNT_X64_LeadingZeroCount:
case NI_POPCNT_PopCount:
case NI_POPCNT_X64_PopCount:
#elif defined(TARGET_ARM64)
case NI_AdvSimd_PopCount:
case NI_AdvSimd_LeadingZeroCount:
case NI_AdvSimd_LeadingSignCount:
case NI_ArmBase_LeadingZeroCount:
case NI_ArmBase_Arm64_LeadingZeroCount:
case NI_ArmBase_Arm64_LeadingSignCount:
#else
#error Unsupported platform
#endif
// TODO-Casts: specify more precise ranges once "IntegralRange" supports them.
return {SymbolicIntegerValue::Zero, SymbolicIntegerValue::ByteMax};
default:
break;
}
break;
#endif // defined(FEATURE_HW_INTRINSICS)

default:
break;
}
Expand Down

0 comments on commit dc99791

Please sign in to comment.