Reactor: Add UInt4 constructors taking UInt
Odd that these don't exist already.
Change-Id: I018dc4eb5144cb4c359c790aadabc35516bdd745
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31430
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 171f9b1..7df7d8a 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -2964,6 +2964,18 @@
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
}
+ UInt4::UInt4(RValue<UInt> rhs) : XYZW(this)
+ {
+ RR_DEBUG_INFO_UPDATE_LOC();
+ Value *vector = loadValue();
+ Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
+
+ int swizzle[4] = {0, 0, 0, 0};
+ Value *replicate = Nucleus::createShuffleVector(insert, insert, swizzle);
+
+ storeValue(replicate);
+ }
+
RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs)
{
RR_DEBUG_INFO_UPDATE_LOC();