CompareGreaterThan, CompareGreaterThanOrEqual, CompareNotGreaterThan, and CompareNotGreaterThanOrEqual have incorrect implementations #34094
Labels
arch-x64
area-System.Runtime.Intrinsics
breaking-change
Issue or PR that represents a breaking API or functional change over a prerelease.
bug
As per the title, the following methods have incorrect implementations and won't handle NaN inputs correctly:
For pre-AVX hardware, there isn't a hardware comparison mode that performs the given operations and so they are currently being implemented using the inverse operation.
However, using the inverse operation (such as converting
GreaterThan
toNotLessThanOrEqual
) does not correctly handle the unordered relation (when one or both inputs isNaN
).These should instead be using a different inverse relation and swapping the operands. For example,
CompareGreaterThan(a, b)
should be emitted asCompareLessThan(b, a)
as native does and as recommended by the x86 instruction manual: https://godbolt.org/z/ghwY5NThe text was updated successfully, but these errors were encountered: