Fix __ordered and _unordered floating point functions for C++ target.

Fixes include adding "_float" and "_double" suffixes as appropriate as well
as providing a number of missing implementations.

This fixes a number of failures in the half* tests.
This commit is contained in:
Matt Pharr
2012-07-09 14:35:51 -07:00
parent 107669686c
commit bc7775aef2
6 changed files with 81 additions and 22 deletions

View File

@@ -686,7 +686,7 @@ CMP_OP(__vec32_f, float, float, __less_equal, <=)
CMP_OP(__vec32_f, float, float, __greater_than, >)
CMP_OP(__vec32_f, float, float, __greater_equal, >=)
static FORCEINLINE __vec32_i1 __ordered(__vec32_f a, __vec32_f b) {
static FORCEINLINE __vec32_i1 __ordered_float(__vec32_f a, __vec32_f b) {
__vec32_i1 ret;
ret.v = 0;
for (int i = 0; i < 32; ++i)
@@ -694,6 +694,14 @@ static FORCEINLINE __vec32_i1 __ordered(__vec32_f a, __vec32_f b) {
return ret;
}
static FORCEINLINE __vec32_i1 __unordered_float(__vec32_f a, __vec32_f b) {
__vec32_i1 ret;
ret.v = 0;
for (int i = 0; i < 32; ++i)
ret.v |= ((a.v[i] != a.v[i]) || (b.v[i] != b.v[i])) ? (1 << i) : 0;
return ret;
}
#if 0
case Instruction::FRem: intrinsic = "__frem"; break;
#endif
@@ -838,7 +846,7 @@ CMP_OP(__vec32_d, double, double, __less_equal, <=)
CMP_OP(__vec32_d, double, double, __greater_than, >)
CMP_OP(__vec32_d, double, double, __greater_equal, >=)
static FORCEINLINE __vec32_i1 __ordered(__vec32_d a, __vec32_d b) {
static FORCEINLINE __vec32_i1 __ordered_double(__vec32_d a, __vec32_d b) {
__vec32_i1 ret;
ret.v = 0;
for (int i = 0; i < 32; ++i)
@@ -846,6 +854,14 @@ static FORCEINLINE __vec32_i1 __ordered(__vec32_d a, __vec32_d b) {
return ret;
}
static FORCEINLINE __vec32_i1 __unordered_double(__vec32_d a, __vec32_d b) {
__vec32_i1 ret;
ret.v = 0;
for (int i = 0; i < 32; ++i)
ret.v |= ((a.v[i] != a.v[i]) || (b.v[i] != b.v[i])) ? (1 << i) : 0;
return ret;
}
#if 0
case Instruction::FRem: intrinsic = "__frem"; break;
#endif