Commit 24c8cf09 by Nicolas Capens

Implement Int to Int4 conversion.

BUG=swiftshader:3 Change-Id: I114384fc0e25ee1f7874f726b85ef5bcaf01ed36 Reviewed-on: https://swiftshader-review.googlesource.com/6951Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 81519cfc
......@@ -5394,6 +5394,8 @@ namespace sw
Int4::Int4(RValue<Int2> lo, RValue<Int2> hi)
{
// xyzw.parent = this;
Value *loLong = Nucleus::createBitCast(lo.value, Long::getType());
Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType());
......@@ -5405,6 +5407,38 @@ namespace sw
storeValue(int4);
}
Int4::Int4(RValue<Int> rhs)
{
// xyzw.parent = this;
Value *vector = loadValue();
Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
Constant *swizzle[4];
swizzle[0] = Nucleus::createConstantInt(0);
swizzle[1] = Nucleus::createConstantInt(0);
swizzle[2] = Nucleus::createConstantInt(0);
swizzle[3] = Nucleus::createConstantInt(0);
Value *replicate = Nucleus::createShuffleVector(insert, UndefValue::get(Int4::getType()), Nucleus::createConstantVector(swizzle, 4));
storeValue(replicate);
}
Int4::Int4(const Int &rhs)
{
// xyzw.parent = this;
*this = RValue<Int>(rhs.loadValue());
}
Int4::Int4(const Reference<Int> &rhs)
{
// xyzw.parent = this;
*this = RValue<Int>(rhs.loadValue());
}
RValue<Int4> Int4::operator=(RValue<Int4> rhs) const
{
storeValue(rhs.value);
......
......@@ -1655,6 +1655,9 @@ namespace sw
Int4(const UInt4 &rhs);
Int4(const Reference<UInt4> &rhs);
Int4(RValue<Int2> lo, RValue<Int2> hi);
Int4(RValue<Int> rhs);
Int4(const Int &rhs);
Int4(const Reference<Int> &rhs);
RValue<Int4> operator=(RValue<Int4> rhs) const;
RValue<Int4> operator=(const Int4 &rhs) const;
......
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