Implement Int to Int4 conversion.

BUG=swiftshader:3

Change-Id: I114384fc0e25ee1f7874f726b85ef5bcaf01ed36
Reviewed-on: https://swiftshader-review.googlesource.com/6951
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/Nucleus.cpp b/src/Reactor/Nucleus.cpp
index 2c18dc7..c7b94f7 100644
--- a/src/Reactor/Nucleus.cpp
+++ b/src/Reactor/Nucleus.cpp
@@ -5394,6 +5394,8 @@
 
 	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 @@
 		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);
diff --git a/src/Reactor/Nucleus.hpp b/src/Reactor/Nucleus.hpp
index d4148f6..98c7f91 100644
--- a/src/Reactor/Nucleus.hpp
+++ b/src/Reactor/Nucleus.hpp
@@ -1655,6 +1655,9 @@
 		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;