Commit 22f60463 by Nicolas Capens

Simplify abstract value bitcasting.

Change-Id: I173d563cd3cd17cf90caf723f29a6c1da51103b5 Reviewed-on: https://swiftshader-review.googlesource.com/7872Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent cfc3e822
...@@ -2852,6 +2852,12 @@ namespace sw ...@@ -2852,6 +2852,12 @@ namespace sw
return ReinterpretCast<T>(RValue<S>(var)); return ReinterpretCast<T>(RValue<S>(var));
} }
template<class T>
RValue<T> As(Value *val)
{
return RValue<T>(Nucleus::createBitCast(val, T::getType()));
}
template<class T, class S> template<class T, class S>
RValue<T> As(RValue<S> val) RValue<T> As(RValue<S> val)
{ {
......
...@@ -3222,7 +3222,7 @@ namespace sw ...@@ -3222,7 +3222,7 @@ namespace sw
pack->addArg(y.value); pack->addArg(y.value);
::basicBlock->appendInst(pack); ::basicBlock->appendInst(pack);
return As<SByte8>(Swizzle(As<Int4>(RValue<Byte16>(V(result))), 0x88)); return As<SByte8>(Swizzle(As<Int4>(V(result)), 0x88));
} }
RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y) RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y)
...@@ -3535,7 +3535,7 @@ namespace sw ...@@ -3535,7 +3535,7 @@ namespace sw
pack->addArg(y.value); pack->addArg(y.value);
::basicBlock->appendInst(pack); ::basicBlock->appendInst(pack);
return As<Byte8>(Swizzle(As<Int4>(RValue<Byte16>(V(result))), 0x88)); return As<Byte8>(Swizzle(As<Int4>(V(result)), 0x88));
} }
Type *UShort4::getType() Type *UShort4::getType()
......
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