Commit 8427224b by Nicolas Capens

Implement vector absolute value.

Bug swiftshader:15 Change-Id: Ib22831ce669c68a790664839d18ea05668e90992 Reviewed-on: https://swiftshader-review.googlesource.com/7971Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-on: https://swiftshader-review.googlesource.com/8166Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent b98fe5cd
......@@ -3689,7 +3689,8 @@ namespace sw
RValue<Int4> Abs(RValue<Int4> x)
{
assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
auto negative = x >> 31;
return (x ^ negative) - negative;
}
RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y)
......@@ -6154,7 +6155,11 @@ namespace sw
RValue<Float4> Abs(RValue<Float4> x)
{
assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Value *vector = Nucleus::createBitCast(x.value, Int4::getType());
int64_t constantVector[4] = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
Value *result = Nucleus::createAnd(vector, V(Nucleus::createConstantVector(constantVector, Int4::getType())));
return As<Float4>(result);
}
RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment