Remove the Long2 type. Bug swiftshader:6 Change-Id: Idb083bd1aecedb529f4e15deda3a1cfcf95a5bfa Reviewed-on: https://swiftshader-review.googlesource.com/7753 Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Nicolas Capens <capn@google.com> Reviewed-on: https://swiftshader-review.googlesource.com/8133 Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index 891d38e..91defcb 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -2654,7 +2654,7 @@ } #if 0 // FIXME: No optimal instruction selection - Value *qword2 = Nucleus::createBitCast(packed, Long2::getType()); + Value *qword2 = Nucleus::createBitCast(packed, T(VectorType::get(Long::getType(), 2))); Value *element = Nucleus::createExtractElement(qword2, 0); Value *short4 = Nucleus::createBitCast(element, Short4::getType()); #else // FIXME: Requires SSE @@ -3478,7 +3478,7 @@ Value *loLong = Nucleus::createBitCast(lo.value, Long::getType()); Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType()); - Value *long2 = V(UndefValue::get(Long2::getType())); + Value *long2 = V(UndefValue::get(VectorType::get(Long::getType(), 2))); long2 = Nucleus::createInsertElement(long2, loLong, 0); long2 = Nucleus::createInsertElement(long2, hiLong, 1); Value *short8 = Nucleus::createBitCast(long2, Short8::getType()); @@ -3556,7 +3556,7 @@ Value *loLong = Nucleus::createBitCast(lo.value, Long::getType()); Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType()); - Value *long2 = V(UndefValue::get(Long2::getType())); + Value *long2 = V(UndefValue::get(VectorType::get(Long::getType(), 2))); long2 = Nucleus::createInsertElement(long2, loLong, 0); long2 = Nucleus::createInsertElement(long2, hiLong, 1); Value *short8 = Nucleus::createBitCast(long2, Short8::getType()); @@ -4121,19 +4121,6 @@ } } - RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y) - { - int shuffle[2] = {1, 3}; - Value *packed = Nucleus::createShuffleVector(x.value, y.value, shuffle); - - return RValue<Long2>(packed); - } - - Type *Long2::getType() - { - return T(VectorType::get(Long::getType(), 2)); - } - UInt::UInt(Argument<UInt> argument) { storeValue(argument.value); @@ -4492,7 +4479,7 @@ Int2::Int2(RValue<Int4> cast) { - Value *long2 = Nucleus::createBitCast(cast.value, Long2::getType()); + Value *long2 = Nucleus::createBitCast(cast.value, T(VectorType::get(Long::getType(), 2))); Value *element = Nucleus::createExtractElement(long2, Long::getType(), 0); Value *int2 = Nucleus::createBitCast(element, Int2::getType()); @@ -5155,7 +5142,7 @@ Int4::Int4(RValue<Short4> cast) { - Value *long2 = V(UndefValue::get(Long2::getType())); + Value *long2 = V(UndefValue::get(VectorType::get(Long::getType(), 2))); Value *element = Nucleus::createBitCast(cast.value, Long::getType()); long2 = Nucleus::createInsertElement(long2, element, 0); RValue<Int4> vector = RValue<Int4>(Nucleus::createBitCast(long2, Int4::getType())); @@ -5183,7 +5170,7 @@ Int4::Int4(RValue<UShort4> cast) { - Value *long2 = V(UndefValue::get(Long2::getType())); + Value *long2 = V(UndefValue::get(VectorType::get(Long::getType(), 2))); Value *element = Nucleus::createBitCast(cast.value, Long::getType()); long2 = Nucleus::createInsertElement(long2, element, 0); RValue<Int4> vector = RValue<Int4>(Nucleus::createBitCast(long2, Int4::getType())); @@ -5289,7 +5276,7 @@ Value *loLong = Nucleus::createBitCast(lo.value, Long::getType()); Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType()); - Value *long2 = V(UndefValue::get(Long2::getType())); + Value *long2 = V(UndefValue::get(VectorType::get(Long::getType(), 2))); long2 = Nucleus::createInsertElement(long2, loLong, 0); long2 = Nucleus::createInsertElement(long2, hiLong, 1); Value *int4 = Nucleus::createBitCast(long2, Int4::getType()); @@ -5677,7 +5664,7 @@ Value *loLong = Nucleus::createBitCast(lo.value, Long::getType()); Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType()); - Value *long2 = V(UndefValue::get(Long2::getType())); + Value *long2 = V(UndefValue::get(VectorType::get(Long::getType(), 2))); long2 = Nucleus::createInsertElement(long2, loLong, 0); long2 = Nucleus::createInsertElement(long2, hiLong, 1); Value *uint4 = Nucleus::createBitCast(long2, Int4::getType()); @@ -6153,7 +6140,7 @@ { // xyzw.parent = this; - Value *int64x2 = Nucleus::createBitCast(cast.value, Long2::getType()); + Value *int64x2 = Nucleus::createBitCast(cast.value, T(VectorType::get(Long::getType(), 2))); Value *int64 = Nucleus::createExtractElement(int64x2, Long::getType(), 0); Value *float2 = Nucleus::createBitCast(int64, Float2::getType()); @@ -7577,7 +7564,7 @@ //RValue<Int2> movdq2q(RValue<Int4> x) //{ - // Value *long2 = Nucleus::createBitCast(x.value, Long2::getType()); + // Value *long2 = Nucleus::createBitCast(x.value, T(VectorType::get(Long::getType(), 2))); // Value *element = Nucleus::createExtractElement(long2, ConstantInt::get(Int::getType(), 0)); // return RValue<Int2>(Nucleus::createBitCast(element, Int2::getType()));
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp index 79433f5..c0e2394 100644 --- a/src/Reactor/Reactor.hpp +++ b/src/Reactor/Reactor.hpp
@@ -48,7 +48,6 @@ class UInt4; class Long; class Long1; - class Long2; class Float; class Float2; class Float4; @@ -1193,69 +1192,6 @@ // RValue<Long1> RoundLong1(RValue<Float> cast); - class Long2 : public Variable<Long2> - { - public: - // explicit Long2(RValue<Long> cast); - // explicit Long2(RValue<Long1> cast); - - // Long2(); - // Long2(int x, int y); - // Long2(RValue<Long2> rhs); - // Long2(const Long2 &rhs); - // Long2(const Reference<Long2> &rhs); - - // RValue<Long2> operator=(RValue<Long2> rhs) const; - // RValue<Long2> operator=(const Long2 &rhs) const; - // RValue<Long2> operator=(const Reference<Long2 &rhs) const; - - static Type *getType(); - }; - -// RValue<Long2> operator+(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator-(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator*(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator/(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator%(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator&(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator|(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator^(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Long2> operator<<(RValue<Long2> lhs, unsigned char rhs); -// RValue<Long2> operator>>(RValue<Long2> lhs, unsigned char rhs); -// RValue<Long2> operator<<(RValue<Long2> lhs, RValue<Long1> rhs); -// RValue<Long2> operator>>(RValue<Long2> lhs, RValue<Long1> rhs); -// RValue<Long2> operator+=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator-=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator*=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator/=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator%=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator&=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator|=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator^=(const Long2 &lhs, RValue<Long2> rhs); -// RValue<Long2> operator<<=(const Long2 &lhs, unsigned char rhs); -// RValue<Long2> operator>>=(const Long2 &lhs, unsigned char rhs); -// RValue<Long2> operator<<=(const Long2 &lhs, RValue<Long1> rhs); -// RValue<Long2> operator>>=(const Long2 &lhs, RValue<Long1> rhs); -// RValue<Long2> operator+(RValue<Long2> val); -// RValue<Long2> operator-(RValue<Long2> val); -// RValue<Long2> operator~(RValue<Long2> val); -// RValue<Long2> operator++(const Long2 &val, int); // Post-increment -// const Long2 &operator++(const Long2 &val); // Pre-increment -// RValue<Long2> operator--(const Long2 &val, int); // Post-decrement -// const Long2 &operator--(const Long2 &val); // Pre-decrement -// RValue<Bool> operator<(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Bool> operator<=(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Bool> operator>(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Bool> operator>=(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Bool> operator!=(RValue<Long2> lhs, RValue<Long2> rhs); -// RValue<Bool> operator==(RValue<Long2> lhs, RValue<Long2> rhs); - -// RValue<Long2> RoundInt(RValue<Float4> cast); -// RValue<Long2> UnpackLow(RValue<Long2> x, RValue<Long2> y); - RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y); -// RValue<Int> Extract(RValue<Long2> val, int i); -// RValue<Long2> Insert(RValue<Long2> val, RValue<Int> element, int i); - class UInt : public Variable<UInt> { public:
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp index 6d3cff5..11ffaf2 100644 --- a/src/Reactor/SubzeroReactor.cpp +++ b/src/Reactor/SubzeroReactor.cpp
@@ -4031,16 +4031,6 @@ assert(false && "UNIMPLEMENTED"); return nullptr; } - RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y) - { - assert(false && "UNIMPLEMENTED"); return RValue<Long2>(V(nullptr)); - } - - Type *Long2::getType() - { - assert(false && "UNIMPLEMENTED"); return nullptr; - } - UInt::UInt(Argument<UInt> argument) { storeValue(argument.value); @@ -4370,11 +4360,7 @@ Int2::Int2(RValue<Int4> cast) { - Value *long2 = Nucleus::createBitCast(cast.value, Long2::getType()); - Value *element = Nucleus::createExtractElement(long2, Long2::getType(), 0); - Value *int2 = Nucleus::createBitCast(element, Int2::getType()); - - storeValue(int2); + storeValue(Nucleus::createBitCast(cast.value, getType())); } Int2::Int2() @@ -5644,13 +5630,7 @@ Float2::Float2(RValue<Float4> cast) { - // xyzw.parent = this; - - Value *int64x2 = Nucleus::createBitCast(cast.value, Long2::getType()); - Value *int64 = Nucleus::createExtractElement(int64x2, Long::getType(), 0); - Value *float2 = Nucleus::createBitCast(int64, Float2::getType()); - - storeValue(float2); + storeValue(Nucleus::createBitCast(cast.value, getType())); } Type *Float2::getType()