Bug 1785: fix pround on x86 to use the same rounding mode as std::round.

This also adds pset1frombits helper to Packet[24]d.
Makes round ~45% slower for SSE: 1.65µs ± 1% before vs 2.45µs ± 2% after,
stil an order of magnitude faster than scalar version: 33.8µs ± 2%.
This commit is contained in:
Ilya Tokar
2019-12-12 14:04:56 -05:00
parent 73a8d572f5
commit 06e99aaf40
3 changed files with 35 additions and 5 deletions

View File

@@ -518,6 +518,14 @@ template<typename Scalar,typename Packet> void packetmath_real()
CHECK_CWISE1_IF(PacketTraits::HasCeil, numext::ceil, internal::pceil);
CHECK_CWISE1_IF(PacketTraits::HasFloor, numext::floor, internal::pfloor);
// See bug 1785.
for (int i=0; i<size; ++i)
{
data1[i] = -1.5 + i;
data2[i] = -1.5 + i;
}
CHECK_CWISE1_IF(PacketTraits::HasRound, numext::round, internal::pround);
for (int i=0; i<size; ++i)
{
data1[i] = internal::random<Scalar>(-1,1);