OSDN Git Service

Remove the Long2 type.
authorNicolas Capens <capn@google.com>
Thu, 20 Oct 2016 05:11:47 +0000 (01:11 -0400)
committerNicolas Capens <capn@google.com>
Thu, 1 Dec 2016 17:11:49 +0000 (17:11 +0000)
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>
src/Reactor/LLVMReactor.cpp
src/Reactor/Reactor.hpp
src/Reactor/SubzeroReactor.cpp

index 891d38e..91defcb 100644 (file)
@@ -2654,7 +2654,7 @@ namespace sw
                        }
 
                        #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 @@ namespace sw
                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 @@ namespace sw
                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 @@ namespace sw
                }
        }
 
-       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 @@ namespace sw
 
        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 @@ namespace sw
 
        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 @@ namespace sw
 
        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 @@ namespace sw
                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 @@ namespace sw
                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 @@ namespace sw
        {
        //      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 @@ namespace sw
 
                //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()));
index 79433f5..c0e2394 100644 (file)
@@ -48,7 +48,6 @@ namespace sw
        class UInt4;
        class Long;
        class Long1;
-       class Long2;
        class Float;
        class Float2;
        class Float4;
@@ -1193,69 +1192,6 @@ namespace sw
 
 //     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:
index 6d3cff5..11ffaf2 100644 (file)
@@ -4031,16 +4031,6 @@ namespace sw
                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 @@ namespace sw
 
        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 @@ namespace sw
 
        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()