Added missing NEON pcasts, update packetmath tests.

The NEON `pcast` operators are all implemented and tested for existing
packets. This requires adding a `pcast(a,b,c,d,e,f,g,h)` for casting
between `int64_t` and `int8_t` in `GenericPacketMath.h`.

Removed incorrect `HasHalfPacket`  definition for NEON's
`Packet2l`/`Packet2ul`.

Adjustments were also made to the `packetmath` tests. These include
- minor bug fixes for cast tests (i.e. 4:1 casts, only casting for
  packets that are vectorizable)
- added 8:1 cast tests
- random number generation
  - original had uninteresting 0 to 0 casts for many casts between
    floating-point and integers, and exhibited signed overflow
    undefined behavior

Tested:
```
$ aarch64-linux-gnu-g++ -static -I./ '-DEIGEN_TEST_PART_ALL=1' test/packetmath.cpp -o packetmath
$ adb push packetmath /data/local/tmp/
$ adb shell "/data/local/tmp/packetmath"
```
This commit is contained in:
Antonio Sanchez 2020-06-19 16:07:05 -07:00
parent 386d809bde
commit 03ebdf6acb
4 changed files with 1879 additions and 607 deletions

View File

@ -162,12 +162,17 @@ EIGEN_DEVICE_FUNC inline TgtPacket
pcast(const SrcPacket& a, const SrcPacket& /*b*/) {
return static_cast<TgtPacket>(a);
}
template <typename SrcPacket, typename TgtPacket>
EIGEN_DEVICE_FUNC inline TgtPacket
pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/) {
return static_cast<TgtPacket>(a);
}
template <typename SrcPacket, typename TgtPacket>
EIGEN_DEVICE_FUNC inline TgtPacket
pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/,
const SrcPacket& /*e*/, const SrcPacket& /*f*/, const SrcPacket& /*g*/, const SrcPacket& /*h*/) {
return static_cast<TgtPacket>(a);
}
/** \internal \returns reinterpret_cast<Target>(a) */
template <typename Target, typename Packet>

View File

@ -338,7 +338,7 @@ struct packet_traits<int64_t> : default_packet_traits
Vectorizable = 1,
AlignedOnScalar = 1,
size = 2,
HasHalfPacket = 1,
HasHalfPacket = 0,
HasCmp = 1,
HasAdd = 1,
@ -368,7 +368,7 @@ struct packet_traits<uint64_t> : default_packet_traits
Vectorizable = 1,
AlignedOnScalar = 1,
size = 2,
HasHalfPacket = 1,
HasHalfPacket = 0,
HasCmp = 1,
HasAdd = 1,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff