Temporarily support xyzw component swizzling for SIMD types

Several places in the code currently make use of component swizzling,
even for code which should be SIMD width agnostic. To facilitate
transition to rr::SIMD types, this change temporarily adds support for
these operators.

Note that Swizzle(SIMD::*) has asserts for SIMD::Width == 4 so we get
reminded to remove this later.

Bug: b/214583550
Change-Id: I6ee5ea3a668eb63cab8ed0763c148ce4bbd90110
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66828
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index c5dbf12..cfe7004 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -4148,6 +4148,7 @@
 }
 
 SIMD::Int::Int(RValue<scalar::Int> rhs)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *vector = loadValue();
@@ -4279,6 +4280,7 @@
 }
 
 SIMD::UInt::UInt(RValue<SIMD::Float> cast)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *xyzw = Nucleus::createFPToUI(cast.value(), SIMD::UInt::type());
@@ -4286,6 +4288,7 @@
 }
 
 SIMD::UInt::UInt(RValue<scalar::UInt> rhs)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *vector = loadValue();
@@ -4380,6 +4383,7 @@
 }
 
 SIMD::Float::Float(RValue<scalar::Float> rhs)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *vector = loadValue();
diff --git a/src/Reactor/SIMD.cpp b/src/Reactor/SIMD.cpp
index bfeed07..11f636b 100644
--- a/src/Reactor/SIMD.cpp
+++ b/src/Reactor/SIMD.cpp
@@ -23,10 +23,12 @@
 namespace rr {
 
 SIMD::Int::Int()
+    : XYZW(this)
 {
 }
 
 SIMD::Int::Int(RValue<SIMD::Float> cast)
+    : XYZW(this)
 {
 	Value *xyzw = Nucleus::createFPToSI(cast.value(), SIMD::Int::type());
 
@@ -34,47 +36,56 @@
 }
 
 SIMD::Int::Int(int broadcast)
+    : XYZW(this)
 {
 	std::vector<int64_t> constantVector = { broadcast };
 	storeValue(Nucleus::createConstantVector(constantVector, type()));
 }
 
 SIMD::Int::Int(RValue<SIMD::Int> rhs)
+    : XYZW(this)
 {
 	store(rhs);
 }
 
 SIMD::Int::Int(const SIMD::Int &rhs)
+    : XYZW(this)
 {
 	store(rhs.load());
 }
 
 SIMD::Int::Int(const Reference<SIMD::Int> &rhs)
+    : XYZW(this)
 {
 	store(rhs.load());
 }
 
 SIMD::Int::Int(RValue<SIMD::UInt> rhs)
+    : XYZW(this)
 {
 	storeValue(rhs.value());
 }
 
 SIMD::Int::Int(const SIMD::UInt &rhs)
+    : XYZW(this)
 {
 	storeValue(rhs.loadValue());
 }
 
 SIMD::Int::Int(const Reference<SIMD::UInt> &rhs)
+    : XYZW(this)
 {
 	storeValue(rhs.loadValue());
 }
 
 SIMD::Int::Int(const scalar::Int &rhs)
+    : XYZW(this)
 {
 	*this = RValue<scalar::Int>(rhs.loadValue());
 }
 
 SIMD::Int::Int(const Reference<scalar::Int> &rhs)
+    : XYZW(this)
 {
 	*this = RValue<scalar::Int>(rhs.loadValue());
 }
@@ -225,51 +236,61 @@
 }
 
 SIMD::UInt::UInt()
+    : XYZW(this)
 {
 }
 
 SIMD::UInt::UInt(int broadcast)
+    : XYZW(this)
 {
 	std::vector<int64_t> constantVector = { broadcast };
 	storeValue(Nucleus::createConstantVector(constantVector, type()));
 }
 
 SIMD::UInt::UInt(RValue<SIMD::UInt> rhs)
+    : XYZW(this)
 {
 	store(rhs);
 }
 
 SIMD::UInt::UInt(const SIMD::UInt &rhs)
+    : XYZW(this)
 {
 	store(rhs.load());
 }
 
 SIMD::UInt::UInt(const Reference<SIMD::UInt> &rhs)
+    : XYZW(this)
 {
 	store(rhs.load());
 }
 
 SIMD::UInt::UInt(RValue<SIMD::Int> rhs)
+    : XYZW(this)
 {
 	storeValue(rhs.value());
 }
 
 SIMD::UInt::UInt(const SIMD::Int &rhs)
+    : XYZW(this)
 {
 	storeValue(rhs.loadValue());
 }
 
 SIMD::UInt::UInt(const Reference<SIMD::Int> &rhs)
+    : XYZW(this)
 {
 	storeValue(rhs.loadValue());
 }
 
 SIMD::UInt::UInt(const scalar::UInt &rhs)
+    : XYZW(this)
 {
 	*this = RValue<scalar::UInt>(rhs.loadValue());
 }
 
 SIMD::UInt::UInt(const Reference<scalar::UInt> &rhs)
+    : XYZW(this)
 {
 	*this = RValue<scalar::UInt>(rhs.loadValue());
 }
@@ -415,6 +436,7 @@
 }
 
 SIMD::Float::Float(RValue<SIMD::Int> cast)
+    : XYZW(this)
 {
 	Value *xyzw = Nucleus::createSIToFP(cast.value(), SIMD::Float::type());
 
@@ -422,6 +444,7 @@
 }
 
 SIMD::Float::Float(RValue<SIMD::UInt> cast)
+    : XYZW(this)
 {
 	RValue<SIMD::Float> result = SIMD::Float(SIMD::Int(cast & SIMD::UInt(0x7FFFFFFF))) +
 	                             As<SIMD::Float>((As<SIMD::Int>(cast) >> 31) & As<SIMD::Int>(SIMD::Float(0x80000000u)));
@@ -430,10 +453,12 @@
 }
 
 SIMD::Float::Float()
+    : XYZW(this)
 {
 }
 
 SIMD::Float::Float(float broadcast)
+    : XYZW(this)
 {
 	// See rr::Float(float) constructor for the rationale behind this assert.
 	ASSERT(std::isfinite(broadcast));
@@ -454,26 +479,31 @@
 }
 
 SIMD::Float::Float(RValue<SIMD::Float> rhs)
+    : XYZW(this)
 {
 	store(rhs);
 }
 
 SIMD::Float::Float(const SIMD::Float &rhs)
+    : XYZW(this)
 {
 	store(rhs.load());
 }
 
 SIMD::Float::Float(const Reference<SIMD::Float> &rhs)
+    : XYZW(this)
 {
 	store(rhs.load());
 }
 
 SIMD::Float::Float(const scalar::Float &rhs)
+    : XYZW(this)
 {
 	*this = RValue<scalar::Float>(rhs.loadValue());
 }
 
 SIMD::Float::Float(const Reference<scalar::Float> &rhs)
+    : XYZW(this)
 {
 	*this = RValue<scalar::Float>(rhs.loadValue());
 }
diff --git a/src/Reactor/SIMD.hpp b/src/Reactor/SIMD.hpp
index 8c5ddf6..c1d2783 100644
--- a/src/Reactor/SIMD.hpp
+++ b/src/Reactor/SIMD.hpp
@@ -41,7 +41,8 @@
 class UInt;
 class Float;
 
-class Int : public LValue<SIMD::Int>
+class Int : public LValue<SIMD::Int>,
+            public XYZW<SIMD::Int>  // TODO(b/214583550): Eliminate and replace with SwizzleQuad() and/or other intrinsics.
 {
 public:
 	explicit Int(RValue<SIMD::Float> cast);
@@ -67,7 +68,8 @@
 	static int element_count() { return SIMD::Width; }
 };
 
-class UInt : public LValue<SIMD::UInt>
+class UInt : public LValue<SIMD::UInt>,
+             public XYZW<SIMD::UInt>  // TODO(b/214583550): Eliminate and replace with SwizzleQuad() and/or other intrinsics.
 {
 public:
 	explicit UInt(RValue<SIMD::Float> cast);
@@ -92,7 +94,8 @@
 	static int element_count() { return SIMD::Width; }
 };
 
-class Float : public LValue<SIMD::Float>
+class Float : public LValue<SIMD::Float>,
+              public XYZW<SIMD::Float>  // TODO(b/214583550): Eliminate and replace with SwizzleQuad() and/or other intrinsics.
 {
 public:
 	explicit Float(RValue<SIMD::Int> cast);
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index 3f9e802..206e578 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -4733,6 +4733,7 @@
 }
 
 SIMD::Int::Int(RValue<scalar::Int> rhs)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *vector = Nucleus::createBitCast(rhs.value(), SIMD::Int::type());
@@ -4908,6 +4909,7 @@
 }
 
 SIMD::UInt::UInt(RValue<SIMD::Float> cast)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	// Smallest positive value representable in UInt, but not in Int
@@ -4925,6 +4927,7 @@
 }
 
 SIMD::UInt::UInt(RValue<scalar::UInt> rhs)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *vector = Nucleus::createBitCast(rhs.value(), SIMD::UInt::type());
@@ -5047,6 +5050,7 @@
 }
 
 SIMD::Float::Float(RValue<scalar::Float> rhs)
+    : XYZW(this)
 {
 	RR_DEBUG_INFO_UPDATE_LOC();
 	Value *vector = Nucleus::createBitCast(rhs.value(), SIMD::Float::type());