Refactor common Reactor implementations
Some functions in LLVMReactor.cpp and SubzeroReactor.cpp were identical
and have been moved into a common Reactor.cpp.
Bug swiftshader:21
Change-Id: Ib079757f9e35f83b1103e2791227f02775e034d3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27068
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9efd51a..b892ca7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1873,6 +1873,7 @@
)
set(SUBZERO_REACTOR_LIST
+ ${SOURCE_DIR}/Reactor/Reactor.cpp
${SOURCE_DIR}/Reactor/SubzeroReactor.cpp
${SOURCE_DIR}/Reactor/Routine.cpp
${SOURCE_DIR}/Reactor/Optimizer.cpp
@@ -1965,6 +1966,7 @@
)
set(REACTOR_LLVM_LIST
+ ${SOURCE_DIR}/Reactor/Reactor.cpp
${SOURCE_DIR}/Reactor/LLVMReactor.cpp
${SOURCE_DIR}/Reactor/Nucleus.hpp
${SOURCE_DIR}/Reactor/Routine.cpp
diff --git a/src/Android.bp b/src/Android.bp
index 9dbc324..368087b 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -174,6 +174,7 @@
defaults: [ "libswiftshader_common_defaults" ],
srcs: [
+ "Reactor/Reactor.cpp",
"Reactor/LLVMReactor.cpp",
"Reactor/Routine.cpp",
"Reactor/LLVMRoutine.cpp",
@@ -192,6 +193,7 @@
device_supported: false,
srcs: [
+ "Reactor/Reactor.cpp",
"Reactor/SubzeroReactor.cpp",
"Reactor/Routine.cpp",
"Reactor/Optimizer.cpp",
diff --git a/src/Android.mk b/src/Android.mk
index 84db826..c6da7c9 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -61,6 +61,7 @@
Main/SwiftConfig.cpp
COMMON_SRC_FILES += \
+ Reactor/Reactor.cpp \
Reactor/Routine.cpp \
Reactor/Debug.cpp \
Reactor/DebugAndroid.cpp \
diff --git a/src/Reactor/BUILD.gn b/src/Reactor/BUILD.gn
index c983c43..7e3cdd3 100644
--- a/src/Reactor/BUILD.gn
+++ b/src/Reactor/BUILD.gn
@@ -294,6 +294,7 @@
]
sources = [
+ "Reactor.cpp",
"Routine.cpp",
"Debug.cpp",
"ExecutableMemory.cpp",
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 27f5661..a8fa866 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -1532,39 +1532,6 @@
::builder->CreateUnreachable();
}
- static Value *createSwizzle4(Value *val, unsigned char select)
- {
- int swizzle[4] =
- {
- (select >> 0) & 0x03,
- (select >> 2) & 0x03,
- (select >> 4) & 0x03,
- (select >> 6) & 0x03,
- };
-
- return Nucleus::createShuffleVector(val, val, swizzle);
- }
-
- static Value *createMask4(Value *lhs, Value *rhs, unsigned char select)
- {
- bool mask[4] = {false, false, false, false};
-
- mask[(select >> 0) & 0x03] = true;
- mask[(select >> 2) & 0x03] = true;
- mask[(select >> 4) & 0x03] = true;
- mask[(select >> 6) & 0x03] = true;
-
- int swizzle[4] =
- {
- mask[0] ? 4 : 0,
- mask[1] ? 5 : 1,
- mask[2] ? 6 : 2,
- mask[3] ? 7 : 3,
- };
-
- return Nucleus::createShuffleVector(lhs, rhs, swizzle);
- }
-
Type *Nucleus::getPointerType(Type *ElementType)
{
return T(llvm::PointerType::get(T(ElementType), 0));
@@ -1662,1092 +1629,31 @@
return T(llvm::Type::getVoidTy(*::context));
}
- Bool::Bool(Argument<Bool> argument)
- {
- storeValue(argument.value);
- }
-
- Bool::Bool(bool x)
- {
- storeValue(Nucleus::createConstantBool(x));
- }
-
- Bool::Bool(RValue<Bool> rhs)
- {
- storeValue(rhs.value);
- }
-
- Bool::Bool(const Bool &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Bool::Bool(const Reference<Bool> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Bool> Bool::operator=(RValue<Bool> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Bool> Bool::operator=(const Bool &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Bool>(value);
- }
-
- RValue<Bool> Bool::operator=(const Reference<Bool> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Bool>(value);
- }
-
- RValue<Bool> operator!(RValue<Bool> val)
- {
- return RValue<Bool>(Nucleus::createNot(val.value));
- }
-
- RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs)
- {
- return RValue<Bool>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs)
- {
- return RValue<Bool>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
Type *Bool::getType()
{
return T(llvm::Type::getInt1Ty(*::context));
}
- Byte::Byte(Argument<Byte> argument)
- {
- storeValue(argument.value);
- }
-
- Byte::Byte(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
-
- storeValue(integer);
- }
-
- Byte::Byte(RValue<UInt> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
-
- storeValue(integer);
- }
-
- Byte::Byte(RValue<UShort> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
-
- storeValue(integer);
- }
-
- Byte::Byte(int x)
- {
- storeValue(Nucleus::createConstantByte((unsigned char)x));
- }
-
- Byte::Byte(unsigned char x)
- {
- storeValue(Nucleus::createConstantByte(x));
- }
-
- Byte::Byte(RValue<Byte> rhs)
- {
- storeValue(rhs.value);
- }
-
- Byte::Byte(const Byte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Byte::Byte(const Reference<Byte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Byte> Byte::operator=(RValue<Byte> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Byte> Byte::operator=(const Byte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte>(value);
- }
-
- RValue<Byte> Byte::operator=(const Reference<Byte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte>(value);
- }
-
- RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Byte> operator+(RValue<Byte> val)
- {
- return val;
- }
-
- RValue<Byte> operator-(RValue<Byte> val)
- {
- return RValue<Byte>(Nucleus::createNeg(val.value));
- }
-
- RValue<Byte> operator~(RValue<Byte> val)
- {
- return RValue<Byte>(Nucleus::createNot(val.value));
- }
-
- RValue<Byte> operator++(Byte &val, int) // Post-increment
- {
- RValue<Byte> res = val;
-
- Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantByte((unsigned char)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const Byte &operator++(Byte &val) // Pre-increment
- {
- Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantByte((unsigned char)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<Byte> operator--(Byte &val, int) // Post-decrement
- {
- RValue<Byte> res = val;
-
- Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantByte((unsigned char)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const Byte &operator--(Byte &val) // Pre-decrement
- {
- Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantByte((unsigned char)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *Byte::getType()
{
return T(llvm::Type::getInt8Ty(*::context));
}
- SByte::SByte(Argument<SByte> argument)
- {
- storeValue(argument.value);
- }
-
- SByte::SByte(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
-
- storeValue(integer);
- }
-
- SByte::SByte(RValue<Short> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
-
- storeValue(integer);
- }
-
- SByte::SByte(signed char x)
- {
- storeValue(Nucleus::createConstantByte(x));
- }
-
- SByte::SByte(RValue<SByte> rhs)
- {
- storeValue(rhs.value);
- }
-
- SByte::SByte(const SByte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- SByte::SByte(const Reference<SByte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<SByte> SByte::operator=(RValue<SByte> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<SByte> SByte::operator=(const SByte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte>(value);
- }
-
- RValue<SByte> SByte::operator=(const Reference<SByte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte>(value);
- }
-
- RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<SByte> operator+(RValue<SByte> val)
- {
- return val;
- }
-
- RValue<SByte> operator-(RValue<SByte> val)
- {
- return RValue<SByte>(Nucleus::createNeg(val.value));
- }
-
- RValue<SByte> operator~(RValue<SByte> val)
- {
- return RValue<SByte>(Nucleus::createNot(val.value));
- }
-
- RValue<SByte> operator++(SByte &val, int) // Post-increment
- {
- RValue<SByte> res = val;
-
- Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantByte((signed char)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const SByte &operator++(SByte &val) // Pre-increment
- {
- Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantByte((signed char)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<SByte> operator--(SByte &val, int) // Post-decrement
- {
- RValue<SByte> res = val;
-
- Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantByte((signed char)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const SByte &operator--(SByte &val) // Pre-decrement
- {
- Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantByte((signed char)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *SByte::getType()
{
return T(llvm::Type::getInt8Ty(*::context));
}
- Short::Short(Argument<Short> argument)
- {
- storeValue(argument.value);
- }
-
- Short::Short(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Short::getType());
-
- storeValue(integer);
- }
-
- Short::Short(short x)
- {
- storeValue(Nucleus::createConstantShort(x));
- }
-
- Short::Short(RValue<Short> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short::Short(const Short &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short::Short(const Reference<Short> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Short> Short::operator=(RValue<Short> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Short> Short::operator=(const Short &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short>(value);
- }
-
- RValue<Short> Short::operator=(const Reference<Short> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short>(value);
- }
-
- RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Short> operator+=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Short> operator-=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Short> operator*=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Short> operator/=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Short> operator%=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Short> operator&=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Short> operator|=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Short> operator^=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Short> operator+(RValue<Short> val)
- {
- return val;
- }
-
- RValue<Short> operator-(RValue<Short> val)
- {
- return RValue<Short>(Nucleus::createNeg(val.value));
- }
-
- RValue<Short> operator~(RValue<Short> val)
- {
- return RValue<Short>(Nucleus::createNot(val.value));
- }
-
- RValue<Short> operator++(Short &val, int) // Post-increment
- {
- RValue<Short> res = val;
-
- Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantShort((short)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const Short &operator++(Short &val) // Pre-increment
- {
- Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantShort((short)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<Short> operator--(Short &val, int) // Post-decrement
- {
- RValue<Short> res = val;
-
- Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantShort((short)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const Short &operator--(Short &val) // Pre-decrement
- {
- Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantShort((short)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *Short::getType()
{
return T(llvm::Type::getInt16Ty(*::context));
}
- UShort::UShort(Argument<UShort> argument)
- {
- storeValue(argument.value);
- }
-
- UShort::UShort(RValue<UInt> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
-
- storeValue(integer);
- }
-
- UShort::UShort(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
-
- storeValue(integer);
- }
-
- UShort::UShort(unsigned short x)
- {
- storeValue(Nucleus::createConstantShort(x));
- }
-
- UShort::UShort(RValue<UShort> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort::UShort(const UShort &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort::UShort(const Reference<UShort> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UShort> UShort::operator=(RValue<UShort> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UShort> UShort::operator=(const UShort &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort>(value);
- }
-
- RValue<UShort> UShort::operator=(const Reference<UShort> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort>(value);
- }
-
- RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UShort> operator+(RValue<UShort> val)
- {
- return val;
- }
-
- RValue<UShort> operator-(RValue<UShort> val)
- {
- return RValue<UShort>(Nucleus::createNeg(val.value));
- }
-
- RValue<UShort> operator~(RValue<UShort> val)
- {
- return RValue<UShort>(Nucleus::createNot(val.value));
- }
-
- RValue<UShort> operator++(UShort &val, int) // Post-increment
- {
- RValue<UShort> res = val;
-
- Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantShort((unsigned short)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const UShort &operator++(UShort &val) // Pre-increment
- {
- Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantShort((unsigned short)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<UShort> operator--(UShort &val, int) // Post-decrement
- {
- RValue<UShort> res = val;
-
- Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantShort((unsigned short)1));
- val.storeValue(inc);
-
- return res;
- }
-
- const UShort &operator--(UShort &val) // Pre-decrement
- {
- Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantShort((unsigned short)1));
- val.storeValue(inc);
-
- return val;
- }
-
- RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *UShort::getType()
{
return T(llvm::Type::getInt16Ty(*::context));
}
- Byte4::Byte4(RValue<Byte8> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
- Byte4::Byte4(const Reference<Byte4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
Type *Byte4::getType()
{
return T(Type_v4i8);
@@ -2758,167 +1664,6 @@
return T(Type_v4i8);
}
- Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
- {
- int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Byte8::Byte8(RValue<Byte8> rhs)
- {
- storeValue(rhs.value);
- }
-
- Byte8::Byte8(const Byte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Byte8::Byte8(const Reference<Byte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Byte8> Byte8::operator=(RValue<Byte8> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Byte8> Byte8::operator=(const Byte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte8>(value);
- }
-
- RValue<Byte8> Byte8::operator=(const Reference<Byte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte8>(value);
- }
-
- RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs)
-// {
-// return RValue<Byte8>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs)
-// {
-// return RValue<Byte8>(Nucleus::createUDiv(lhs.value, rhs.value));
-// }
-
-// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs)
-// {
-// return RValue<Byte8>(Nucleus::createURem(lhs.value, rhs.value));
-// }
-
- RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
-// RValue<Byte8> operator<<(RValue<Byte8> lhs, unsigned char rhs)
-// {
-// return RValue<Byte8>(Nucleus::createShl(lhs.value, rhs.value));
-// }
-
-// RValue<Byte8> operator>>(RValue<Byte8> lhs, unsigned char rhs)
-// {
-// return RValue<Byte8>(Nucleus::createLShr(lhs.value, rhs.value));
-// }
-
- RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
-// RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs << rhs;
-// }
-
-// RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs >> rhs;
-// }
-
-// RValue<Byte8> operator+(RValue<Byte8> val)
-// {
-// return val;
-// }
-
-// RValue<Byte8> operator-(RValue<Byte8> val)
-// {
-// return RValue<Byte8>(Nucleus::createNeg(val.value));
-// }
-
- RValue<Byte8> operator~(RValue<Byte8> val)
- {
- return RValue<Byte8>(Nucleus::createNot(val.value));
- }
-
RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -2937,30 +1682,6 @@
#endif
}
- RValue<Short4> Unpack(RValue<Byte4> x)
- {
- int shuffle[16] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}; // Real type is v16i8
- return As<Short4>(Nucleus::createShuffleVector(x.value, x.value, shuffle));
- }
-
- RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y)
- {
- return UnpackLow(As<Byte8>(x), As<Byte8>(y));
- }
-
- RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
- }
-
RValue<Int> SignMask(RValue<Byte8> x)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -2993,169 +1714,6 @@
return T(Type_v8i8);
}
- SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
- {
- int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
- Value *vector = Nucleus::createConstantVector(constantVector, getType());
-
- storeValue(Nucleus::createBitCast(vector, getType()));
- }
-
- SByte8::SByte8(RValue<SByte8> rhs)
- {
- storeValue(rhs.value);
- }
-
- SByte8::SByte8(const SByte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- SByte8::SByte8(const Reference<SByte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<SByte8> SByte8::operator=(RValue<SByte8> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<SByte8> SByte8::operator=(const SByte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte8>(value);
- }
-
- RValue<SByte8> SByte8::operator=(const Reference<SByte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte8>(value);
- }
-
- RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs)
-// {
-// return RValue<SByte8>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs)
-// {
-// return RValue<SByte8>(Nucleus::createSDiv(lhs.value, rhs.value));
-// }
-
-// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs)
-// {
-// return RValue<SByte8>(Nucleus::createSRem(lhs.value, rhs.value));
-// }
-
- RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
-// RValue<SByte8> operator<<(RValue<SByte8> lhs, unsigned char rhs)
-// {
-// return RValue<SByte8>(Nucleus::createShl(lhs.value, rhs.value));
-// }
-
-// RValue<SByte8> operator>>(RValue<SByte8> lhs, unsigned char rhs)
-// {
-// return RValue<SByte8>(Nucleus::createAShr(lhs.value, rhs.value));
-// }
-
- RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
-// RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs << rhs;
-// }
-
-// RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs >> rhs;
-// }
-
-// RValue<SByte8> operator+(RValue<SByte8> val)
-// {
-// return val;
-// }
-
-// RValue<SByte8> operator-(RValue<SByte8> val)
-// {
-// return RValue<SByte8>(Nucleus::createNeg(val.value));
-// }
-
- RValue<SByte8> operator~(RValue<SByte8> val)
- {
- return RValue<SByte8>(Nucleus::createNot(val.value));
- }
-
RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3174,19 +1732,6 @@
#endif
}
- RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
- }
-
RValue<Int> SignMask(RValue<SByte8> x)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3219,46 +1764,6 @@
return T(Type_v8i8);
}
- Byte16::Byte16(RValue<Byte16> rhs)
- {
- storeValue(rhs.value);
- }
-
- Byte16::Byte16(const Byte16 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Byte16::Byte16(const Reference<Byte16> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Byte16> Byte16::operator=(RValue<Byte16> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Byte16> Byte16::operator=(const Byte16 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte16>(value);
- }
-
- RValue<Byte16> Byte16::operator=(const Reference<Byte16> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte16>(value);
- }
-
Type *Byte16::getType()
{
return T(llvm::VectorType::get(T(Byte::getType()), 16));
@@ -3269,36 +1774,16 @@
return T(llvm::VectorType::get(T(SByte::getType()), 16));
}
- Short2::Short2(RValue<Short4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
Type *Short2::getType()
{
return T(Type_v2i16);
}
- UShort2::UShort2(RValue<UShort4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
Type *UShort2::getType()
{
return T(Type_v2i16);
}
- Short4::Short4(RValue<Int> cast)
- {
- Value *vector = loadValue();
- Value *element = Nucleus::createTrunc(cast.value, Short::getType());
- Value *insert = Nucleus::createInsertElement(vector, element, 0);
- Value *swizzle = Swizzle(RValue<Short4>(insert), 0x00).value;
-
- storeValue(swizzle);
- }
-
Short4::Short4(RValue<Int4> cast)
{
int select[8] = {0, 2, 4, 6, 0, 2, 4, 6};
@@ -3327,136 +1812,6 @@
storeValue(As<Short4>(Int2(v4i32)).value);
}
- Short4::Short4(short xyzw)
- {
- int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short4::Short4(short x, short y, short z, short w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short4::Short4(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short4::Short4(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short4::Short4(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short4::Short4(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short4::Short4(const UShort4 &rhs)
- {
- storeValue(rhs.loadValue());
- }
-
- Short4::Short4(const Reference<UShort4> &rhs)
- {
- storeValue(rhs.loadValue());
- }
-
- RValue<Short4> Short4::operator=(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Short4> Short4::operator=(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> Short4::operator=(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> Short4::operator=(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<Short4>(rhs);
- }
-
- RValue<Short4> Short4::operator=(const UShort4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> Short4::operator=(const Reference<UShort4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
-// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs)
-// {
-// return RValue<Short4>(Nucleus::createSDiv(lhs.value, rhs.value));
-// }
-
-// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs)
-// {
-// return RValue<Short4>(Nucleus::createSRem(lhs.value, rhs.value));
-// }
-
- RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3477,77 +1832,6 @@
#endif
}
- RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
-// RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
-// RValue<Short4> operator+(RValue<Short4> val)
-// {
-// return val;
-// }
-
- RValue<Short4> operator-(RValue<Short4> val)
- {
- return RValue<Short4>(Nucleus::createNeg(val.value));
- }
-
- RValue<Short4> operator~(RValue<Short4> val)
- {
- return RValue<Short4>(Nucleus::createNot(val.value));
- }
-
- RValue<Short4> RoundShort4(RValue<Float4> cast)
- {
- RValue<Int4> int4 = RoundInt(cast);
- return As<Short4>(PackSigned(int4, int4));
- }
-
RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3622,47 +1906,6 @@
return As<Byte8>(Swizzle(As<Int4>(result), 0x88));
}
- RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y)
- {
- int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
- return As<Int2>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y)
- {
- int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
- auto lowHigh = RValue<Short8>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Int2>(Swizzle(As<Int4>(lowHigh), 0xEE));
- }
-
- RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select)
- {
- // Real type is v8i16
- int shuffle[8] =
- {
- (select >> 0) & 0x03,
- (select >> 2) & 0x03,
- (select >> 4) & 0x03,
- (select >> 6) & 0x03,
- (select >> 0) & 0x03,
- (select >> 2) & 0x03,
- (select >> 4) & 0x03,
- (select >> 6) & 0x03,
- };
-
- return As<Short4>(Nucleus::createShuffleVector(x.value, x.value, shuffle));
- }
-
- RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i)
- {
- return RValue<Short4>(Nucleus::createInsertElement(val.value, element.value, i));
- }
-
- RValue<Short> Extract(RValue<Short4> val, int i)
- {
- return RValue<Short>(Nucleus::createExtractElement(val.value, Short::getType(), i));
- }
-
RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3686,11 +1929,6 @@
return T(Type_v4i16);
}
- UShort4::UShort4(RValue<Int4> cast)
- {
- *this = Short4(cast);
- }
-
UShort4::UShort4(RValue<Float4> cast, bool saturate)
{
if(saturate)
@@ -3713,128 +1951,6 @@
}
}
- UShort4::UShort4(unsigned short xyzw)
- {
- int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort4::UShort4(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort4::UShort4(const UShort4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort4::UShort4(const Reference<UShort4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort4::UShort4(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort4::UShort4(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort4::UShort4(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UShort4> UShort4::operator=(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UShort4> UShort4::operator=(const UShort4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> UShort4::operator=(const Reference<UShort4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> UShort4::operator=(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<UShort4>(rhs);
- }
-
- RValue<UShort4> UShort4::operator=(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> UShort4::operator=(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3857,21 +1973,6 @@
#endif
}
- RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UShort4> operator~(RValue<UShort4> val)
- {
- return RValue<UShort4>(Nucleus::createNot(val.value));
- }
-
RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y)
{
return RValue<UShort4>(Max(As<Short4>(x) - Short4(0x8000u, 0x8000u, 0x8000u, 0x8000u), As<Short4>(y) - Short4(0x8000u, 0x8000u, 0x8000u, 0x8000u)) + Short4(0x8000u, 0x8000u, 0x8000u, 0x8000u));
@@ -3923,47 +2024,6 @@
return T(Type_v4i16);
}
- Short8::Short8(short c)
- {
- int64_t constantVector[8] = {c, c, c, c, c, c, c, c};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7)
- {
- int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short8::Short8(RValue<Short8> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short8::Short8(const Reference<Short8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short8::Short8(RValue<Short4> lo, RValue<Short4> hi)
- {
- int shuffle[8] = {0, 1, 2, 3, 8, 9, 10, 11}; // Real type is v8i16
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
- RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs)
- {
- return RValue<Short8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs)
- {
- return RValue<Short8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -3991,12 +2051,6 @@
#endif
}
- RValue<Int4> Abs(RValue<Int4> x)
- {
- auto negative = x >> 31;
- return (x ^ negative) - negative;
- }
-
RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -4011,65 +2065,6 @@
return T(llvm::VectorType::get(T(Short::getType()), 8));
}
- UShort8::UShort8(unsigned short c)
- {
- int64_t constantVector[8] = {c, c, c, c, c, c, c, c};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort8::UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7)
- {
- int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort8::UShort8(RValue<UShort8> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort8::UShort8(const Reference<UShort8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort8::UShort8(RValue<UShort4> lo, RValue<UShort4> hi)
- {
- int shuffle[8] = {0, 1, 2, 3, 8, 9, 10, 11}; // Real type is v8i16
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
- RValue<UShort8> UShort8::operator=(RValue<UShort8> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UShort8> UShort8::operator=(const UShort8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort8>(value);
- }
-
- RValue<UShort8> UShort8::operator=(const Reference<UShort8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort8>(value);
- }
-
- RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs)
- {
- return RValue<UShort8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -4088,26 +2083,6 @@
#endif
}
- RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs)
- {
- return RValue<UShort8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs)
- {
- return RValue<UShort8>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UShort8> operator~(RValue<UShort8> val)
- {
- return RValue<UShort8>(Nucleus::createNot(val.value));
- }
-
RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7)
{
int pshufb[16] =
@@ -4151,263 +2126,6 @@
return T(llvm::VectorType::get(T(UShort::getType()), 8));
}
- Int::Int(Argument<Int> argument)
- {
- storeValue(argument.value);
- }
-
- Int::Int(RValue<Byte> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<SByte> cast)
- {
- Value *integer = Nucleus::createSExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<Short> cast)
- {
- Value *integer = Nucleus::createSExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<UShort> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<Int2> cast)
- {
- *this = Extract(cast, 0);
- }
-
- Int::Int(RValue<Long> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<Float> cast)
- {
- Value *integer = Nucleus::createFPToSI(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(int x)
- {
- storeValue(Nucleus::createConstantInt(x));
- }
-
- Int::Int(RValue<Int> rhs)
- {
- storeValue(rhs.value);
- }
-
- Int::Int(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
- }
-
- Int::Int(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int::Int(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int::Int(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int::Int(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Int> Int::operator=(int rhs)
- {
- return RValue<Int>(storeValue(Nucleus::createConstantInt(rhs)));
- }
-
- RValue<Int> Int::operator=(RValue<Int> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Int> Int::operator=(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<Int>(rhs);
- }
-
- RValue<Int> Int::operator=(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> Int::operator=(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> Int::operator=(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> Int::operator=(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Int> operator+=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Int> operator-=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Int> operator*=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Int> operator/=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Int> operator%=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Int> operator&=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Int> operator|=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Int> operator^=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Int> operator+(RValue<Int> val)
- {
- return val;
- }
-
- RValue<Int> operator-(RValue<Int> val)
- {
- return RValue<Int>(Nucleus::createNeg(val.value));
- }
-
- RValue<Int> operator~(RValue<Int> val)
- {
- return RValue<Int>(Nucleus::createNot(val.value));
- }
-
RValue<Int> operator++(Int &val, int) // Post-increment
{
RValue<Int> res = val;
@@ -4444,51 +2162,6 @@
return val;
}
- RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
- RValue<Int> Max(RValue<Int> x, RValue<Int> y)
- {
- return IfThenElse(x > y, x, y);
- }
-
- RValue<Int> Min(RValue<Int> x, RValue<Int> y)
- {
- return IfThenElse(x < y, x, y);
- }
-
- RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max)
- {
- return Min(Max(x, min), max);
- }
-
RValue<Int> RoundInt(RValue<Float> cast)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -4503,112 +2176,11 @@
return T(llvm::Type::getInt32Ty(*::context));
}
- Long::Long(RValue<Int> cast)
- {
- Value *integer = Nucleus::createSExt(cast.value, Long::getType());
-
- storeValue(integer);
- }
-
- Long::Long(RValue<UInt> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, Long::getType());
-
- storeValue(integer);
- }
-
- Long::Long(RValue<Long> rhs)
- {
- storeValue(rhs.value);
- }
-
- RValue<Long> Long::operator=(int64_t rhs)
- {
- return RValue<Long>(storeValue(Nucleus::createConstantLong(rhs)));
- }
-
- RValue<Long> Long::operator=(RValue<Long> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Long> Long::operator=(const Long &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Long>(value);
- }
-
- RValue<Long> Long::operator=(const Reference<Long> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Long>(value);
- }
-
- RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Long> operator+=(Long &lhs, RValue<Long> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Long> operator-=(Long &lhs, RValue<Long> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Long> AddAtomic(RValue<Pointer<Long> > x, RValue<Long> y)
- {
- return RValue<Long>(Nucleus::createAtomicAdd(x.value, y.value));
- }
-
Type *Long::getType()
{
return T(llvm::Type::getInt64Ty(*::context));
}
- UInt::UInt(Argument<UInt> argument)
- {
- storeValue(argument.value);
- }
-
- UInt::UInt(RValue<UShort> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, UInt::getType());
-
- storeValue(integer);
- }
-
- UInt::UInt(RValue<Long> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, UInt::getType());
-
- storeValue(integer);
- }
-
UInt::UInt(RValue<Float> cast)
{
// Note: createFPToUI is broken, must perform conversion using createFPtoSI
@@ -4628,216 +2200,6 @@
Int(cast))).value);
}
- UInt::UInt(int x)
- {
- storeValue(Nucleus::createConstantInt(x));
- }
-
- UInt::UInt(unsigned int x)
- {
- storeValue(Nucleus::createConstantInt(x));
- }
-
- UInt::UInt(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
- }
-
- UInt::UInt(RValue<Int> rhs)
- {
- storeValue(rhs.value);
- }
-
- UInt::UInt(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt::UInt(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt::UInt(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt::UInt(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UInt> UInt::operator=(unsigned int rhs)
- {
- return RValue<UInt>(storeValue(Nucleus::createConstantInt(rhs)));
- }
-
- RValue<UInt> UInt::operator=(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UInt> UInt::operator=(RValue<Int> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<UInt>(rhs);
- }
-
- RValue<UInt> UInt::operator=(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> UInt::operator=(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> UInt::operator=(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> UInt::operator=(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UInt> operator+(RValue<UInt> val)
- {
- return val;
- }
-
- RValue<UInt> operator-(RValue<UInt> val)
- {
- return RValue<UInt>(Nucleus::createNeg(val.value));
- }
-
- RValue<UInt> operator~(RValue<UInt> val)
- {
- return RValue<UInt>(Nucleus::createNot(val.value));
- }
-
RValue<UInt> operator++(UInt &val, int) // Post-increment
{
RValue<UInt> res = val;
@@ -4874,51 +2236,6 @@
return val;
}
- RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y)
- {
- return IfThenElse(x > y, x, y);
- }
-
- RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y)
- {
- return IfThenElse(x < y, x, y);
- }
-
- RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max)
- {
- return Min(Max(x, min), max);
- }
-
- RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
// RValue<UInt> RoundUInt(RValue<Float> cast)
// {
//#if defined(__i386__) || defined(__x86_64__)
@@ -4944,105 +2261,6 @@
// storeValue(replicate);
// }
- Int2::Int2(RValue<Int4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
- Int2::Int2(int x, int y)
- {
- int64_t constantVector[2] = {x, y};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Int2::Int2(RValue<Int2> rhs)
- {
- storeValue(rhs.value);
- }
-
- Int2::Int2(const Int2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int2::Int2(const Reference<Int2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int2::Int2(RValue<Int> lo, RValue<Int> hi)
- {
- int shuffle[4] = {0, 4, 1, 5};
- Value *packed = Nucleus::createShuffleVector(Int4(lo).loadValue(), Int4(hi).loadValue(), shuffle);
-
- storeValue(Nucleus::createBitCast(packed, Int2::getType()));
- }
-
- RValue<Int2> Int2::operator=(RValue<Int2> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Int2> Int2::operator=(const Int2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int2>(value);
- }
-
- RValue<Int2> Int2::operator=(const Reference<Int2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int2>(value);
- }
-
- RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs)
-// {
-// return RValue<Int2>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs)
-// {
-// return RValue<Int2>(Nucleus::createSDiv(lhs.value, rhs.value));
-// }
-
-// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs)
-// {
-// return RValue<Int2>(Nucleus::createSRem(lhs.value, rhs.value));
-// }
-
- RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5065,185 +2283,11 @@
#endif
}
- RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
-// RValue<Int2> operator+(RValue<Int2> val)
-// {
-// return val;
-// }
-
-// RValue<Int2> operator-(RValue<Int2> val)
-// {
-// return RValue<Int2>(Nucleus::createNeg(val.value));
-// }
-
- RValue<Int2> operator~(RValue<Int2> val)
- {
- return RValue<Int2>(Nucleus::createNot(val.value));
- }
-
- RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y)
- {
- int shuffle[4] = {0, 4, 1, 5}; // Real type is v4i32
- return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y)
- {
- int shuffle[4] = {0, 4, 1, 5}; // Real type is v4i32
- auto lowHigh = RValue<Int4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Short4>(Swizzle(lowHigh, 0xEE));
- }
-
- RValue<Int> Extract(RValue<Int2> val, int i)
- {
- return RValue<Int>(Nucleus::createExtractElement(val.value, Int::getType(), i));
- }
-
- RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i)
- {
- return RValue<Int2>(Nucleus::createInsertElement(val.value, element.value, i));
- }
-
Type *Int2::getType()
{
return T(Type_v2i32);
}
- UInt2::UInt2(unsigned int x, unsigned int y)
- {
- int64_t constantVector[2] = {x, y};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UInt2::UInt2(RValue<UInt2> rhs)
- {
- storeValue(rhs.value);
- }
-
- UInt2::UInt2(const UInt2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt2::UInt2(const Reference<UInt2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UInt2> UInt2::operator=(RValue<UInt2> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UInt2> UInt2::operator=(const UInt2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt2>(value);
- }
-
- RValue<UInt2> UInt2::operator=(const Reference<UInt2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt2>(value);
- }
-
- RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs)
-// {
-// return RValue<UInt2>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs)
-// {
-// return RValue<UInt2>(Nucleus::createUDiv(lhs.value, rhs.value));
-// }
-
-// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs)
-// {
-// return RValue<UInt2>(Nucleus::createURem(lhs.value, rhs.value));
-// }
-
- RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5266,80 +2310,11 @@
#endif
}
- RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
-// RValue<UInt2> operator+(RValue<UInt2> val)
-// {
-// return val;
-// }
-
-// RValue<UInt2> operator-(RValue<UInt2> val)
-// {
-// return RValue<UInt2>(Nucleus::createNeg(val.value));
-// }
-
- RValue<UInt2> operator~(RValue<UInt2> val)
- {
- return RValue<UInt2>(Nucleus::createNot(val.value));
- }
-
Type *UInt2::getType()
{
return T(Type_v2i32);
}
- Int4::Int4() : XYZW(this)
- {
- }
-
Int4::Int4(RValue<Byte4> cast) : XYZW(this)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5384,13 +2359,6 @@
}
}
- Int4::Int4(RValue<Float4> cast) : XYZW(this)
- {
- Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
-
- storeValue(xyzw);
- }
-
Int4::Int4(RValue<Short4> cast) : XYZW(this)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5423,74 +2391,6 @@
}
}
- Int4::Int4(int xyzw) : XYZW(this)
- {
- constant(xyzw, xyzw, xyzw, xyzw);
- }
-
- Int4::Int4(int x, int yzw) : XYZW(this)
- {
- constant(x, yzw, yzw, yzw);
- }
-
- Int4::Int4(int x, int y, int zw) : XYZW(this)
- {
- constant(x, y, zw, zw);
- }
-
- Int4::Int4(int x, int y, int z, int w) : XYZW(this)
- {
- constant(x, y, z, w);
- }
-
- void Int4::constant(int x, int y, int z, int w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Int4::Int4(RValue<Int4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- Int4::Int4(const Int4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(const Reference<Int4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(RValue<UInt4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- Int4::Int4(const UInt4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(const Reference<UInt4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(RValue<Int2> lo, RValue<Int2> hi) : XYZW(this)
- {
- int shuffle[4] = {0, 1, 4, 5}; // Real type is v4i32
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
Int4::Int4(RValue<Int> rhs) : XYZW(this)
{
Value *vector = loadValue();
@@ -5502,79 +2402,6 @@
storeValue(replicate);
}
- Int4::Int4(const Int &rhs) : XYZW(this)
- {
- *this = RValue<Int>(rhs.loadValue());
- }
-
- Int4::Int4(const Reference<Int> &rhs) : XYZW(this)
- {
- *this = RValue<Int>(rhs.loadValue());
- }
-
- RValue<Int4> Int4::operator=(RValue<Int4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Int4> Int4::operator=(const Int4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int4>(value);
- }
-
- RValue<Int4> Int4::operator=(const Reference<Int4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int4>(value);
- }
-
- RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5593,81 +2420,6 @@
#endif
}
- RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
-// RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Int4> operator+(RValue<Int4> val)
- {
- return val;
- }
-
- RValue<Int4> operator-(RValue<Int4> val)
- {
- return RValue<Int4>(Nucleus::createNeg(val.value));
- }
-
- RValue<Int4> operator~(RValue<Int4> val)
- {
- return RValue<Int4>(Nucleus::createNot(val.value));
- }
-
RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y)
{
// FIXME: An LLVM bug causes SExt(ICmpCC()) to produce 0 or 1 instead of 0 or ~0
@@ -5785,16 +2537,6 @@
#endif
}
- RValue<Int> Extract(RValue<Int4> x, int i)
- {
- return RValue<Int>(Nucleus::createExtractElement(x.value, Int::getType(), i));
- }
-
- RValue<Int4> Insert(RValue<Int4> x, RValue<Int> element, int i)
- {
- return RValue<Int4>(Nucleus::createInsertElement(x.value, element.value, i));
- }
-
RValue<Int> SignMask(RValue<Int4> x)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5804,20 +2546,11 @@
#endif
}
- RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select)
- {
- return RValue<Int4>(createSwizzle4(x.value, select));
- }
-
Type *Int4::getType()
{
return T(llvm::VectorType::get(T(Int::getType()), 4));
}
- UInt4::UInt4() : XYZW(this)
- {
- }
-
UInt4::UInt4(RValue<Float4> cast) : XYZW(this)
{
// Note: createFPToUI is broken, must perform conversion using createFPtoSI
@@ -5837,137 +2570,6 @@
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
}
- UInt4::UInt4(int xyzw) : XYZW(this)
- {
- constant(xyzw, xyzw, xyzw, xyzw);
- }
-
- UInt4::UInt4(int x, int yzw) : XYZW(this)
- {
- constant(x, yzw, yzw, yzw);
- }
-
- UInt4::UInt4(int x, int y, int zw) : XYZW(this)
- {
- constant(x, y, zw, zw);
- }
-
- UInt4::UInt4(int x, int y, int z, int w) : XYZW(this)
- {
- constant(x, y, z, w);
- }
-
- void UInt4::constant(int x, int y, int z, int w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UInt4::UInt4(RValue<UInt4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- UInt4::UInt4(const UInt4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(const Reference<UInt4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(RValue<Int4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- UInt4::UInt4(const Int4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(const Reference<Int4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(RValue<UInt2> lo, RValue<UInt2> hi) : XYZW(this)
- {
- int shuffle[4] = {0, 1, 4, 5}; // Real type is v4i32
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
- RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UInt4> UInt4::operator=(const UInt4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt4>(value);
- }
-
- RValue<UInt4> UInt4::operator=(const Reference<UInt4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt4>(value);
- }
-
- RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -5986,81 +2588,6 @@
#endif
}
- RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
-// RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UInt4> operator+(RValue<UInt4> val)
- {
- return val;
- }
-
- RValue<UInt4> operator-(RValue<UInt4> val)
- {
- return RValue<UInt4>(Nucleus::createNeg(val.value));
- }
-
- RValue<UInt4> operator~(RValue<UInt4> val)
- {
- return RValue<UInt4>(Nucleus::createNot(val.value));
- }
-
RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y)
{
// FIXME: An LLVM bug causes SExt(ICmpCC()) to produce 0 or 1 instead of 0 or ~0
@@ -6135,224 +2662,11 @@
return T(llvm::VectorType::get(T(UInt::getType()), 4));
}
- Half::Half(RValue<Float> cast)
- {
- UInt fp32i = As<UInt>(cast);
- UInt abs = fp32i & 0x7FFFFFFF;
- UShort fp16i((fp32i & 0x80000000) >> 16); // sign
-
- If(abs > 0x47FFEFFF) // Infinity
- {
- fp16i |= UShort(0x7FFF);
- }
- Else
- {
- If(abs < 0x38800000) // Denormal
- {
- Int mantissa = (abs & 0x007FFFFF) | 0x00800000;
- Int e = 113 - (abs >> 23);
- abs = IfThenElse(e < 24, mantissa >> e, Int(0));
- fp16i |= UShort((abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
- }
- Else
- {
- fp16i |= UShort((abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
- }
- }
-
- storeValue(fp16i.loadValue());
- }
-
Type *Half::getType()
{
return T(llvm::Type::getInt16Ty(*::context));
}
- Float::Float(RValue<Int> cast)
- {
- Value *integer = Nucleus::createSIToFP(cast.value, Float::getType());
-
- storeValue(integer);
- }
-
- Float::Float(RValue<UInt> cast)
- {
- RValue<Float> result = Float(Int(cast & UInt(0x7FFFFFFF))) +
- As<Float>((As<Int>(cast) >> 31) & As<Int>(Float(0x80000000u)));
-
- storeValue(result.value);
- }
-
- Float::Float(RValue<Half> cast)
- {
- Int fp16i(As<UShort>(cast));
-
- Int s = (fp16i >> 15) & 0x00000001;
- Int e = (fp16i >> 10) & 0x0000001F;
- Int m = fp16i & 0x000003FF;
-
- UInt fp32i(s << 31);
- If(e == 0)
- {
- If(m != 0)
- {
- While((m & 0x00000400) == 0)
- {
- m <<= 1;
- e -= 1;
- }
-
- fp32i |= As<UInt>(((e + (127 - 15) + 1) << 23) | ((m & ~0x00000400) << 13));
- }
- }
- Else
- {
- fp32i |= As<UInt>(((e + (127 - 15)) << 23) | (m << 13));
- }
-
- storeValue(As<Float>(fp32i).value);
- }
-
- Float::Float(float x)
- {
- storeValue(Nucleus::createConstantFloat(x));
- }
-
- Float::Float(RValue<Float> rhs)
- {
- storeValue(rhs.value);
- }
-
- Float::Float(const Float &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Float::Float(const Reference<Float> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Float> Float::operator=(RValue<Float> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Float> Float::operator=(const Float &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float>(value);
- }
-
- RValue<Float> Float::operator=(const Reference<Float> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float>(value);
- }
-
- RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFAdd(lhs.value, rhs.value));
- }
-
- RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFSub(lhs.value, rhs.value));
- }
-
- RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFMul(lhs.value, rhs.value));
- }
-
- RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFDiv(lhs.value, rhs.value));
- }
-
- RValue<Float> operator+=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Float> operator-=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Float> operator*=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Float> operator/=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Float> operator+(RValue<Float> val)
- {
- return val;
- }
-
- RValue<Float> operator-(RValue<Float> val)
- {
- return RValue<Float>(Nucleus::createFNeg(val.value));
- }
-
- RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpONE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOEQ(lhs.value, rhs.value));
- }
-
- RValue<Float> Abs(RValue<Float> x)
- {
- return IfThenElse(x > 0.0f, x, -x);
- }
-
- RValue<Float> Max(RValue<Float> x, RValue<Float> y)
- {
- return IfThenElse(x > y, x, y);
- }
-
- RValue<Float> Min(RValue<Float> x, RValue<Float> y)
- {
- return IfThenElse(x < y, x, y);
- }
-
RValue<Float> Rcp_pp(RValue<Float> x, bool exactAtPow2)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -6471,106 +2785,11 @@
return T(llvm::Type::getFloatTy(*::context));
}
- Float2::Float2(RValue<Float4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
Type *Float2::getType()
{
return T(Type_v2f32);
}
- Float4::Float4(RValue<Byte4> cast) : XYZW(this)
- {
- Value *a = Int4(cast).loadValue();
- Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
-
- storeValue(xyzw);
- }
-
- Float4::Float4(RValue<SByte4> cast) : XYZW(this)
- {
- Value *a = Int4(cast).loadValue();
- Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
-
- storeValue(xyzw);
- }
-
- Float4::Float4(RValue<Short4> cast) : XYZW(this)
- {
- Int4 c(cast);
- storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
- }
-
- Float4::Float4(RValue<UShort4> cast) : XYZW(this)
- {
- Int4 c(cast);
- storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
- }
-
- Float4::Float4(RValue<Int4> cast) : XYZW(this)
- {
- Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
-
- storeValue(xyzw);
- }
-
- Float4::Float4(RValue<UInt4> cast) : XYZW(this)
- {
- RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) +
- As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u)));
-
- storeValue(result.value);
- }
-
- Float4::Float4() : XYZW(this)
- {
- }
-
- Float4::Float4(float xyzw) : XYZW(this)
- {
- constant(xyzw, xyzw, xyzw, xyzw);
- }
-
- Float4::Float4(float x, float yzw) : XYZW(this)
- {
- constant(x, yzw, yzw, yzw);
- }
-
- Float4::Float4(float x, float y, float zw) : XYZW(this)
- {
- constant(x, y, zw, zw);
- }
-
- Float4::Float4(float x, float y, float z, float w) : XYZW(this)
- {
- constant(x, y, z, w);
- }
-
- void Float4::constant(float x, float y, float z, float w)
- {
- double constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Float4::Float4(RValue<Float4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- Float4::Float4(const Float4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Float4::Float4(const Reference<Float4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
Float4::Float4(RValue<Float> rhs) : XYZW(this)
{
Value *vector = loadValue();
@@ -6582,128 +2801,6 @@
storeValue(replicate);
}
- Float4::Float4(const Float &rhs) : XYZW(this)
- {
- *this = RValue<Float>(rhs.loadValue());
- }
-
- Float4::Float4(const Reference<Float> &rhs) : XYZW(this)
- {
- *this = RValue<Float>(rhs.loadValue());
- }
-
- RValue<Float4> Float4::operator=(float x)
- {
- return *this = Float4(x, x, x, x);
- }
-
- RValue<Float4> Float4::operator=(RValue<Float4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Float4> Float4::operator=(const Float4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float4>(value);
- }
-
- RValue<Float4> Float4::operator=(const Reference<Float4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float4>(value);
- }
-
- RValue<Float4> Float4::operator=(RValue<Float> rhs)
- {
- return *this = Float4(rhs);
- }
-
- RValue<Float4> Float4::operator=(const Float &rhs)
- {
- return *this = Float4(rhs);
- }
-
- RValue<Float4> Float4::operator=(const Reference<Float> &rhs)
- {
- return *this = Float4(rhs);
- }
-
- RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFAdd(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFSub(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFMul(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFDiv(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFRem(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Float4> operator+(RValue<Float4> val)
- {
- return val;
- }
-
- RValue<Float4> operator-(RValue<Float4> val)
- {
- return RValue<Float4>(Nucleus::createFNeg(val.value));
- }
-
- RValue<Float4> Abs(RValue<Float4> x)
- {
- Value *vector = Nucleus::createBitCast(x.value, Int4::getType());
- int64_t constantVector[4] = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
- Value *result = Nucleus::createAnd(vector, Nucleus::createConstantVector(constantVector, Int4::getType()));
-
- return As<Float4>(result);
- }
-
RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -6755,55 +2852,6 @@
#endif
}
- RValue<Float4> Insert(RValue<Float4> x, RValue<Float> element, int i)
- {
- return RValue<Float4>(Nucleus::createInsertElement(x.value, element.value, i));
- }
-
- RValue<Float> Extract(RValue<Float4> x, int i)
- {
- return RValue<Float>(Nucleus::createExtractElement(x.value, Float::getType(), i));
- }
-
- RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select)
- {
- return RValue<Float4>(createSwizzle4(x.value, select));
- }
-
- RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm)
- {
- int shuffle[4] =
- {
- ((imm >> 0) & 0x03) + 0,
- ((imm >> 2) & 0x03) + 0,
- ((imm >> 4) & 0x03) + 4,
- ((imm >> 6) & 0x03) + 4,
- };
-
- return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y)
- {
- int shuffle[4] = {0, 4, 1, 5};
- return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y)
- {
- int shuffle[4] = {2, 6, 3, 7};
- return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select)
- {
- Value *vector = lhs.loadValue();
- Value *result = createMask4(vector, rhs.value, select);
- lhs.storeValue(result);
-
- return RValue<Float4>(result);
- }
-
RValue<Int> SignMask(RValue<Float4> x)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -6879,16 +2927,6 @@
return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpUGT(x.value, y.value), Int4::getType()));
}
- RValue<Int4> IsInf(RValue<Float4> x)
- {
- return CmpEQ(As<Int4>(x) & Int4(0x7FFFFFFF), Int4(0x7F800000));
- }
-
- RValue<Int4> IsNan(RValue<Float4> x)
- {
- return ~CmpEQ(x, x);
- }
-
RValue<Float4> Round(RValue<Float4> x)
{
#if defined(__i386__) || defined(__x86_64__)
@@ -6980,86 +3018,6 @@
return T(llvm::VectorType::get(T(Float::getType()), 4));
}
- RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
- {
- return lhs + RValue<Int>(Nucleus::createConstantInt(offset));
- }
-
- RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
- {
- return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value, false));
- }
-
- RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
- {
- return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value, true));
- }
-
- RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset)
- {
- return lhs = lhs + offset;
- }
-
- RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset)
- {
- return lhs = lhs + offset;
- }
-
- RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset)
- {
- return lhs = lhs + offset;
- }
-
- RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset)
- {
- return lhs + -offset;
- }
-
- RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
- {
- return lhs + -offset;
- }
-
- RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
- {
- return lhs + -offset;
- }
-
- RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset)
- {
- return lhs = lhs - offset;
- }
-
- RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset)
- {
- return lhs = lhs - offset;
- }
-
- RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset)
- {
- return lhs = lhs - offset;
- }
-
- void Return()
- {
- Nucleus::createRetVoid();
- Nucleus::setInsertBlock(Nucleus::createBasicBlock());
- Nucleus::createUnreachable();
- }
-
- void Return(RValue<Int> ret)
- {
- Nucleus::createRet(ret.value);
- Nucleus::setInsertBlock(Nucleus::createBasicBlock());
- Nucleus::createUnreachable();
- }
-
- void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB)
- {
- Nucleus::createCondBr(cmp.value, bodyBB, endBB);
- Nucleus::setInsertBlock(bodyBB);
- }
-
RValue<Long> Ticks()
{
llvm::Function *rdtsc = llvm::Intrinsic::getDeclaration(::module, llvm::Intrinsic::readcyclecounter);
diff --git a/src/Reactor/Reactor.cpp b/src/Reactor/Reactor.cpp
new file mode 100644
index 0000000..81492db
--- /dev/null
+++ b/src/Reactor/Reactor.cpp
@@ -0,0 +1,4066 @@
+// Copyright 2019 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "Reactor.hpp"
+
+namespace rr
+{
+ static Value *createSwizzle4(Value *val, unsigned char select)
+ {
+ int swizzle[4] =
+ {
+ (select >> 0) & 0x03,
+ (select >> 2) & 0x03,
+ (select >> 4) & 0x03,
+ (select >> 6) & 0x03,
+ };
+
+ return Nucleus::createShuffleVector(val, val, swizzle);
+ }
+
+ static Value *createMask4(Value *lhs, Value *rhs, unsigned char select)
+ {
+ bool mask[4] = {false, false, false, false};
+
+ mask[(select >> 0) & 0x03] = true;
+ mask[(select >> 2) & 0x03] = true;
+ mask[(select >> 4) & 0x03] = true;
+ mask[(select >> 6) & 0x03] = true;
+
+ int swizzle[4] =
+ {
+ mask[0] ? 4 : 0,
+ mask[1] ? 5 : 1,
+ mask[2] ? 6 : 2,
+ mask[3] ? 7 : 3,
+ };
+
+ return Nucleus::createShuffleVector(lhs, rhs, swizzle);
+ }
+
+ Bool::Bool(Argument<Bool> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ Bool::Bool(bool x)
+ {
+ storeValue(Nucleus::createConstantBool(x));
+ }
+
+ Bool::Bool(RValue<Bool> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Bool::Bool(const Bool &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Bool::Bool(const Reference<Bool> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Bool> Bool::operator=(RValue<Bool> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Bool> Bool::operator=(const Bool &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Bool>(value);
+ }
+
+ RValue<Bool> Bool::operator=(const Reference<Bool> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Bool>(value);
+ }
+
+ RValue<Bool> operator!(RValue<Bool> val)
+ {
+ return RValue<Bool>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs)
+ {
+ return RValue<Bool>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs)
+ {
+ return RValue<Bool>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ Byte::Byte(Argument<Byte> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ Byte::Byte(RValue<Int> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
+
+ storeValue(integer);
+ }
+
+ Byte::Byte(RValue<UInt> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
+
+ storeValue(integer);
+ }
+
+ Byte::Byte(RValue<UShort> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
+
+ storeValue(integer);
+ }
+
+ Byte::Byte(int x)
+ {
+ storeValue(Nucleus::createConstantByte((unsigned char)x));
+ }
+
+ Byte::Byte(unsigned char x)
+ {
+ storeValue(Nucleus::createConstantByte(x));
+ }
+
+ Byte::Byte(RValue<Byte> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Byte::Byte(const Byte &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Byte::Byte(const Reference<Byte> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Byte> Byte::operator=(RValue<Byte> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Byte> Byte::operator=(const Byte &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Byte>(value);
+ }
+
+ RValue<Byte> Byte::operator=(const Reference<Byte> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Byte>(value);
+ }
+
+ RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createUDiv(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createURem(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Byte>(Nucleus::createLShr(lhs.value, rhs.value));
+ }
+
+ RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<Byte> operator+(RValue<Byte> val)
+ {
+ return val;
+ }
+
+ RValue<Byte> operator-(RValue<Byte> val)
+ {
+ return RValue<Byte>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<Byte> operator~(RValue<Byte> val)
+ {
+ return RValue<Byte>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Byte> operator++(Byte &val, int) // Post-increment
+ {
+ RValue<Byte> res = val;
+
+ Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantByte((unsigned char)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const Byte &operator++(Byte &val) // Pre-increment
+ {
+ Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantByte((unsigned char)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<Byte> operator--(Byte &val, int) // Post-decrement
+ {
+ RValue<Byte> res = val;
+
+ Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantByte((unsigned char)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const Byte &operator--(Byte &val) // Pre-decrement
+ {
+ Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantByte((unsigned char)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
+ }
+
+ SByte::SByte(Argument<SByte> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ SByte::SByte(RValue<Int> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
+
+ storeValue(integer);
+ }
+
+ SByte::SByte(RValue<Short> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
+
+ storeValue(integer);
+ }
+
+ SByte::SByte(signed char x)
+ {
+ storeValue(Nucleus::createConstantByte(x));
+ }
+
+ SByte::SByte(RValue<SByte> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ SByte::SByte(const SByte &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ SByte::SByte(const Reference<SByte> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<SByte> SByte::operator=(RValue<SByte> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<SByte> SByte::operator=(const SByte &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<SByte>(value);
+ }
+
+ RValue<SByte> SByte::operator=(const Reference<SByte> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<SByte>(value);
+ }
+
+ RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createSDiv(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createSRem(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<SByte>(Nucleus::createAShr(lhs.value, rhs.value));
+ }
+
+ RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<SByte> operator+(RValue<SByte> val)
+ {
+ return val;
+ }
+
+ RValue<SByte> operator-(RValue<SByte> val)
+ {
+ return RValue<SByte>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<SByte> operator~(RValue<SByte> val)
+ {
+ return RValue<SByte>(Nucleus::createNot(val.value));
+ }
+
+ RValue<SByte> operator++(SByte &val, int) // Post-increment
+ {
+ RValue<SByte> res = val;
+
+ Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantByte((signed char)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const SByte &operator++(SByte &val) // Pre-increment
+ {
+ Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantByte((signed char)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<SByte> operator--(SByte &val, int) // Post-decrement
+ {
+ RValue<SByte> res = val;
+
+ Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantByte((signed char)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const SByte &operator--(SByte &val) // Pre-decrement
+ {
+ Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantByte((signed char)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
+ }
+
+ Short::Short(Argument<Short> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ Short::Short(RValue<Int> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, Short::getType());
+
+ storeValue(integer);
+ }
+
+ Short::Short(short x)
+ {
+ storeValue(Nucleus::createConstantShort(x));
+ }
+
+ Short::Short(RValue<Short> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Short::Short(const Short &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Short::Short(const Reference<Short> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Short> Short::operator=(RValue<Short> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Short> Short::operator=(const Short &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Short>(value);
+ }
+
+ RValue<Short> Short::operator=(const Reference<Short> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Short>(value);
+ }
+
+ RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createSDiv(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createSRem(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Short>(Nucleus::createAShr(lhs.value, rhs.value));
+ }
+
+ RValue<Short> operator+=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Short> operator-=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Short> operator*=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<Short> operator/=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<Short> operator%=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<Short> operator&=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Short> operator|=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Short> operator^=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<Short> operator+(RValue<Short> val)
+ {
+ return val;
+ }
+
+ RValue<Short> operator-(RValue<Short> val)
+ {
+ return RValue<Short>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<Short> operator~(RValue<Short> val)
+ {
+ return RValue<Short>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Short> operator++(Short &val, int) // Post-increment
+ {
+ RValue<Short> res = val;
+
+ Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantShort((short)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const Short &operator++(Short &val) // Pre-increment
+ {
+ Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantShort((short)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<Short> operator--(Short &val, int) // Post-decrement
+ {
+ RValue<Short> res = val;
+
+ Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantShort((short)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const Short &operator--(Short &val) // Pre-decrement
+ {
+ Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantShort((short)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
+ }
+
+ UShort::UShort(Argument<UShort> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ UShort::UShort(RValue<UInt> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
+
+ storeValue(integer);
+ }
+
+ UShort::UShort(RValue<Int> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
+
+ storeValue(integer);
+ }
+
+ UShort::UShort(unsigned short x)
+ {
+ storeValue(Nucleus::createConstantShort(x));
+ }
+
+ UShort::UShort(RValue<UShort> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UShort::UShort(const UShort &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UShort::UShort(const Reference<UShort> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<UShort> UShort::operator=(RValue<UShort> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<UShort> UShort::operator=(const UShort &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort>(value);
+ }
+
+ RValue<UShort> UShort::operator=(const Reference<UShort> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort>(value);
+ }
+
+ RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createUDiv(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createURem(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<UShort>(Nucleus::createLShr(lhs.value, rhs.value));
+ }
+
+ RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<UShort> operator+(RValue<UShort> val)
+ {
+ return val;
+ }
+
+ RValue<UShort> operator-(RValue<UShort> val)
+ {
+ return RValue<UShort>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<UShort> operator~(RValue<UShort> val)
+ {
+ return RValue<UShort>(Nucleus::createNot(val.value));
+ }
+
+ RValue<UShort> operator++(UShort &val, int) // Post-increment
+ {
+ RValue<UShort> res = val;
+
+ Value *inc = Nucleus::createAdd(res.value, Nucleus::createConstantShort((unsigned short)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const UShort &operator++(UShort &val) // Pre-increment
+ {
+ Value *inc = Nucleus::createAdd(val.loadValue(), Nucleus::createConstantShort((unsigned short)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<UShort> operator--(UShort &val, int) // Post-decrement
+ {
+ RValue<UShort> res = val;
+
+ Value *inc = Nucleus::createSub(res.value, Nucleus::createConstantShort((unsigned short)1));
+ val.storeValue(inc);
+
+ return res;
+ }
+
+ const UShort &operator--(UShort &val) // Pre-decrement
+ {
+ Value *inc = Nucleus::createSub(val.loadValue(), Nucleus::createConstantShort((unsigned short)1));
+ val.storeValue(inc);
+
+ return val;
+ }
+
+ RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
+ }
+
+ Byte4::Byte4(RValue<Byte8> cast)
+ {
+ storeValue(Nucleus::createBitCast(cast.value, getType()));
+ }
+
+ Byte4::Byte4(const Reference<Byte4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
+ {
+ int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Byte8::Byte8(RValue<Byte8> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Byte8::Byte8(const Byte8 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Byte8::Byte8(const Reference<Byte8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Byte8> Byte8::operator=(RValue<Byte8> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Byte8> Byte8::operator=(const Byte8 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Byte8>(value);
+ }
+
+ RValue<Byte8> Byte8::operator=(const Reference<Byte8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Byte8>(value);
+ }
+
+ RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs)
+ {
+ return RValue<Byte8>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs)
+ {
+ return RValue<Byte8>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs)
+// {
+// return RValue<Byte8>(Nucleus::createMul(lhs.value, rhs.value));
+// }
+
+// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs)
+// {
+// return RValue<Byte8>(Nucleus::createUDiv(lhs.value, rhs.value));
+// }
+
+// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs)
+// {
+// return RValue<Byte8>(Nucleus::createURem(lhs.value, rhs.value));
+// }
+
+ RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs)
+ {
+ return RValue<Byte8>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs)
+ {
+ return RValue<Byte8>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs)
+ {
+ return RValue<Byte8>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+// RValue<Byte8> operator<<(RValue<Byte8> lhs, unsigned char rhs)
+// {
+// return RValue<Byte8>(Nucleus::createShl(lhs.value, rhs.value));
+// }
+
+// RValue<Byte8> operator>>(RValue<Byte8> lhs, unsigned char rhs)
+// {
+// return RValue<Byte8>(Nucleus::createLShr(lhs.value, rhs.value));
+// }
+
+ RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+// RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs)
+// {
+// return lhs = lhs * rhs;
+// }
+
+// RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+// RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs)
+// {
+// return lhs = lhs << rhs;
+// }
+
+// RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs)
+// {
+// return lhs = lhs >> rhs;
+// }
+
+// RValue<Byte8> operator+(RValue<Byte8> val)
+// {
+// return val;
+// }
+
+// RValue<Byte8> operator-(RValue<Byte8> val)
+// {
+// return RValue<Byte8>(Nucleus::createNeg(val.value));
+// }
+
+ RValue<Byte8> operator~(RValue<Byte8> val)
+ {
+ return RValue<Byte8>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Short4> Unpack(RValue<Byte4> x)
+ {
+ int shuffle[16] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}; // Real type is v16i8
+ return As<Short4>(Nucleus::createShuffleVector(x.value, x.value, shuffle));
+ }
+
+ RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y)
+ {
+ return UnpackLow(As<Byte8>(x), As<Byte8>(y));
+ }
+
+ RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y)
+ {
+ int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
+ return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y)
+ {
+ int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
+ auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
+ }
+
+ SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
+ {
+ int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
+ Value *vector = Nucleus::createConstantVector(constantVector, getType());
+
+ storeValue(Nucleus::createBitCast(vector, getType()));
+ }
+
+ SByte8::SByte8(RValue<SByte8> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ SByte8::SByte8(const SByte8 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ SByte8::SByte8(const Reference<SByte8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<SByte8> SByte8::operator=(RValue<SByte8> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<SByte8> SByte8::operator=(const SByte8 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<SByte8>(value);
+ }
+
+ RValue<SByte8> SByte8::operator=(const Reference<SByte8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<SByte8>(value);
+ }
+
+ RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs)
+ {
+ return RValue<SByte8>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs)
+ {
+ return RValue<SByte8>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs)
+// {
+// return RValue<SByte8>(Nucleus::createMul(lhs.value, rhs.value));
+// }
+
+// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs)
+// {
+// return RValue<SByte8>(Nucleus::createSDiv(lhs.value, rhs.value));
+// }
+
+// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs)
+// {
+// return RValue<SByte8>(Nucleus::createSRem(lhs.value, rhs.value));
+// }
+
+ RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs)
+ {
+ return RValue<SByte8>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs)
+ {
+ return RValue<SByte8>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs)
+ {
+ return RValue<SByte8>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+// RValue<SByte8> operator<<(RValue<SByte8> lhs, unsigned char rhs)
+// {
+// return RValue<SByte8>(Nucleus::createShl(lhs.value, rhs.value));
+// }
+
+// RValue<SByte8> operator>>(RValue<SByte8> lhs, unsigned char rhs)
+// {
+// return RValue<SByte8>(Nucleus::createAShr(lhs.value, rhs.value));
+// }
+
+ RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+// RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs)
+// {
+// return lhs = lhs * rhs;
+// }
+
+// RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+// RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs)
+// {
+// return lhs = lhs << rhs;
+// }
+
+// RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs)
+// {
+// return lhs = lhs >> rhs;
+// }
+
+// RValue<SByte8> operator+(RValue<SByte8> val)
+// {
+// return val;
+// }
+
+// RValue<SByte8> operator-(RValue<SByte8> val)
+// {
+// return RValue<SByte8>(Nucleus::createNeg(val.value));
+// }
+
+ RValue<SByte8> operator~(RValue<SByte8> val)
+ {
+ return RValue<SByte8>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y)
+ {
+ int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
+ return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y)
+ {
+ int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
+ auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
+ }
+
+ Byte16::Byte16(RValue<Byte16> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Byte16::Byte16(const Byte16 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Byte16::Byte16(const Reference<Byte16> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Byte16> Byte16::operator=(RValue<Byte16> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Byte16> Byte16::operator=(const Byte16 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Byte16>(value);
+ }
+
+ RValue<Byte16> Byte16::operator=(const Reference<Byte16> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Byte16>(value);
+ }
+
+ Short2::Short2(RValue<Short4> cast)
+ {
+ storeValue(Nucleus::createBitCast(cast.value, getType()));
+ }
+
+ UShort2::UShort2(RValue<UShort4> cast)
+ {
+ storeValue(Nucleus::createBitCast(cast.value, getType()));
+ }
+
+ Short4::Short4(RValue<Int> cast)
+ {
+ Value *vector = loadValue();
+ Value *element = Nucleus::createTrunc(cast.value, Short::getType());
+ Value *insert = Nucleus::createInsertElement(vector, element, 0);
+ Value *swizzle = Swizzle(RValue<Short4>(insert), 0x00).value;
+
+ storeValue(swizzle);
+ }
+
+// Short4::Short4(RValue<Float> cast)
+// {
+// }
+
+ Short4::Short4(short xyzw)
+ {
+ int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Short4::Short4(short x, short y, short z, short w)
+ {
+ int64_t constantVector[4] = {x, y, z, w};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Short4::Short4(RValue<Short4> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Short4::Short4(const Short4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Short4::Short4(const Reference<Short4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Short4::Short4(RValue<UShort4> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Short4::Short4(const UShort4 &rhs)
+ {
+ storeValue(rhs.loadValue());
+ }
+
+ Short4::Short4(const Reference<UShort4> &rhs)
+ {
+ storeValue(rhs.loadValue());
+ }
+
+ RValue<Short4> Short4::operator=(RValue<Short4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Short4> Short4::operator=(const Short4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Short4>(value);
+ }
+
+ RValue<Short4> Short4::operator=(const Reference<Short4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Short4>(value);
+ }
+
+ RValue<Short4> Short4::operator=(RValue<UShort4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return RValue<Short4>(rhs);
+ }
+
+ RValue<Short4> Short4::operator=(const UShort4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Short4>(value);
+ }
+
+ RValue<Short4> Short4::operator=(const Reference<UShort4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Short4>(value);
+ }
+
+ RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs)
+ {
+ return RValue<Short4>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs)
+ {
+ return RValue<Short4>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs)
+ {
+ return RValue<Short4>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs)
+// {
+// return RValue<Short4>(Nucleus::createSDiv(lhs.value, rhs.value));
+// }
+
+// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs)
+// {
+// return RValue<Short4>(Nucleus::createSRem(lhs.value, rhs.value));
+// }
+
+ RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs)
+ {
+ return RValue<Short4>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs)
+ {
+ return RValue<Short4>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs)
+ {
+ return RValue<Short4>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+// RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+// RValue<Short4> operator+(RValue<Short4> val)
+// {
+// return val;
+// }
+
+ RValue<Short4> operator-(RValue<Short4> val)
+ {
+ return RValue<Short4>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<Short4> operator~(RValue<Short4> val)
+ {
+ return RValue<Short4>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Short4> RoundShort4(RValue<Float4> cast)
+ {
+ RValue<Int4> int4 = RoundInt(cast);
+ return As<Short4>(PackSigned(int4, int4));
+ }
+
+ RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y)
+ {
+ int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
+ return As<Int2>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y)
+ {
+ int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
+ auto lowHigh = RValue<Short8>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Int2>(Swizzle(As<Int4>(lowHigh), 0xEE));
+ }
+
+ RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select)
+ {
+ // Real type is v8i16
+ int shuffle[8] =
+ {
+ (select >> 0) & 0x03,
+ (select >> 2) & 0x03,
+ (select >> 4) & 0x03,
+ (select >> 6) & 0x03,
+ (select >> 0) & 0x03,
+ (select >> 2) & 0x03,
+ (select >> 4) & 0x03,
+ (select >> 6) & 0x03,
+ };
+
+ return As<Short4>(Nucleus::createShuffleVector(x.value, x.value, shuffle));
+ }
+
+ RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i)
+ {
+ return RValue<Short4>(Nucleus::createInsertElement(val.value, element.value, i));
+ }
+
+ RValue<Short> Extract(RValue<Short4> val, int i)
+ {
+ return RValue<Short>(Nucleus::createExtractElement(val.value, Short::getType(), i));
+ }
+
+ UShort4::UShort4(RValue<Int4> cast)
+ {
+ *this = Short4(cast);
+ }
+
+ UShort4::UShort4(unsigned short xyzw)
+ {
+ int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
+ {
+ int64_t constantVector[4] = {x, y, z, w};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ UShort4::UShort4(RValue<UShort4> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UShort4::UShort4(const UShort4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UShort4::UShort4(const Reference<UShort4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UShort4::UShort4(RValue<Short4> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UShort4::UShort4(const Short4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UShort4::UShort4(const Reference<Short4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<UShort4> UShort4::operator=(RValue<UShort4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<UShort4> UShort4::operator=(const UShort4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort4>(value);
+ }
+
+ RValue<UShort4> UShort4::operator=(const Reference<UShort4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort4>(value);
+ }
+
+ RValue<UShort4> UShort4::operator=(RValue<Short4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return RValue<UShort4>(rhs);
+ }
+
+ RValue<UShort4> UShort4::operator=(const Short4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort4>(value);
+ }
+
+ RValue<UShort4> UShort4::operator=(const Reference<Short4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort4>(value);
+ }
+
+ RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ return RValue<UShort4>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ return RValue<UShort4>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ return RValue<UShort4>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ return RValue<UShort4>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ return RValue<UShort4>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ return RValue<UShort4>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<UShort4> operator~(RValue<UShort4> val)
+ {
+ return RValue<UShort4>(Nucleus::createNot(val.value));
+ }
+
+ Short8::Short8(short c)
+ {
+ int64_t constantVector[8] = {c, c, c, c, c, c, c, c};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7)
+ {
+ int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Short8::Short8(RValue<Short8> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Short8::Short8(const Reference<Short8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Short8::Short8(RValue<Short4> lo, RValue<Short4> hi)
+ {
+ int shuffle[8] = {0, 1, 2, 3, 8, 9, 10, 11}; // Real type is v8i16
+ Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
+
+ storeValue(packed);
+ }
+
+ RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs)
+ {
+ return RValue<Short8>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs)
+ {
+ return RValue<Short8>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> Abs(RValue<Int4> x)
+ {
+ // TODO: Optimize.
+ auto negative = x >> 31;
+ return (x ^ negative) - negative;
+ }
+
+ UShort8::UShort8(unsigned short c)
+ {
+ int64_t constantVector[8] = {c, c, c, c, c, c, c, c};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ UShort8::UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7)
+ {
+ int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ UShort8::UShort8(RValue<UShort8> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UShort8::UShort8(const Reference<UShort8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UShort8::UShort8(RValue<UShort4> lo, RValue<UShort4> hi)
+ {
+ int shuffle[8] = {0, 1, 2, 3, 8, 9, 10, 11}; // Real type is v8i16
+ Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
+
+ storeValue(packed);
+ }
+
+ RValue<UShort8> UShort8::operator=(RValue<UShort8> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<UShort8> UShort8::operator=(const UShort8 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort8>(value);
+ }
+
+ RValue<UShort8> UShort8::operator=(const Reference<UShort8> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UShort8>(value);
+ }
+
+ RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs)
+ {
+ return RValue<UShort8>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs)
+ {
+ return RValue<UShort8>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs)
+ {
+ return RValue<UShort8>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<UShort8> operator~(RValue<UShort8> val)
+ {
+ return RValue<UShort8>(Nucleus::createNot(val.value));
+ }
+
+ Int::Int(Argument<Int> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ Int::Int(RValue<Byte> cast)
+ {
+ Value *integer = Nucleus::createZExt(cast.value, Int::getType());
+
+ storeValue(integer);
+ }
+
+ Int::Int(RValue<SByte> cast)
+ {
+ Value *integer = Nucleus::createSExt(cast.value, Int::getType());
+
+ storeValue(integer);
+ }
+
+ Int::Int(RValue<Short> cast)
+ {
+ Value *integer = Nucleus::createSExt(cast.value, Int::getType());
+
+ storeValue(integer);
+ }
+
+ Int::Int(RValue<UShort> cast)
+ {
+ Value *integer = Nucleus::createZExt(cast.value, Int::getType());
+
+ storeValue(integer);
+ }
+
+ Int::Int(RValue<Int2> cast)
+ {
+ *this = Extract(cast, 0);
+ }
+
+ Int::Int(RValue<Long> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, Int::getType());
+
+ storeValue(integer);
+ }
+
+ Int::Int(RValue<Float> cast)
+ {
+ Value *integer = Nucleus::createFPToSI(cast.value, Int::getType());
+
+ storeValue(integer);
+ }
+
+ Int::Int(int x)
+ {
+ storeValue(Nucleus::createConstantInt(x));
+ }
+
+ Int::Int(RValue<Int> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Int::Int(RValue<UInt> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Int::Int(const Int &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int::Int(const Reference<Int> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int::Int(const UInt &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int::Int(const Reference<UInt> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Int> Int::operator=(int rhs)
+ {
+ return RValue<Int>(storeValue(Nucleus::createConstantInt(rhs)));
+ }
+
+ RValue<Int> Int::operator=(RValue<Int> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Int> Int::operator=(RValue<UInt> rhs)
+ {
+ storeValue(rhs.value);
+
+ return RValue<Int>(rhs);
+ }
+
+ RValue<Int> Int::operator=(const Int &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int>(value);
+ }
+
+ RValue<Int> Int::operator=(const Reference<Int> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int>(value);
+ }
+
+ RValue<Int> Int::operator=(const UInt &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int>(value);
+ }
+
+ RValue<Int> Int::operator=(const Reference<UInt> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int>(value);
+ }
+
+ RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createSDiv(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createSRem(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Int>(Nucleus::createAShr(lhs.value, rhs.value));
+ }
+
+ RValue<Int> operator+=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Int> operator-=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Int> operator*=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<Int> operator/=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<Int> operator%=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<Int> operator&=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Int> operator|=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Int> operator^=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<Int> operator+(RValue<Int> val)
+ {
+ return val;
+ }
+
+ RValue<Int> operator-(RValue<Int> val)
+ {
+ return RValue<Int>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<Int> operator~(RValue<Int> val)
+ {
+ return RValue<Int>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
+ }
+
+ RValue<Int> Max(RValue<Int> x, RValue<Int> y)
+ {
+ return IfThenElse(x > y, x, y);
+ }
+
+ RValue<Int> Min(RValue<Int> x, RValue<Int> y)
+ {
+ return IfThenElse(x < y, x, y);
+ }
+
+ RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max)
+ {
+ return Min(Max(x, min), max);
+ }
+
+ Long::Long(RValue<Int> cast)
+ {
+ Value *integer = Nucleus::createSExt(cast.value, Long::getType());
+
+ storeValue(integer);
+ }
+
+ Long::Long(RValue<UInt> cast)
+ {
+ Value *integer = Nucleus::createZExt(cast.value, Long::getType());
+
+ storeValue(integer);
+ }
+
+ Long::Long(RValue<Long> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ RValue<Long> Long::operator=(int64_t rhs)
+ {
+ return RValue<Long>(storeValue(Nucleus::createConstantLong(rhs)));
+ }
+
+ RValue<Long> Long::operator=(RValue<Long> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Long> Long::operator=(const Long &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Long>(value);
+ }
+
+ RValue<Long> Long::operator=(const Reference<Long> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Long>(value);
+ }
+
+ RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs)
+ {
+ return RValue<Long>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs)
+ {
+ return RValue<Long>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs)
+ {
+ return RValue<Long>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs)
+ {
+ return RValue<Long>(Nucleus::createAShr(lhs.value, rhs.value));
+ }
+
+ RValue<Long> operator+=(Long &lhs, RValue<Long> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Long> operator-=(Long &lhs, RValue<Long> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Long> AddAtomic(RValue<Pointer<Long> > x, RValue<Long> y)
+ {
+ return RValue<Long>(Nucleus::createAtomicAdd(x.value, y.value));
+ }
+
+ UInt::UInt(Argument<UInt> argument)
+ {
+ storeValue(argument.value);
+ }
+
+ UInt::UInt(RValue<UShort> cast)
+ {
+ Value *integer = Nucleus::createZExt(cast.value, UInt::getType());
+
+ storeValue(integer);
+ }
+
+ UInt::UInt(RValue<Long> cast)
+ {
+ Value *integer = Nucleus::createTrunc(cast.value, UInt::getType());
+
+ storeValue(integer);
+ }
+
+ UInt::UInt(int x)
+ {
+ storeValue(Nucleus::createConstantInt(x));
+ }
+
+ UInt::UInt(unsigned int x)
+ {
+ storeValue(Nucleus::createConstantInt(x));
+ }
+
+ UInt::UInt(RValue<UInt> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UInt::UInt(RValue<Int> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UInt::UInt(const UInt &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt::UInt(const Reference<UInt> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt::UInt(const Int &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt::UInt(const Reference<Int> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<UInt> UInt::operator=(unsigned int rhs)
+ {
+ return RValue<UInt>(storeValue(Nucleus::createConstantInt(rhs)));
+ }
+
+ RValue<UInt> UInt::operator=(RValue<UInt> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<UInt> UInt::operator=(RValue<Int> rhs)
+ {
+ storeValue(rhs.value);
+
+ return RValue<UInt>(rhs);
+ }
+
+ RValue<UInt> UInt::operator=(const UInt &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt>(value);
+ }
+
+ RValue<UInt> UInt::operator=(const Reference<UInt> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt>(value);
+ }
+
+ RValue<UInt> UInt::operator=(const Int &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt>(value);
+ }
+
+ RValue<UInt> UInt::operator=(const Reference<Int> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt>(value);
+ }
+
+ RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createUDiv(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createURem(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<UInt>(Nucleus::createLShr(lhs.value, rhs.value));
+ }
+
+ RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<UInt> operator+(RValue<UInt> val)
+ {
+ return val;
+ }
+
+ RValue<UInt> operator-(RValue<UInt> val)
+ {
+ return RValue<UInt>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<UInt> operator~(RValue<UInt> val)
+ {
+ return RValue<UInt>(Nucleus::createNot(val.value));
+ }
+
+ RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y)
+ {
+ return IfThenElse(x > y, x, y);
+ }
+
+ RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y)
+ {
+ return IfThenElse(x < y, x, y);
+ }
+
+ RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max)
+ {
+ return Min(Max(x, min), max);
+ }
+
+ RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs)
+ {
+ return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
+ }
+
+ Int2::Int2(RValue<Int4> cast)
+ {
+ storeValue(Nucleus::createBitCast(cast.value, getType()));
+ }
+
+ Int2::Int2(int x, int y)
+ {
+ int64_t constantVector[2] = {x, y};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Int2::Int2(RValue<Int2> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Int2::Int2(const Int2 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int2::Int2(const Reference<Int2> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int2::Int2(RValue<Int> lo, RValue<Int> hi)
+ {
+ int shuffle[4] = {0, 4, 1, 5};
+ Value *packed = Nucleus::createShuffleVector(Int4(lo).loadValue(), Int4(hi).loadValue(), shuffle);
+
+ storeValue(Nucleus::createBitCast(packed, Int2::getType()));
+ }
+
+ RValue<Int2> Int2::operator=(RValue<Int2> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Int2> Int2::operator=(const Int2 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int2>(value);
+ }
+
+ RValue<Int2> Int2::operator=(const Reference<Int2> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int2>(value);
+ }
+
+ RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs)
+ {
+ return RValue<Int2>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs)
+ {
+ return RValue<Int2>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs)
+// {
+// return RValue<Int2>(Nucleus::createMul(lhs.value, rhs.value));
+// }
+
+// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs)
+// {
+// return RValue<Int2>(Nucleus::createSDiv(lhs.value, rhs.value));
+// }
+
+// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs)
+// {
+// return RValue<Int2>(Nucleus::createSRem(lhs.value, rhs.value));
+// }
+
+ RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs)
+ {
+ return RValue<Int2>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs)
+ {
+ return RValue<Int2>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs)
+ {
+ return RValue<Int2>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+// RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs)
+// {
+// return lhs = lhs * rhs;
+// }
+
+// RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+// RValue<Int2> operator+(RValue<Int2> val)
+// {
+// return val;
+// }
+
+// RValue<Int2> operator-(RValue<Int2> val)
+// {
+// return RValue<Int2>(Nucleus::createNeg(val.value));
+// }
+
+ RValue<Int2> operator~(RValue<Int2> val)
+ {
+ return RValue<Int2>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y)
+ {
+ int shuffle[4] = {0, 4, 1, 5}; // Real type is v4i32
+ return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y)
+ {
+ int shuffle[4] = {0, 4, 1, 5}; // Real type is v4i32
+ auto lowHigh = RValue<Int4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Short4>(Swizzle(lowHigh, 0xEE));
+ }
+
+ RValue<Int> Extract(RValue<Int2> val, int i)
+ {
+ return RValue<Int>(Nucleus::createExtractElement(val.value, Int::getType(), i));
+ }
+
+ RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i)
+ {
+ return RValue<Int2>(Nucleus::createInsertElement(val.value, element.value, i));
+ }
+
+ UInt2::UInt2(unsigned int x, unsigned int y)
+ {
+ int64_t constantVector[2] = {x, y};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ UInt2::UInt2(RValue<UInt2> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ UInt2::UInt2(const UInt2 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt2::UInt2(const Reference<UInt2> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<UInt2> UInt2::operator=(RValue<UInt2> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<UInt2> UInt2::operator=(const UInt2 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt2>(value);
+ }
+
+ RValue<UInt2> UInt2::operator=(const Reference<UInt2> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt2>(value);
+ }
+
+ RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs)
+ {
+ return RValue<UInt2>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs)
+ {
+ return RValue<UInt2>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs)
+// {
+// return RValue<UInt2>(Nucleus::createMul(lhs.value, rhs.value));
+// }
+
+// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs)
+// {
+// return RValue<UInt2>(Nucleus::createUDiv(lhs.value, rhs.value));
+// }
+
+// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs)
+// {
+// return RValue<UInt2>(Nucleus::createURem(lhs.value, rhs.value));
+// }
+
+ RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs)
+ {
+ return RValue<UInt2>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs)
+ {
+ return RValue<UInt2>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs)
+ {
+ return RValue<UInt2>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+// RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs)
+// {
+// return lhs = lhs * rhs;
+// }
+
+// RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+// RValue<UInt2> operator+(RValue<UInt2> val)
+// {
+// return val;
+// }
+
+// RValue<UInt2> operator-(RValue<UInt2> val)
+// {
+// return RValue<UInt2>(Nucleus::createNeg(val.value));
+// }
+
+ RValue<UInt2> operator~(RValue<UInt2> val)
+ {
+ return RValue<UInt2>(Nucleus::createNot(val.value));
+ }
+
+ Int4::Int4() : XYZW(this)
+ {
+ }
+
+ Int4::Int4(RValue<Float4> cast) : XYZW(this)
+ {
+ Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
+
+ storeValue(xyzw);
+ }
+
+ Int4::Int4(int xyzw) : XYZW(this)
+ {
+ constant(xyzw, xyzw, xyzw, xyzw);
+ }
+
+ Int4::Int4(int x, int yzw) : XYZW(this)
+ {
+ constant(x, yzw, yzw, yzw);
+ }
+
+ Int4::Int4(int x, int y, int zw) : XYZW(this)
+ {
+ constant(x, y, zw, zw);
+ }
+
+ Int4::Int4(int x, int y, int z, int w) : XYZW(this)
+ {
+ constant(x, y, z, w);
+ }
+
+ void Int4::constant(int x, int y, int z, int w)
+ {
+ int64_t constantVector[4] = {x, y, z, w};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Int4::Int4(RValue<Int4> rhs) : XYZW(this)
+ {
+ storeValue(rhs.value);
+ }
+
+ Int4::Int4(const Int4 &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int4::Int4(const Reference<Int4> &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int4::Int4(RValue<UInt4> rhs) : XYZW(this)
+ {
+ storeValue(rhs.value);
+ }
+
+ Int4::Int4(const UInt4 &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int4::Int4(const Reference<UInt4> &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Int4::Int4(RValue<Int2> lo, RValue<Int2> hi) : XYZW(this)
+ {
+ int shuffle[4] = {0, 1, 4, 5}; // Real type is v4i32
+ Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
+
+ storeValue(packed);
+ }
+
+ Int4::Int4(const Int &rhs) : XYZW(this)
+ {
+ *this = RValue<Int>(rhs.loadValue());
+ }
+
+ Int4::Int4(const Reference<Int> &rhs) : XYZW(this)
+ {
+ *this = RValue<Int>(rhs.loadValue());
+ }
+
+ RValue<Int4> Int4::operator=(RValue<Int4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Int4> Int4::operator=(const Int4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int4>(value);
+ }
+
+ RValue<Int4> Int4::operator=(const Reference<Int4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Int4>(value);
+ }
+
+ RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createSDiv(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createSRem(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs)
+ {
+ return RValue<Int4>(Nucleus::createAShr(lhs.value, rhs.value));
+ }
+
+ RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+// RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<Int4> operator+(RValue<Int4> val)
+ {
+ return val;
+ }
+
+ RValue<Int4> operator-(RValue<Int4> val)
+ {
+ return RValue<Int4>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<Int4> operator~(RValue<Int4> val)
+ {
+ return RValue<Int4>(Nucleus::createNot(val.value));
+ }
+
+ RValue<Int> Extract(RValue<Int4> x, int i)
+ {
+ return RValue<Int>(Nucleus::createExtractElement(x.value, Int::getType(), i));
+ }
+
+ RValue<Int4> Insert(RValue<Int4> x, RValue<Int> element, int i)
+ {
+ return RValue<Int4>(Nucleus::createInsertElement(x.value, element.value, i));
+ }
+
+ RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select)
+ {
+ return RValue<Int4>(createSwizzle4(x.value, select));
+ }
+
+ UInt4::UInt4() : XYZW(this)
+ {
+ }
+
+ UInt4::UInt4(int xyzw) : XYZW(this)
+ {
+ constant(xyzw, xyzw, xyzw, xyzw);
+ }
+
+ UInt4::UInt4(int x, int yzw) : XYZW(this)
+ {
+ constant(x, yzw, yzw, yzw);
+ }
+
+ UInt4::UInt4(int x, int y, int zw) : XYZW(this)
+ {
+ constant(x, y, zw, zw);
+ }
+
+ UInt4::UInt4(int x, int y, int z, int w) : XYZW(this)
+ {
+ constant(x, y, z, w);
+ }
+
+ void UInt4::constant(int x, int y, int z, int w)
+ {
+ int64_t constantVector[4] = {x, y, z, w};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ UInt4::UInt4(RValue<UInt4> rhs) : XYZW(this)
+ {
+ storeValue(rhs.value);
+ }
+
+ UInt4::UInt4(const UInt4 &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt4::UInt4(const Reference<UInt4> &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt4::UInt4(RValue<Int4> rhs) : XYZW(this)
+ {
+ storeValue(rhs.value);
+ }
+
+ UInt4::UInt4(const Int4 &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt4::UInt4(const Reference<Int4> &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ UInt4::UInt4(RValue<UInt2> lo, RValue<UInt2> hi) : XYZW(this)
+ {
+ int shuffle[4] = {0, 1, 4, 5}; // Real type is v4i32
+ Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
+
+ storeValue(packed);
+ }
+
+ RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<UInt4> UInt4::operator=(const UInt4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt4>(value);
+ }
+
+ RValue<UInt4> UInt4::operator=(const Reference<UInt4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<UInt4>(value);
+ }
+
+ RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createAdd(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createSub(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createMul(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createUDiv(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createURem(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createShl(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs)
+ {
+ return RValue<UInt4>(Nucleus::createLShr(lhs.value, rhs.value));
+ }
+
+ RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+// RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs)
+// {
+// return lhs = lhs / rhs;
+// }
+
+// RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs)
+// {
+// return lhs = lhs % rhs;
+// }
+
+ RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs)
+ {
+ return lhs = lhs & rhs;
+ }
+
+ RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs)
+ {
+ return lhs = lhs | rhs;
+ }
+
+ RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs)
+ {
+ return lhs = lhs ^ rhs;
+ }
+
+ RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs << rhs;
+ }
+
+ RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs)
+ {
+ return lhs = lhs >> rhs;
+ }
+
+ RValue<UInt4> operator+(RValue<UInt4> val)
+ {
+ return val;
+ }
+
+ RValue<UInt4> operator-(RValue<UInt4> val)
+ {
+ return RValue<UInt4>(Nucleus::createNeg(val.value));
+ }
+
+ RValue<UInt4> operator~(RValue<UInt4> val)
+ {
+ return RValue<UInt4>(Nucleus::createNot(val.value));
+ }
+
+ Half::Half(RValue<Float> cast)
+ {
+ UInt fp32i = As<UInt>(cast);
+ UInt abs = fp32i & 0x7FFFFFFF;
+ UShort fp16i((fp32i & 0x80000000) >> 16); // sign
+
+ If(abs > 0x47FFEFFF) // Infinity
+ {
+ fp16i |= UShort(0x7FFF);
+ }
+ Else
+ {
+ If(abs < 0x38800000) // Denormal
+ {
+ Int mantissa = (abs & 0x007FFFFF) | 0x00800000;
+ Int e = 113 - (abs >> 23);
+ abs = IfThenElse(e < 24, mantissa >> e, Int(0));
+ fp16i |= UShort((abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
+ }
+ Else
+ {
+ fp16i |= UShort((abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
+ }
+ }
+
+ storeValue(fp16i.loadValue());
+ }
+
+ Float::Float(RValue<Int> cast)
+ {
+ Value *integer = Nucleus::createSIToFP(cast.value, Float::getType());
+
+ storeValue(integer);
+ }
+
+ Float::Float(RValue<UInt> cast)
+ {
+ RValue<Float> result = Float(Int(cast & UInt(0x7FFFFFFF))) +
+ As<Float>((As<Int>(cast) >> 31) & As<Int>(Float(0x80000000u)));
+
+ storeValue(result.value);
+ }
+
+ Float::Float(RValue<Half> cast)
+ {
+ Int fp16i(As<UShort>(cast));
+
+ Int s = (fp16i >> 15) & 0x00000001;
+ Int e = (fp16i >> 10) & 0x0000001F;
+ Int m = fp16i & 0x000003FF;
+
+ UInt fp32i(s << 31);
+ If(e == 0)
+ {
+ If(m != 0)
+ {
+ While((m & 0x00000400) == 0)
+ {
+ m <<= 1;
+ e -= 1;
+ }
+
+ fp32i |= As<UInt>(((e + (127 - 15) + 1) << 23) | ((m & ~0x00000400) << 13));
+ }
+ }
+ Else
+ {
+ fp32i |= As<UInt>(((e + (127 - 15)) << 23) | (m << 13));
+ }
+
+ storeValue(As<Float>(fp32i).value);
+ }
+
+ Float::Float(float x)
+ {
+ storeValue(Nucleus::createConstantFloat(x));
+ }
+
+ Float::Float(RValue<Float> rhs)
+ {
+ storeValue(rhs.value);
+ }
+
+ Float::Float(const Float &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Float::Float(const Reference<Float> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ RValue<Float> Float::operator=(RValue<Float> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Float> Float::operator=(const Float &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Float>(value);
+ }
+
+ RValue<Float> Float::operator=(const Reference<Float> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Float>(value);
+ }
+
+ RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Float>(Nucleus::createFAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Float>(Nucleus::createFSub(lhs.value, rhs.value));
+ }
+
+ RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Float>(Nucleus::createFMul(lhs.value, rhs.value));
+ }
+
+ RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Float>(Nucleus::createFDiv(lhs.value, rhs.value));
+ }
+
+ RValue<Float> operator+=(Float &lhs, RValue<Float> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Float> operator-=(Float &lhs, RValue<Float> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Float> operator*=(Float &lhs, RValue<Float> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<Float> operator/=(Float &lhs, RValue<Float> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<Float> operator+(RValue<Float> val)
+ {
+ return val;
+ }
+
+ RValue<Float> operator-(RValue<Float> val)
+ {
+ return RValue<Float>(Nucleus::createFNeg(val.value));
+ }
+
+ RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Bool>(Nucleus::createFCmpOLT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Bool>(Nucleus::createFCmpOLE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Bool>(Nucleus::createFCmpOGT(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Bool>(Nucleus::createFCmpOGE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Bool>(Nucleus::createFCmpONE(lhs.value, rhs.value));
+ }
+
+ RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs)
+ {
+ return RValue<Bool>(Nucleus::createFCmpOEQ(lhs.value, rhs.value));
+ }
+
+ RValue<Float> Abs(RValue<Float> x)
+ {
+ return IfThenElse(x > 0.0f, x, -x);
+ }
+
+ RValue<Float> Max(RValue<Float> x, RValue<Float> y)
+ {
+ return IfThenElse(x > y, x, y);
+ }
+
+ RValue<Float> Min(RValue<Float> x, RValue<Float> y)
+ {
+ return IfThenElse(x < y, x, y);
+ }
+
+ Float2::Float2(RValue<Float4> cast)
+ {
+ storeValue(Nucleus::createBitCast(cast.value, getType()));
+ }
+
+ Float4::Float4(RValue<Byte4> cast) : XYZW(this)
+ {
+ Value *a = Int4(cast).loadValue();
+ Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
+
+ storeValue(xyzw);
+ }
+
+ Float4::Float4(RValue<SByte4> cast) : XYZW(this)
+ {
+ Value *a = Int4(cast).loadValue();
+ Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
+
+ storeValue(xyzw);
+ }
+
+ Float4::Float4(RValue<Short4> cast) : XYZW(this)
+ {
+ Int4 c(cast);
+ storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
+ }
+
+ Float4::Float4(RValue<UShort4> cast) : XYZW(this)
+ {
+ Int4 c(cast);
+ storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
+ }
+
+ Float4::Float4(RValue<Int4> cast) : XYZW(this)
+ {
+ Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
+
+ storeValue(xyzw);
+ }
+
+ Float4::Float4(RValue<UInt4> cast) : XYZW(this)
+ {
+ RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) +
+ As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u)));
+
+ storeValue(result.value);
+ }
+
+ Float4::Float4() : XYZW(this)
+ {
+ }
+
+ Float4::Float4(float xyzw) : XYZW(this)
+ {
+ constant(xyzw, xyzw, xyzw, xyzw);
+ }
+
+ Float4::Float4(float x, float yzw) : XYZW(this)
+ {
+ constant(x, yzw, yzw, yzw);
+ }
+
+ Float4::Float4(float x, float y, float zw) : XYZW(this)
+ {
+ constant(x, y, zw, zw);
+ }
+
+ Float4::Float4(float x, float y, float z, float w) : XYZW(this)
+ {
+ constant(x, y, z, w);
+ }
+
+ void Float4::constant(float x, float y, float z, float w)
+ {
+ double constantVector[4] = {x, y, z, w};
+ storeValue(Nucleus::createConstantVector(constantVector, getType()));
+ }
+
+ Float4::Float4(RValue<Float4> rhs) : XYZW(this)
+ {
+ storeValue(rhs.value);
+ }
+
+ Float4::Float4(const Float4 &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Float4::Float4(const Reference<Float4> &rhs) : XYZW(this)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
+ Float4::Float4(const Float &rhs) : XYZW(this)
+ {
+ *this = RValue<Float>(rhs.loadValue());
+ }
+
+ Float4::Float4(const Reference<Float> &rhs) : XYZW(this)
+ {
+ *this = RValue<Float>(rhs.loadValue());
+ }
+
+ RValue<Float4> Float4::operator=(float x)
+ {
+ return *this = Float4(x, x, x, x);
+ }
+
+ RValue<Float4> Float4::operator=(RValue<Float4> rhs)
+ {
+ storeValue(rhs.value);
+
+ return rhs;
+ }
+
+ RValue<Float4> Float4::operator=(const Float4 &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Float4>(value);
+ }
+
+ RValue<Float4> Float4::operator=(const Reference<Float4> &rhs)
+ {
+ Value *value = rhs.loadValue();
+ storeValue(value);
+
+ return RValue<Float4>(value);
+ }
+
+ RValue<Float4> Float4::operator=(RValue<Float> rhs)
+ {
+ return *this = Float4(rhs);
+ }
+
+ RValue<Float4> Float4::operator=(const Float &rhs)
+ {
+ return *this = Float4(rhs);
+ }
+
+ RValue<Float4> Float4::operator=(const Reference<Float> &rhs)
+ {
+ return *this = Float4(rhs);
+ }
+
+ RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs)
+ {
+ return RValue<Float4>(Nucleus::createFAdd(lhs.value, rhs.value));
+ }
+
+ RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs)
+ {
+ return RValue<Float4>(Nucleus::createFSub(lhs.value, rhs.value));
+ }
+
+ RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs)
+ {
+ return RValue<Float4>(Nucleus::createFMul(lhs.value, rhs.value));
+ }
+
+ RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs)
+ {
+ return RValue<Float4>(Nucleus::createFDiv(lhs.value, rhs.value));
+ }
+
+ RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs)
+ {
+ return RValue<Float4>(Nucleus::createFRem(lhs.value, rhs.value));
+ }
+
+ RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs)
+ {
+ return lhs = lhs + rhs;
+ }
+
+ RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs)
+ {
+ return lhs = lhs - rhs;
+ }
+
+ RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs)
+ {
+ return lhs = lhs * rhs;
+ }
+
+ RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs)
+ {
+ return lhs = lhs / rhs;
+ }
+
+ RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs)
+ {
+ return lhs = lhs % rhs;
+ }
+
+ RValue<Float4> operator+(RValue<Float4> val)
+ {
+ return val;
+ }
+
+ RValue<Float4> operator-(RValue<Float4> val)
+ {
+ return RValue<Float4>(Nucleus::createFNeg(val.value));
+ }
+
+ RValue<Float4> Abs(RValue<Float4> x)
+ {
+ // TODO: Optimize.
+ Value *vector = Nucleus::createBitCast(x.value, Int4::getType());
+ int64_t constantVector[4] = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
+ Value *result = Nucleus::createAnd(vector, Nucleus::createConstantVector(constantVector, Int4::getType()));
+
+ return As<Float4>(result);
+ }
+
+ RValue<Float4> Insert(RValue<Float4> x, RValue<Float> element, int i)
+ {
+ return RValue<Float4>(Nucleus::createInsertElement(x.value, element.value, i));
+ }
+
+ RValue<Float> Extract(RValue<Float4> x, int i)
+ {
+ return RValue<Float>(Nucleus::createExtractElement(x.value, Float::getType(), i));
+ }
+
+ RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select)
+ {
+ return RValue<Float4>(createSwizzle4(x.value, select));
+ }
+
+ RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm)
+ {
+ int shuffle[4] =
+ {
+ ((imm >> 0) & 0x03) + 0,
+ ((imm >> 2) & 0x03) + 0,
+ ((imm >> 4) & 0x03) + 4,
+ ((imm >> 6) & 0x03) + 4,
+ };
+
+ return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y)
+ {
+ int shuffle[4] = {0, 4, 1, 5};
+ return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y)
+ {
+ int shuffle[4] = {2, 6, 3, 7};
+ return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ }
+
+ RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select)
+ {
+ Value *vector = lhs.loadValue();
+ Value *result = createMask4(vector, rhs.value, select);
+ lhs.storeValue(result);
+
+ return RValue<Float4>(result);
+ }
+
+ RValue<Int4> IsInf(RValue<Float4> x)
+ {
+ return CmpEQ(As<Int4>(x) & Int4(0x7FFFFFFF), Int4(0x7F800000));
+ }
+
+ RValue<Int4> IsNan(RValue<Float4> x)
+ {
+ return ~CmpEQ(x, x);
+ }
+
+ RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
+ {
+ return lhs + RValue<Int>(Nucleus::createConstantInt(offset));
+ }
+
+ RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
+ {
+ return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value, false));
+ }
+
+ RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
+ {
+ return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value, true));
+ }
+
+ RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset)
+ {
+ return lhs = lhs + offset;
+ }
+
+ RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset)
+ {
+ return lhs = lhs + offset;
+ }
+
+ RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset)
+ {
+ return lhs = lhs + offset;
+ }
+
+ RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset)
+ {
+ return lhs + -offset;
+ }
+
+ RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
+ {
+ return lhs + -offset;
+ }
+
+ RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
+ {
+ return lhs + -offset;
+ }
+
+ RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset)
+ {
+ return lhs = lhs - offset;
+ }
+
+ RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset)
+ {
+ return lhs = lhs - offset;
+ }
+
+ RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset)
+ {
+ return lhs = lhs - offset;
+ }
+
+ void Return()
+ {
+ Nucleus::createRetVoid();
+ Nucleus::setInsertBlock(Nucleus::createBasicBlock());
+ Nucleus::createUnreachable();
+ }
+
+ void Return(RValue<Int> ret)
+ {
+ Nucleus::createRet(ret.value);
+ Nucleus::setInsertBlock(Nucleus::createBasicBlock());
+ Nucleus::createUnreachable();
+ }
+
+ void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB)
+ {
+ Nucleus::createCondBr(cmp.value, bodyBB, endBB);
+ Nucleus::setInsertBlock(bodyBB);
+ }
+}
diff --git a/src/Reactor/Reactor.vcxproj b/src/Reactor/Reactor.vcxproj
index b26b32f..60c15c5 100644
--- a/src/Reactor/Reactor.vcxproj
+++ b/src/Reactor/Reactor.vcxproj
@@ -289,6 +289,7 @@
<ClCompile Include="LLVMRoutineManager.cpp" />
<ClCompile Include="LLVMReactor.cpp" />
<ClCompile Include="ExecutableMemory.cpp" />
+ <ClCompile Include="Reactor.cpp" />
<ClCompile Include="Routine.cpp" />
<ClCompile Include="Thread.cpp" />
</ItemGroup>
diff --git a/src/Reactor/Reactor.vcxproj.filters b/src/Reactor/Reactor.vcxproj.filters
index d30c58e..30d695f 100644
--- a/src/Reactor/Reactor.vcxproj.filters
+++ b/src/Reactor/Reactor.vcxproj.filters
@@ -39,6 +39,9 @@
<ClCompile Include="Thread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Reactor.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Nucleus.hpp">
diff --git a/src/Reactor/Subzero.vcxproj b/src/Reactor/Subzero.vcxproj
index 29233b2..58bb4b7 100644
--- a/src/Reactor/Subzero.vcxproj
+++ b/src/Reactor/Subzero.vcxproj
@@ -224,6 +224,7 @@
<ClCompile Include="Debug.cpp" />
<ClCompile Include="ExecutableMemory.cpp" />
<ClCompile Include="Optimizer.cpp" />
+ <ClCompile Include="Reactor.cpp" />
<ClCompile Include="Routine.cpp" />
<ClCompile Include="SubzeroReactor.cpp" />
</ItemGroup>
diff --git a/src/Reactor/Subzero.vcxproj.filters b/src/Reactor/Subzero.vcxproj.filters
index f4b6f43..7229339 100644
--- a/src/Reactor/Subzero.vcxproj.filters
+++ b/src/Reactor/Subzero.vcxproj.filters
@@ -129,6 +129,9 @@
<ClCompile Include="Debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Reactor.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(SolutionDir)third_party\subzero\src\IceAssembler.h">
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index ee4b036..bd406ce 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -1292,34 +1292,6 @@
::basicBlock->appendInst(unreachable);
}
- static Value *createSwizzle4(Value *val, unsigned char select)
- {
- int swizzle[4] =
- {
- (select >> 0) & 0x03,
- (select >> 2) & 0x03,
- (select >> 4) & 0x03,
- (select >> 6) & 0x03,
- };
-
- return Nucleus::createShuffleVector(val, val, swizzle);
- }
-
- static Value *createMask4(Value *lhs, Value *rhs, unsigned char select)
- {
- int64_t mask[4] = {0, 0, 0, 0};
-
- mask[(select >> 0) & 0x03] = -1;
- mask[(select >> 2) & 0x03] = -1;
- mask[(select >> 4) & 0x03] = -1;
- mask[(select >> 6) & 0x03] = -1;
-
- Value *condition = Nucleus::createConstantVector(mask, T(Ice::IceType_v4i1));
- Value *result = Nucleus::createSelect(condition, rhs, lhs);
-
- return result;
- }
-
Type *Nucleus::getPointerType(Type *ElementType)
{
if(sizeof(void*) == 8)
@@ -1508,1052 +1480,31 @@
return T(Ice::IceType_void);
}
- Bool::Bool(Argument<Bool> argument)
- {
- storeValue(argument.value);
- }
-
- Bool::Bool(bool x)
- {
- storeValue(Nucleus::createConstantBool(x));
- }
-
- Bool::Bool(RValue<Bool> rhs)
- {
- storeValue(rhs.value);
- }
-
- Bool::Bool(const Bool &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Bool::Bool(const Reference<Bool> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Bool> Bool::operator=(RValue<Bool> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Bool> Bool::operator=(const Bool &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Bool>(value);
- }
-
- RValue<Bool> Bool::operator=(const Reference<Bool> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Bool>(value);
- }
-
- RValue<Bool> operator!(RValue<Bool> val)
- {
- return RValue<Bool>(Nucleus::createNot(val.value));
- }
-
- RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs)
- {
- return RValue<Bool>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs)
- {
- return RValue<Bool>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
Type *Bool::getType()
{
return T(Ice::IceType_i1);
}
- Byte::Byte(Argument<Byte> argument)
- {
- storeValue(argument.value);
- }
-
- Byte::Byte(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
-
- storeValue(integer);
- }
-
- Byte::Byte(RValue<UInt> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
-
- storeValue(integer);
- }
-
- Byte::Byte(RValue<UShort> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
-
- storeValue(integer);
- }
-
- Byte::Byte(int x)
- {
- storeValue(Nucleus::createConstantByte((unsigned char)x));
- }
-
- Byte::Byte(unsigned char x)
- {
- storeValue(Nucleus::createConstantByte(x));
- }
-
- Byte::Byte(RValue<Byte> rhs)
- {
- storeValue(rhs.value);
- }
-
- Byte::Byte(const Byte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Byte::Byte(const Reference<Byte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Byte> Byte::operator=(RValue<Byte> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Byte> Byte::operator=(const Byte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte>(value);
- }
-
- RValue<Byte> Byte::operator=(const Reference<Byte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte>(value);
- }
-
- RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Byte>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Byte> operator+(RValue<Byte> val)
- {
- return val;
- }
-
- RValue<Byte> operator-(RValue<Byte> val)
- {
- return RValue<Byte>(Nucleus::createNeg(val.value));
- }
-
- RValue<Byte> operator~(RValue<Byte> val)
- {
- return RValue<Byte>(Nucleus::createNot(val.value));
- }
-
- RValue<Byte> operator++(Byte &val, int) // Post-increment
- {
- RValue<Byte> res = val;
- val += Byte(1);
- return res;
- }
-
- const Byte &operator++(Byte &val) // Pre-increment
- {
- val += Byte(1);
- return val;
- }
-
- RValue<Byte> operator--(Byte &val, int) // Post-decrement
- {
- RValue<Byte> res = val;
- val -= Byte(1);
- return res;
- }
-
- const Byte &operator--(Byte &val) // Pre-decrement
- {
- val -= Byte(1);
- return val;
- }
-
- RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *Byte::getType()
{
return T(Ice::IceType_i8);
}
- SByte::SByte(Argument<SByte> argument)
- {
- storeValue(argument.value);
- }
-
- SByte::SByte(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
-
- storeValue(integer);
- }
-
- SByte::SByte(RValue<Short> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
-
- storeValue(integer);
- }
-
- SByte::SByte(signed char x)
- {
- storeValue(Nucleus::createConstantByte(x));
- }
-
- SByte::SByte(RValue<SByte> rhs)
- {
- storeValue(rhs.value);
- }
-
- SByte::SByte(const SByte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- SByte::SByte(const Reference<SByte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<SByte> SByte::operator=(RValue<SByte> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<SByte> SByte::operator=(const SByte &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte>(value);
- }
-
- RValue<SByte> SByte::operator=(const Reference<SByte> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte>(value);
- }
-
- RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<SByte>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<SByte> operator+(RValue<SByte> val)
- {
- return val;
- }
-
- RValue<SByte> operator-(RValue<SByte> val)
- {
- return RValue<SByte>(Nucleus::createNeg(val.value));
- }
-
- RValue<SByte> operator~(RValue<SByte> val)
- {
- return RValue<SByte>(Nucleus::createNot(val.value));
- }
-
- RValue<SByte> operator++(SByte &val, int) // Post-increment
- {
- RValue<SByte> res = val;
- val += SByte(1);
- return res;
- }
-
- const SByte &operator++(SByte &val) // Pre-increment
- {
- val += SByte(1);
- return val;
- }
-
- RValue<SByte> operator--(SByte &val, int) // Post-decrement
- {
- RValue<SByte> res = val;
- val -= SByte(1);
- return res;
- }
-
- const SByte &operator--(SByte &val) // Pre-decrement
- {
- val -= SByte(1);
- return val;
- }
-
- RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *SByte::getType()
{
return T(Ice::IceType_i8);
}
- Short::Short(Argument<Short> argument)
- {
- storeValue(argument.value);
- }
-
- Short::Short(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Short::getType());
-
- storeValue(integer);
- }
-
- Short::Short(short x)
- {
- storeValue(Nucleus::createConstantShort(x));
- }
-
- Short::Short(RValue<Short> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short::Short(const Short &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short::Short(const Reference<Short> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Short> Short::operator=(RValue<Short> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Short> Short::operator=(const Short &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short>(value);
- }
-
- RValue<Short> Short::operator=(const Reference<Short> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short>(value);
- }
-
- RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Short>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Short> operator+=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Short> operator-=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Short> operator*=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Short> operator/=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Short> operator%=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Short> operator&=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Short> operator|=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Short> operator^=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Short> operator+(RValue<Short> val)
- {
- return val;
- }
-
- RValue<Short> operator-(RValue<Short> val)
- {
- return RValue<Short>(Nucleus::createNeg(val.value));
- }
-
- RValue<Short> operator~(RValue<Short> val)
- {
- return RValue<Short>(Nucleus::createNot(val.value));
- }
-
- RValue<Short> operator++(Short &val, int) // Post-increment
- {
- RValue<Short> res = val;
- val += Short(1);
- return res;
- }
-
- const Short &operator++(Short &val) // Pre-increment
- {
- val += Short(1);
- return val;
- }
-
- RValue<Short> operator--(Short &val, int) // Post-decrement
- {
- RValue<Short> res = val;
- val -= Short(1);
- return res;
- }
-
- const Short &operator--(Short &val) // Pre-decrement
- {
- val -= Short(1);
- return val;
- }
-
- RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *Short::getType()
{
return T(Ice::IceType_i16);
}
- UShort::UShort(Argument<UShort> argument)
- {
- storeValue(argument.value);
- }
-
- UShort::UShort(RValue<UInt> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
-
- storeValue(integer);
- }
-
- UShort::UShort(RValue<Int> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
-
- storeValue(integer);
- }
-
- UShort::UShort(unsigned short x)
- {
- storeValue(Nucleus::createConstantShort(x));
- }
-
- UShort::UShort(RValue<UShort> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort::UShort(const UShort &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort::UShort(const Reference<UShort> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UShort> UShort::operator=(RValue<UShort> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UShort> UShort::operator=(const UShort &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort>(value);
- }
-
- RValue<UShort> UShort::operator=(const Reference<UShort> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort>(value);
- }
-
- RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<UShort>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UShort> operator+(RValue<UShort> val)
- {
- return val;
- }
-
- RValue<UShort> operator-(RValue<UShort> val)
- {
- return RValue<UShort>(Nucleus::createNeg(val.value));
- }
-
- RValue<UShort> operator~(RValue<UShort> val)
- {
- return RValue<UShort>(Nucleus::createNot(val.value));
- }
-
- RValue<UShort> operator++(UShort &val, int) // Post-increment
- {
- RValue<UShort> res = val;
- val += UShort(1);
- return res;
- }
-
- const UShort &operator++(UShort &val) // Pre-increment
- {
- val += UShort(1);
- return val;
- }
-
- RValue<UShort> operator--(UShort &val, int) // Post-decrement
- {
- RValue<UShort> res = val;
- val -= UShort(1);
- return res;
- }
-
- const UShort &operator--(UShort &val) // Pre-decrement
- {
- val -= UShort(1);
- return val;
- }
-
- RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
Type *UShort::getType()
{
return T(Ice::IceType_i16);
}
- Byte4::Byte4(RValue<Byte8> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
- Byte4::Byte4(const Reference<Byte4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
Type *Byte4::getType()
{
return T(Type_v4i8);
@@ -2564,180 +1515,22 @@
return T(Type_v4i8);
}
- Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
+ namespace
{
- int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
+ RValue<Byte> SaturateUnsigned(RValue<Short> x)
+ {
+ return Byte(IfThenElse(Int(x) > 0xFF, Int(0xFF), IfThenElse(Int(x) < 0, Int(0), Int(x))));
+ }
- Byte8::Byte8(RValue<Byte8> rhs)
- {
- storeValue(rhs.value);
- }
+ RValue<Byte> Extract(RValue<Byte8> val, int i)
+ {
+ return RValue<Byte>(Nucleus::createExtractElement(val.value, Byte::getType(), i));
+ }
- Byte8::Byte8(const Byte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Byte8::Byte8(const Reference<Byte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Byte8> Byte8::operator=(RValue<Byte8> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Byte8> Byte8::operator=(const Byte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte8>(value);
- }
-
- RValue<Byte8> Byte8::operator=(const Reference<Byte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte8>(value);
- }
-
- RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs)
-// {
-// return RValue<Byte8>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs)
-// {
-// return RValue<Byte8>(Nucleus::createUDiv(lhs.value, rhs.value));
-// }
-
-// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs)
-// {
-// return RValue<Byte8>(Nucleus::createURem(lhs.value, rhs.value));
-// }
-
- RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs)
- {
- return RValue<Byte8>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
-// RValue<Byte8> operator<<(RValue<Byte8> lhs, unsigned char rhs)
-// {
-// return RValue<Byte8>(Nucleus::createShl(lhs.value, V(::context->getConstantInt32(rhs))));
-// }
-
-// RValue<Byte8> operator>>(RValue<Byte8> lhs, unsigned char rhs)
-// {
-// return RValue<Byte8>(Nucleus::createLShr(lhs.value, V(::context->getConstantInt32(rhs))));
-// }
-
- RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
-// RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs << rhs;
-// }
-
-// RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs)
-// {
-// return lhs = lhs >> rhs;
-// }
-
-// RValue<Byte8> operator+(RValue<Byte8> val)
-// {
-// return val;
-// }
-
-// RValue<Byte8> operator-(RValue<Byte8> val)
-// {
-// return RValue<Byte8>(Nucleus::createNeg(val.value));
-// }
-
- RValue<Byte8> operator~(RValue<Byte8> val)
- {
- return RValue<Byte8>(Nucleus::createNot(val.value));
- }
-
- RValue<Byte> Extract(RValue<Byte8> val, int i)
- {
- return RValue<Byte>(Nucleus::createExtractElement(val.value, Byte::getType(), i));
- }
-
- RValue<Byte8> Insert(RValue<Byte8> val, RValue<Byte> element, int i)
- {
- return RValue<Byte8>(Nucleus::createInsertElement(val.value, element.value, i));
- }
-
- RValue<Byte> SaturateUnsigned(RValue<Short> x)
- {
- return Byte(IfThenElse(Int(x) > 0xFF, Int(0xFF), IfThenElse(Int(x) < 0, Int(0), Int(x))));
+ RValue<Byte8> Insert(RValue<Byte8> val, RValue<Byte> element, int i)
+ {
+ return RValue<Byte8>(Nucleus::createInsertElement(val.value, element.value, i));
+ }
}
RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y)
@@ -2800,30 +1593,6 @@
}
}
- RValue<Short4> Unpack(RValue<Byte4> x)
- {
- int shuffle[16] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}; // Real type is v16i8
- return As<Short4>(Nucleus::createShuffleVector(x.value, x.value, shuffle));
- }
-
- RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y)
- {
- return UnpackLow(As<Byte8>(x), As<Byte8>(y));
- }
-
- RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
- }
-
RValue<SByte> Extract(RValue<SByte8> val, int i)
{
return RValue<SByte>(Nucleus::createExtractElement(val.value, SByte::getType(), i));
@@ -2899,94 +1668,6 @@
return T(Type_v8i8);
}
- SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
- {
- int64_t constantVector[8] = { x0, x1, x2, x3, x4, x5, x6, x7 };
- Value *vector = V(Nucleus::createConstantVector(constantVector, getType()));
-
- storeValue(Nucleus::createBitCast(vector, getType()));
- }
-
- SByte8::SByte8(RValue<SByte8> rhs)
- {
- storeValue(rhs.value);
- }
-
- SByte8::SByte8(const SByte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- SByte8::SByte8(const Reference<SByte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<SByte8> SByte8::operator=(RValue<SByte8> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<SByte8> SByte8::operator=(const SByte8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte8>(value);
- }
-
- RValue<SByte8> SByte8::operator=(const Reference<SByte8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<SByte8>(value);
- }
-
- RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs)
-// {
-// return RValue<SByte8>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs)
-// {
-// return RValue<SByte8>(Nucleus::createSDiv(lhs.value, rhs.value));
-// }
-
-// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs)
-// {
-// return RValue<SByte8>(Nucleus::createSRem(lhs.value, rhs.value));
-// }
-
- RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs)
- {
- return RValue<SByte8>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
// RValue<SByte8> operator<<(RValue<SByte8> lhs, unsigned char rhs)
// {
// return RValue<SByte8>(Nucleus::createShl(lhs.value, V(::context->getConstantInt32(rhs))));
@@ -2997,71 +1678,6 @@
// return RValue<SByte8>(Nucleus::createAShr(lhs.value, V(::context->getConstantInt32(rhs))));
// }
- RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
-// RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs << rhs;
-// }
-
-// RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs)
-// {
-// return lhs = lhs >> rhs;
-// }
-
-// RValue<SByte8> operator+(RValue<SByte8> val)
-// {
-// return val;
-// }
-
-// RValue<SByte8> operator-(RValue<SByte8> val)
-// {
-// return RValue<SByte8>(Nucleus::createNeg(val.value));
-// }
-
- RValue<SByte8> operator~(RValue<SByte8> val)
- {
- return RValue<SByte8>(Nucleus::createNot(val.value));
- }
-
RValue<SByte> SaturateSigned(RValue<Short> x)
{
return SByte(IfThenElse(Int(x) > 0x7F, Int(0x7F), IfThenElse(Int(x) < -0x80, Int(0x80), Int(x))));
@@ -3127,19 +1743,6 @@
}
}
- RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y)
- {
- int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
- auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
- }
-
RValue<Int> SignMask(RValue<SByte8> x)
{
if(emulateIntrinsics || CPUID::ARM)
@@ -3175,46 +1778,6 @@
return T(Type_v8i8);
}
- Byte16::Byte16(RValue<Byte16> rhs)
- {
- storeValue(rhs.value);
- }
-
- Byte16::Byte16(const Byte16 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Byte16::Byte16(const Reference<Byte16> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Byte16> Byte16::operator=(RValue<Byte16> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Byte16> Byte16::operator=(const Byte16 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte16>(value);
- }
-
- RValue<Byte16> Byte16::operator=(const Reference<Byte16> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Byte16>(value);
- }
-
Type *Byte16::getType()
{
return T(Ice::IceType_v16i8);
@@ -3225,36 +1788,16 @@
return T(Ice::IceType_v16i8);
}
- Short2::Short2(RValue<Short4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
Type *Short2::getType()
{
return T(Type_v2i16);
}
- UShort2::UShort2(RValue<UShort4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
Type *UShort2::getType()
{
return T(Type_v2i16);
}
- Short4::Short4(RValue<Int> cast)
- {
- Value *vector = loadValue();
- Value *element = Nucleus::createTrunc(cast.value, Short::getType());
- Value *insert = Nucleus::createInsertElement(vector, element, 0);
- Value *swizzle = Swizzle(RValue<Short4>(insert), 0x00).value;
-
- storeValue(swizzle);
- }
-
Short4::Short4(RValue<Int4> cast)
{
int select[8] = {0, 2, 4, 6, 0, 2, 4, 6};
@@ -3276,136 +1819,6 @@
assert(false && "UNIMPLEMENTED");
}
- Short4::Short4(short xyzw)
- {
- int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short4::Short4(short x, short y, short z, short w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short4::Short4(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short4::Short4(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short4::Short4(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short4::Short4(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short4::Short4(const UShort4 &rhs)
- {
- storeValue(rhs.loadValue());
- }
-
- Short4::Short4(const Reference<UShort4> &rhs)
- {
- storeValue(rhs.loadValue());
- }
-
- RValue<Short4> Short4::operator=(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Short4> Short4::operator=(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> Short4::operator=(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> Short4::operator=(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<Short4>(rhs);
- }
-
- RValue<Short4> Short4::operator=(const UShort4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> Short4::operator=(const Reference<UShort4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Short4>(value);
- }
-
- RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
-// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs)
-// {
-// return RValue<Short4>(Nucleus::createSDiv(lhs.value, rhs.value));
-// }
-
-// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs)
-// {
-// return RValue<Short4>(Nucleus::createSRem(lhs.value, rhs.value));
-// }
-
- RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs)
- {
- return RValue<Short4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs)
{
if(emulateIntrinsics)
@@ -3442,77 +1855,6 @@
}
}
- RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
-// RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
-// RValue<Short4> operator+(RValue<Short4> val)
-// {
-// return val;
-// }
-
- RValue<Short4> operator-(RValue<Short4> val)
- {
- return RValue<Short4>(Nucleus::createNeg(val.value));
- }
-
- RValue<Short4> operator~(RValue<Short4> val)
- {
- return RValue<Short4>(Nucleus::createNot(val.value));
- }
-
- RValue<Short4> RoundShort4(RValue<Float4> cast)
- {
- RValue<Int4> int4 = RoundInt(cast);
- return As<Short4>(PackSigned(int4, int4));
- }
-
RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y)
{
Ice::Variable *condition = ::function->makeVariable(Ice::IceType_v8i1);
@@ -3706,47 +2048,6 @@
}
}
- RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y)
- {
- int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
- return As<Int2>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y)
- {
- int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
- auto lowHigh = RValue<Short8>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Int2>(Swizzle(As<Int4>(lowHigh), 0xEE));
- }
-
- RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select)
- {
- // Real type is v8i16
- int shuffle[8] =
- {
- (select >> 0) & 0x03,
- (select >> 2) & 0x03,
- (select >> 4) & 0x03,
- (select >> 6) & 0x03,
- (select >> 0) & 0x03,
- (select >> 2) & 0x03,
- (select >> 4) & 0x03,
- (select >> 6) & 0x03,
- };
-
- return RValue<Short4>(Nucleus::createShuffleVector(x.value, x.value, shuffle));
- }
-
- RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i)
- {
- return RValue<Short4>(Nucleus::createInsertElement(val.value, element.value, i));
- }
-
- RValue<Short> Extract(RValue<Short4> val, int i)
- {
- return RValue<Short>(Nucleus::createExtractElement(val.value, Short::getType(), i));
- }
-
RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y)
{
return RValue<Short4>(createIntCompare(Ice::InstIcmp::Sgt, x.value, y.value));
@@ -3762,11 +2063,6 @@
return T(Type_v4i16);
}
- UShort4::UShort4(RValue<Int4> cast)
- {
- *this = Short4(cast);
- }
-
UShort4::UShort4(RValue<Float4> cast, bool saturate)
{
if(saturate)
@@ -3795,128 +2091,6 @@
}
}
- UShort4::UShort4(unsigned short xyzw)
- {
- int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort4::UShort4(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort4::UShort4(const UShort4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort4::UShort4(const Reference<UShort4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort4::UShort4(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort4::UShort4(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort4::UShort4(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UShort4> UShort4::operator=(RValue<UShort4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UShort4> UShort4::operator=(const UShort4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> UShort4::operator=(const Reference<UShort4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> UShort4::operator=(RValue<Short4> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<UShort4>(rhs);
- }
-
- RValue<UShort4> UShort4::operator=(const Short4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> UShort4::operator=(const Reference<Short4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort4>(value);
- }
-
- RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs)
- {
- return RValue<UShort4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<UShort> Extract(RValue<UShort4> val, int i)
{
return RValue<UShort>(Nucleus::createExtractElement(val.value, UShort::getType(), i));
@@ -3963,21 +2137,6 @@
}
}
- RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UShort4> operator~(RValue<UShort4> val)
- {
- return RValue<UShort4>(Nucleus::createNot(val.value));
- }
-
RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y)
{
Ice::Variable *condition = ::function->makeVariable(Ice::IceType_v8i1);
@@ -4143,47 +2302,6 @@
return T(Type_v4i16);
}
- Short8::Short8(short c)
- {
- int64_t constantVector[8] = {c, c, c, c, c, c, c, c};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7)
- {
- int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Short8::Short8(RValue<Short8> rhs)
- {
- storeValue(rhs.value);
- }
-
- Short8::Short8(const Reference<Short8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Short8::Short8(RValue<Short4> lo, RValue<Short4> hi)
- {
- int shuffle[8] = {0, 1, 2, 3, 8, 9, 10, 11}; // Real type is v8i16
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
- RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs)
- {
- return RValue<Short8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs)
- {
- return RValue<Short8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
RValue<Short> Extract(RValue<Short8> val, int i)
{
return RValue<Short>(Nucleus::createExtractElement(val.value, Short::getType(), i));
@@ -4243,12 +2361,6 @@
assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
}
- RValue<Int4> Abs(RValue<Int4> x)
- {
- auto negative = x >> 31;
- return (x ^ negative) - negative;
- }
-
RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y)
{
assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
@@ -4259,65 +2371,6 @@
return T(Ice::IceType_v8i16);
}
- UShort8::UShort8(unsigned short c)
- {
- int64_t constantVector[8] = {c, c, c, c, c, c, c, c};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort8::UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7)
- {
- int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UShort8::UShort8(RValue<UShort8> rhs)
- {
- storeValue(rhs.value);
- }
-
- UShort8::UShort8(const Reference<UShort8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UShort8::UShort8(RValue<UShort4> lo, RValue<UShort4> hi)
- {
- int shuffle[8] = {0, 1, 2, 3, 8, 9, 10, 11}; // Real type is v8i16
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
- RValue<UShort8> UShort8::operator=(RValue<UShort8> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UShort8> UShort8::operator=(const UShort8 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort8>(value);
- }
-
- RValue<UShort8> UShort8::operator=(const Reference<UShort8> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UShort8>(value);
- }
-
- RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs)
- {
- return RValue<UShort8>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
RValue<UShort> Extract(RValue<UShort8> val, int i)
{
return RValue<UShort>(Nucleus::createExtractElement(val.value, UShort::getType(), i));
@@ -4372,26 +2425,6 @@
}
}
- RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs)
- {
- return RValue<UShort8>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs)
- {
- return RValue<UShort8>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UShort8> operator~(RValue<UShort8> val)
- {
- return RValue<UShort8>(Nucleus::createNot(val.value));
- }
-
RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7)
{
assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
@@ -4413,263 +2446,6 @@
return T(Ice::IceType_v8i16);
}
- Int::Int(Argument<Int> argument)
- {
- storeValue(argument.value);
- }
-
- Int::Int(RValue<Byte> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<SByte> cast)
- {
- Value *integer = Nucleus::createSExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<Short> cast)
- {
- Value *integer = Nucleus::createSExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<UShort> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<Int2> cast)
- {
- *this = Extract(cast, 0);
- }
-
- Int::Int(RValue<Long> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(RValue<Float> cast)
- {
- Value *integer = Nucleus::createFPToSI(cast.value, Int::getType());
-
- storeValue(integer);
- }
-
- Int::Int(int x)
- {
- storeValue(Nucleus::createConstantInt(x));
- }
-
- Int::Int(RValue<Int> rhs)
- {
- storeValue(rhs.value);
- }
-
- Int::Int(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
- }
-
- Int::Int(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int::Int(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int::Int(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int::Int(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Int> Int::operator=(int rhs)
- {
- return RValue<Int>(storeValue(Nucleus::createConstantInt(rhs)));
- }
-
- RValue<Int> Int::operator=(RValue<Int> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Int> Int::operator=(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<Int>(rhs);
- }
-
- RValue<Int> Int::operator=(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> Int::operator=(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> Int::operator=(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> Int::operator=(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int>(value);
- }
-
- RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Int>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Int> operator+=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Int> operator-=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Int> operator*=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Int> operator/=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Int> operator%=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Int> operator&=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Int> operator|=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Int> operator^=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Int> operator+(RValue<Int> val)
- {
- return val;
- }
-
- RValue<Int> operator-(RValue<Int> val)
- {
- return RValue<Int>(Nucleus::createNeg(val.value));
- }
-
- RValue<Int> operator~(RValue<Int> val)
- {
- return RValue<Int>(Nucleus::createNot(val.value));
- }
-
RValue<Int> operator++(Int &val, int) // Post-increment
{
RValue<Int> res = val;
@@ -4696,51 +2472,6 @@
return val;
}
- RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
- RValue<Int> Max(RValue<Int> x, RValue<Int> y)
- {
- return IfThenElse(x > y, x, y);
- }
-
- RValue<Int> Min(RValue<Int> x, RValue<Int> y)
- {
- return IfThenElse(x < y, x, y);
- }
-
- RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max)
- {
- return Min(Max(x, min), max);
- }
-
RValue<Int> RoundInt(RValue<Float> cast)
{
if(emulateIntrinsics || CPUID::ARM)
@@ -4766,112 +2497,11 @@
return T(Ice::IceType_i32);
}
- Long::Long(RValue<Int> cast)
- {
- Value *integer = Nucleus::createSExt(cast.value, Long::getType());
-
- storeValue(integer);
- }
-
- Long::Long(RValue<UInt> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, Long::getType());
-
- storeValue(integer);
- }
-
- Long::Long(RValue<Long> rhs)
- {
- storeValue(rhs.value);
- }
-
- RValue<Long> Long::operator=(int64_t rhs)
- {
- return RValue<Long>(storeValue(Nucleus::createConstantLong(rhs)));
- }
-
- RValue<Long> Long::operator=(RValue<Long> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Long> Long::operator=(const Long &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Long>(value);
- }
-
- RValue<Long> Long::operator=(const Reference<Long> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Long>(value);
- }
-
- RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs)
- {
- return RValue<Long>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Long> operator+=(Long &lhs, RValue<Long> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Long> operator-=(Long &lhs, RValue<Long> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Long> AddAtomic(RValue<Pointer<Long> > x, RValue<Long> y)
- {
- return RValue<Long>(Nucleus::createAtomicAdd(x.value, y.value));
- }
-
Type *Long::getType()
{
return T(Ice::IceType_i64);
}
- UInt::UInt(Argument<UInt> argument)
- {
- storeValue(argument.value);
- }
-
- UInt::UInt(RValue<UShort> cast)
- {
- Value *integer = Nucleus::createZExt(cast.value, UInt::getType());
-
- storeValue(integer);
- }
-
- UInt::UInt(RValue<Long> cast)
- {
- Value *integer = Nucleus::createTrunc(cast.value, UInt::getType());
-
- storeValue(integer);
- }
-
UInt::UInt(RValue<Float> cast)
{
// Smallest positive value representable in UInt, but not in Int
@@ -4888,216 +2518,6 @@
Int(cast))).value);
}
- UInt::UInt(int x)
- {
- storeValue(Nucleus::createConstantInt(x));
- }
-
- UInt::UInt(unsigned int x)
- {
- storeValue(Nucleus::createConstantInt(x));
- }
-
- UInt::UInt(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
- }
-
- UInt::UInt(RValue<Int> rhs)
- {
- storeValue(rhs.value);
- }
-
- UInt::UInt(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt::UInt(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt::UInt(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt::UInt(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UInt> UInt::operator=(unsigned int rhs)
- {
- return RValue<UInt>(storeValue(Nucleus::createConstantInt(rhs)));
- }
-
- RValue<UInt> UInt::operator=(RValue<UInt> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UInt> UInt::operator=(RValue<Int> rhs)
- {
- storeValue(rhs.value);
-
- return RValue<UInt>(rhs);
- }
-
- RValue<UInt> UInt::operator=(const UInt &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> UInt::operator=(const Reference<UInt> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> UInt::operator=(const Int &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> UInt::operator=(const Reference<Int> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt>(value);
- }
-
- RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<UInt>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UInt> operator+(RValue<UInt> val)
- {
- return val;
- }
-
- RValue<UInt> operator-(RValue<UInt> val)
- {
- return RValue<UInt>(Nucleus::createNeg(val.value));
- }
-
- RValue<UInt> operator~(RValue<UInt> val)
- {
- return RValue<UInt>(Nucleus::createNot(val.value));
- }
-
RValue<UInt> operator++(UInt &val, int) // Post-increment
{
RValue<UInt> res = val;
@@ -5124,51 +2544,6 @@
return val;
}
- RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y)
- {
- return IfThenElse(x > y, x, y);
- }
-
- RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y)
- {
- return IfThenElse(x < y, x, y);
- }
-
- RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max)
- {
- return Min(Max(x, min), max);
- }
-
- RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs)
- {
- return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
- }
-
// RValue<UInt> RoundUInt(RValue<Float> cast)
// {
// assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
@@ -5193,105 +2568,6 @@
// storeValue(replicate);
// }
- Int2::Int2(RValue<Int4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
- Int2::Int2(int x, int y)
- {
- int64_t constantVector[2] = {x, y};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Int2::Int2(RValue<Int2> rhs)
- {
- storeValue(rhs.value);
- }
-
- Int2::Int2(const Int2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int2::Int2(const Reference<Int2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int2::Int2(RValue<Int> lo, RValue<Int> hi)
- {
- int shuffle[4] = {0, 4, 1, 5};
- Value *packed = Nucleus::createShuffleVector(Int4(lo).loadValue(), Int4(hi).loadValue(), shuffle);
-
- storeValue(Nucleus::createBitCast(packed, Int2::getType()));
- }
-
- RValue<Int2> Int2::operator=(RValue<Int2> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Int2> Int2::operator=(const Int2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int2>(value);
- }
-
- RValue<Int2> Int2::operator=(const Reference<Int2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int2>(value);
- }
-
- RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs)
-// {
-// return RValue<Int2>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs)
-// {
-// return RValue<Int2>(Nucleus::createSDiv(lhs.value, rhs.value));
-// }
-
-// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs)
-// {
-// return RValue<Int2>(Nucleus::createSRem(lhs.value, rhs.value));
-// }
-
- RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs)
- {
- return RValue<Int2>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs)
{
if(emulateIntrinsics)
@@ -5324,185 +2600,11 @@
}
}
- RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
-// RValue<Int2> operator+(RValue<Int2> val)
-// {
-// return val;
-// }
-
-// RValue<Int2> operator-(RValue<Int2> val)
-// {
-// return RValue<Int2>(Nucleus::createNeg(val.value));
-// }
-
- RValue<Int2> operator~(RValue<Int2> val)
- {
- return RValue<Int2>(Nucleus::createNot(val.value));
- }
-
- RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y)
- {
- int shuffle[4] = {0, 4, 1, 5}; // Real type is v4i32
- return As<Short4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y)
- {
- int shuffle[4] = {0, 4, 1, 5}; // Real type is v4i32
- auto lowHigh = RValue<Int4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- return As<Short4>(Swizzle(lowHigh, 0xEE));
- }
-
- RValue<Int> Extract(RValue<Int2> val, int i)
- {
- return RValue<Int>(Nucleus::createExtractElement(val.value, Int::getType(), i));
- }
-
- RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i)
- {
- return RValue<Int2>(Nucleus::createInsertElement(val.value, element.value, i));
- }
-
Type *Int2::getType()
{
return T(Type_v2i32);
}
- UInt2::UInt2(unsigned int x, unsigned int y)
- {
- int64_t constantVector[2] = {x, y};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UInt2::UInt2(RValue<UInt2> rhs)
- {
- storeValue(rhs.value);
- }
-
- UInt2::UInt2(const UInt2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt2::UInt2(const Reference<UInt2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<UInt2> UInt2::operator=(RValue<UInt2> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UInt2> UInt2::operator=(const UInt2 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt2>(value);
- }
-
- RValue<UInt2> UInt2::operator=(const Reference<UInt2> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt2>(value);
- }
-
- RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
-// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs)
-// {
-// return RValue<UInt2>(Nucleus::createMul(lhs.value, rhs.value));
-// }
-
-// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs)
-// {
-// return RValue<UInt2>(Nucleus::createUDiv(lhs.value, rhs.value));
-// }
-
-// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs)
-// {
-// return RValue<UInt2>(Nucleus::createURem(lhs.value, rhs.value));
-// }
-
- RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs)
- {
- return RValue<UInt2>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<UInt> Extract(RValue<UInt2> val, int i)
{
return RValue<UInt>(Nucleus::createExtractElement(val.value, UInt::getType(), i));
@@ -5545,80 +2647,11 @@
}
}
- RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs - rhs;
- }
-
-// RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs)
-// {
-// return lhs = lhs * rhs;
-// }
-
-// RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
-// RValue<UInt2> operator+(RValue<UInt2> val)
-// {
-// return val;
-// }
-
-// RValue<UInt2> operator-(RValue<UInt2> val)
-// {
-// return RValue<UInt2>(Nucleus::createNeg(val.value));
-// }
-
- RValue<UInt2> operator~(RValue<UInt2> val)
- {
- return RValue<UInt2>(Nucleus::createNot(val.value));
- }
-
Type *UInt2::getType()
{
return T(Type_v2i32);
}
- Int4::Int4() : XYZW(this)
- {
- }
-
Int4::Int4(RValue<Byte4> cast) : XYZW(this)
{
Value *x = Nucleus::createBitCast(cast.value, Int::getType());
@@ -5653,13 +2686,6 @@
*this = As<Int4>(e) >> 24;
}
- Int4::Int4(RValue<Float4> cast) : XYZW(this)
- {
- Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
-
- storeValue(xyzw);
- }
-
Int4::Int4(RValue<Short4> cast) : XYZW(this)
{
int swizzle[8] = {0, 0, 1, 1, 2, 2, 3, 3};
@@ -5676,74 +2702,6 @@
storeValue(d);
}
- Int4::Int4(int xyzw) : XYZW(this)
- {
- constant(xyzw, xyzw, xyzw, xyzw);
- }
-
- Int4::Int4(int x, int yzw) : XYZW(this)
- {
- constant(x, yzw, yzw, yzw);
- }
-
- Int4::Int4(int x, int y, int zw) : XYZW(this)
- {
- constant(x, y, zw, zw);
- }
-
- Int4::Int4(int x, int y, int z, int w) : XYZW(this)
- {
- constant(x, y, z, w);
- }
-
- void Int4::constant(int x, int y, int z, int w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Int4::Int4(RValue<Int4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- Int4::Int4(const Int4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(const Reference<Int4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(RValue<UInt4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- Int4::Int4(const UInt4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(const Reference<UInt4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Int4::Int4(RValue<Int2> lo, RValue<Int2> hi) : XYZW(this)
- {
- int shuffle[4] = {0, 1, 4, 5}; // Real type is v4i32
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
Int4::Int4(RValue<Int> rhs) : XYZW(this)
{
Value *vector = Nucleus::createBitCast(rhs.value, Int4::getType());
@@ -5754,79 +2712,6 @@
storeValue(replicate);
}
- Int4::Int4(const Int &rhs) : XYZW(this)
- {
- *this = RValue<Int>(rhs.loadValue());
- }
-
- Int4::Int4(const Reference<Int> &rhs) : XYZW(this)
- {
- *this = RValue<Int>(rhs.loadValue());
- }
-
- RValue<Int4> Int4::operator=(RValue<Int4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Int4> Int4::operator=(const Int4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int4>(value);
- }
-
- RValue<Int4> Int4::operator=(const Reference<Int4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Int4>(value);
- }
-
- RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createSDiv(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createSRem(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs)
{
if(emulateIntrinsics)
@@ -5863,81 +2748,6 @@
}
}
- RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs)
- {
- return RValue<Int4>(Nucleus::createAShr(lhs.value, rhs.value));
- }
-
- RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
-// RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<Int4> operator+(RValue<Int4> val)
- {
- return val;
- }
-
- RValue<Int4> operator-(RValue<Int4> val)
- {
- return RValue<Int4>(Nucleus::createNeg(val.value));
- }
-
- RValue<Int4> operator~(RValue<Int4> val)
- {
- return RValue<Int4>(Nucleus::createNot(val.value));
- }
-
RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y)
{
return RValue<Int4>(Nucleus::createICmpEQ(x.value, y.value));
@@ -6070,16 +2880,6 @@
}
}
- RValue<Int> Extract(RValue<Int4> x, int i)
- {
- return RValue<Int>(Nucleus::createExtractElement(x.value, Int::getType(), i));
- }
-
- RValue<Int4> Insert(RValue<Int4> x, RValue<Int> element, int i)
- {
- return RValue<Int4>(Nucleus::createInsertElement(x.value, element.value, i));
- }
-
RValue<Int> SignMask(RValue<Int4> x)
{
if(emulateIntrinsics || CPUID::ARM)
@@ -6100,20 +2900,11 @@
}
}
- RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select)
- {
- return RValue<Int4>(createSwizzle4(x.value, select));
- }
-
Type *Int4::getType()
{
return T(Ice::IceType_v4i32);
}
- UInt4::UInt4() : XYZW(this)
- {
- }
-
UInt4::UInt4(RValue<Float4> cast) : XYZW(this)
{
// Smallest positive value representable in UInt, but not in Int
@@ -6130,137 +2921,6 @@
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
}
- UInt4::UInt4(int xyzw) : XYZW(this)
- {
- constant(xyzw, xyzw, xyzw, xyzw);
- }
-
- UInt4::UInt4(int x, int yzw) : XYZW(this)
- {
- constant(x, yzw, yzw, yzw);
- }
-
- UInt4::UInt4(int x, int y, int zw) : XYZW(this)
- {
- constant(x, y, zw, zw);
- }
-
- UInt4::UInt4(int x, int y, int z, int w) : XYZW(this)
- {
- constant(x, y, z, w);
- }
-
- void UInt4::constant(int x, int y, int z, int w)
- {
- int64_t constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- UInt4::UInt4(RValue<UInt4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- UInt4::UInt4(const UInt4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(const Reference<UInt4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(RValue<Int4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- UInt4::UInt4(const Int4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(const Reference<Int4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- UInt4::UInt4(RValue<UInt2> lo, RValue<UInt2> hi) : XYZW(this)
- {
- int shuffle[4] = {0, 1, 4, 5}; // Real type is v4i32
- Value *packed = Nucleus::createShuffleVector(lo.value, hi.value, shuffle);
-
- storeValue(packed);
- }
-
- RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<UInt4> UInt4::operator=(const UInt4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt4>(value);
- }
-
- RValue<UInt4> UInt4::operator=(const Reference<UInt4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<UInt4>(value);
- }
-
- RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createAdd(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createSub(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createMul(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createUDiv(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createURem(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createAnd(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createOr(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createXor(lhs.value, rhs.value));
- }
-
RValue<UInt> Extract(RValue<UInt4> x, int i)
{
return RValue<UInt>(Nucleus::createExtractElement(x.value, UInt::getType(), i));
@@ -6307,81 +2967,6 @@
}
}
- RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createShl(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs)
- {
- return RValue<UInt4>(Nucleus::createLShr(lhs.value, rhs.value));
- }
-
- RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
-// RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs)
-// {
-// return lhs = lhs / rhs;
-// }
-
-// RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs)
-// {
-// return lhs = lhs % rhs;
-// }
-
- RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs & rhs;
- }
-
- RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs | rhs;
- }
-
- RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs)
- {
- return lhs = lhs ^ rhs;
- }
-
- RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs)
- {
- return lhs = lhs << rhs;
- }
-
- RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs)
- {
- return lhs = lhs >> rhs;
- }
-
- RValue<UInt4> operator+(RValue<UInt4> val)
- {
- return val;
- }
-
- RValue<UInt4> operator-(RValue<UInt4> val)
- {
- return RValue<UInt4>(Nucleus::createNeg(val.value));
- }
-
- RValue<UInt4> operator~(RValue<UInt4> val)
- {
- return RValue<UInt4>(Nucleus::createNot(val.value));
- }
-
RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y)
{
return RValue<UInt4>(Nucleus::createICmpEQ(x.value, y.value));
@@ -6443,224 +3028,11 @@
return T(Ice::IceType_v4i32);
}
- Half::Half(RValue<Float> cast)
- {
- UInt fp32i = As<UInt>(cast);
- UInt abs = fp32i & 0x7FFFFFFF;
- UShort fp16i((fp32i & 0x80000000) >> 16); // sign
-
- If(abs > 0x47FFEFFF) // Infinity
- {
- fp16i |= UShort(0x7FFF);
- }
- Else
- {
- If(abs < 0x38800000) // Denormal
- {
- Int mantissa = (abs & 0x007FFFFF) | 0x00800000;
- Int e = 113 - (abs >> 23);
- abs = IfThenElse(e < 24, mantissa >> e, Int(0));
- fp16i |= UShort((abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
- }
- Else
- {
- fp16i |= UShort((abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
- }
- }
-
- storeValue(fp16i.loadValue());
- }
-
Type *Half::getType()
{
return T(Ice::IceType_i16);
}
- Float::Float(RValue<Int> cast)
- {
- Value *integer = Nucleus::createSIToFP(cast.value, Float::getType());
-
- storeValue(integer);
- }
-
- Float::Float(RValue<UInt> cast)
- {
- RValue<Float> result = Float(Int(cast & UInt(0x7FFFFFFF))) +
- As<Float>((As<Int>(cast) >> 31) & As<Int>(Float(0x80000000u)));
-
- storeValue(result.value);
- }
-
- Float::Float(RValue<Half> cast)
- {
- Int fp16i(As<UShort>(cast));
-
- Int s = (fp16i >> 15) & 0x00000001;
- Int e = (fp16i >> 10) & 0x0000001F;
- Int m = fp16i & 0x000003FF;
-
- UInt fp32i(s << 31);
- If(e == 0)
- {
- If(m != 0)
- {
- While((m & 0x00000400) == 0)
- {
- m <<= 1;
- e -= 1;
- }
-
- fp32i |= As<UInt>(((e + (127 - 15) + 1) << 23) | ((m & ~0x00000400) << 13));
- }
- }
- Else
- {
- fp32i |= As<UInt>(((e + (127 - 15)) << 23) | (m << 13));
- }
-
- storeValue(As<Float>(fp32i).value);
- }
-
- Float::Float(float x)
- {
- storeValue(Nucleus::createConstantFloat(x));
- }
-
- Float::Float(RValue<Float> rhs)
- {
- storeValue(rhs.value);
- }
-
- Float::Float(const Float &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Float::Float(const Reference<Float> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- RValue<Float> Float::operator=(RValue<Float> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Float> Float::operator=(const Float &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float>(value);
- }
-
- RValue<Float> Float::operator=(const Reference<Float> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float>(value);
- }
-
- RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFAdd(lhs.value, rhs.value));
- }
-
- RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFSub(lhs.value, rhs.value));
- }
-
- RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFMul(lhs.value, rhs.value));
- }
-
- RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Float>(Nucleus::createFDiv(lhs.value, rhs.value));
- }
-
- RValue<Float> operator+=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Float> operator-=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Float> operator*=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Float> operator/=(Float &lhs, RValue<Float> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Float> operator+(RValue<Float> val)
- {
- return val;
- }
-
- RValue<Float> operator-(RValue<Float> val)
- {
- return RValue<Float>(Nucleus::createFNeg(val.value));
- }
-
- RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOLT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOLE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOGT(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOGE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpONE(lhs.value, rhs.value));
- }
-
- RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs)
- {
- return RValue<Bool>(Nucleus::createFCmpOEQ(lhs.value, rhs.value));
- }
-
- RValue<Float> Abs(RValue<Float> x)
- {
- return IfThenElse(x > 0.0f, x, -x);
- }
-
- RValue<Float> Max(RValue<Float> x, RValue<Float> y)
- {
- return IfThenElse(x > y, x, y);
- }
-
- RValue<Float> Min(RValue<Float> x, RValue<Float> y)
- {
- return IfThenElse(x < y, x, y);
- }
-
RValue<Float> Rcp_pp(RValue<Float> x, bool exactAtPow2)
{
return 1.0f / x;
@@ -6713,106 +3085,11 @@
return T(Ice::IceType_f32);
}
- Float2::Float2(RValue<Float4> cast)
- {
- storeValue(Nucleus::createBitCast(cast.value, getType()));
- }
-
Type *Float2::getType()
{
return T(Type_v2f32);
}
- Float4::Float4(RValue<Byte4> cast) : XYZW(this)
- {
- Value *a = Int4(cast).loadValue();
- Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
-
- storeValue(xyzw);
- }
-
- Float4::Float4(RValue<SByte4> cast) : XYZW(this)
- {
- Value *a = Int4(cast).loadValue();
- Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
-
- storeValue(xyzw);
- }
-
- Float4::Float4(RValue<Short4> cast) : XYZW(this)
- {
- Int4 c(cast);
- storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
- }
-
- Float4::Float4(RValue<UShort4> cast) : XYZW(this)
- {
- Int4 c(cast);
- storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
- }
-
- Float4::Float4(RValue<Int4> cast) : XYZW(this)
- {
- Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
-
- storeValue(xyzw);
- }
-
- Float4::Float4(RValue<UInt4> cast) : XYZW(this)
- {
- RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) +
- As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u)));
-
- storeValue(result.value);
- }
-
- Float4::Float4() : XYZW(this)
- {
- }
-
- Float4::Float4(float xyzw) : XYZW(this)
- {
- constant(xyzw, xyzw, xyzw, xyzw);
- }
-
- Float4::Float4(float x, float yzw) : XYZW(this)
- {
- constant(x, yzw, yzw, yzw);
- }
-
- Float4::Float4(float x, float y, float zw) : XYZW(this)
- {
- constant(x, y, zw, zw);
- }
-
- Float4::Float4(float x, float y, float z, float w) : XYZW(this)
- {
- constant(x, y, z, w);
- }
-
- void Float4::constant(float x, float y, float z, float w)
- {
- double constantVector[4] = {x, y, z, w};
- storeValue(Nucleus::createConstantVector(constantVector, getType()));
- }
-
- Float4::Float4(RValue<Float4> rhs) : XYZW(this)
- {
- storeValue(rhs.value);
- }
-
- Float4::Float4(const Float4 &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
- Float4::Float4(const Reference<Float4> &rhs) : XYZW(this)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
- }
-
Float4::Float4(RValue<Float> rhs) : XYZW(this)
{
Value *vector = Nucleus::createBitCast(rhs.value, Float4::getType());
@@ -6823,128 +3100,6 @@
storeValue(replicate);
}
- Float4::Float4(const Float &rhs) : XYZW(this)
- {
- *this = RValue<Float>(rhs.loadValue());
- }
-
- Float4::Float4(const Reference<Float> &rhs) : XYZW(this)
- {
- *this = RValue<Float>(rhs.loadValue());
- }
-
- RValue<Float4> Float4::operator=(float x)
- {
- return *this = Float4(x, x, x, x);
- }
-
- RValue<Float4> Float4::operator=(RValue<Float4> rhs)
- {
- storeValue(rhs.value);
-
- return rhs;
- }
-
- RValue<Float4> Float4::operator=(const Float4 &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float4>(value);
- }
-
- RValue<Float4> Float4::operator=(const Reference<Float4> &rhs)
- {
- Value *value = rhs.loadValue();
- storeValue(value);
-
- return RValue<Float4>(value);
- }
-
- RValue<Float4> Float4::operator=(RValue<Float> rhs)
- {
- return *this = Float4(rhs);
- }
-
- RValue<Float4> Float4::operator=(const Float &rhs)
- {
- return *this = Float4(rhs);
- }
-
- RValue<Float4> Float4::operator=(const Reference<Float> &rhs)
- {
- return *this = Float4(rhs);
- }
-
- RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFAdd(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFSub(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFMul(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFDiv(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs)
- {
- return RValue<Float4>(Nucleus::createFRem(lhs.value, rhs.value));
- }
-
- RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs + rhs;
- }
-
- RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs - rhs;
- }
-
- RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs * rhs;
- }
-
- RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs / rhs;
- }
-
- RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs)
- {
- return lhs = lhs % rhs;
- }
-
- RValue<Float4> operator+(RValue<Float4> val)
- {
- return val;
- }
-
- RValue<Float4> operator-(RValue<Float4> val)
- {
- return RValue<Float4>(Nucleus::createFNeg(val.value));
- }
-
- RValue<Float4> Abs(RValue<Float4> x)
- {
- Value *vector = Nucleus::createBitCast(x.value, Int4::getType());
- int64_t constantVector[4] = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
- Value *result = Nucleus::createAnd(vector, V(Nucleus::createConstantVector(constantVector, Int4::getType())));
-
- return As<Float4>(result);
- }
-
RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y)
{
Ice::Variable *condition = ::function->makeVariable(Ice::IceType_v4i1);
@@ -7006,55 +3161,6 @@
}
}
- RValue<Float4> Insert(RValue<Float4> x, RValue<Float> element, int i)
- {
- return RValue<Float4>(Nucleus::createInsertElement(x.value, element.value, i));
- }
-
- RValue<Float> Extract(RValue<Float4> x, int i)
- {
- return RValue<Float>(Nucleus::createExtractElement(x.value, Float::getType(), i));
- }
-
- RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select)
- {
- return RValue<Float4>(createSwizzle4(x.value, select));
- }
-
- RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm)
- {
- int shuffle[4] =
- {
- ((imm >> 0) & 0x03) + 0,
- ((imm >> 2) & 0x03) + 0,
- ((imm >> 4) & 0x03) + 4,
- ((imm >> 6) & 0x03) + 4,
- };
-
- return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y)
- {
- int shuffle[4] = {0, 4, 1, 5};
- return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y)
- {
- int shuffle[4] = {2, 6, 3, 7};
- return RValue<Float4>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
- }
-
- RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select)
- {
- Value *vector = lhs.loadValue();
- Value *result = createMask4(vector, rhs.value, select);
- lhs.storeValue(result);
-
- return RValue<Float4>(result);
- }
-
RValue<Int> SignMask(RValue<Float4> x)
{
if(emulateIntrinsics || CPUID::ARM)
@@ -7135,16 +3241,6 @@
return RValue<Int4>(Nucleus::createFCmpUGT(x.value, y.value));
}
- RValue<Int4> IsInf(RValue<Float4> x)
- {
- return CmpEQ(As<Int4>(x) & Int4(0x7FFFFFFF), Int4(0x7F800000));
- }
-
- RValue<Int4> IsNan(RValue<Float4> x)
- {
- return ~CmpEQ(x, x);
- }
-
RValue<Float4> Round(RValue<Float4> x)
{
if(emulateIntrinsics || CPUID::ARM)
@@ -7255,86 +3351,6 @@
return T(Ice::IceType_v4f32);
}
- RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
- {
- return lhs + RValue<Int>(Nucleus::createConstantInt(offset));
- }
-
- RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
- {
- return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value, false));
- }
-
- RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
- {
- return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value, true));
- }
-
- RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset)
- {
- return lhs = lhs + offset;
- }
-
- RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset)
- {
- return lhs = lhs + offset;
- }
-
- RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset)
- {
- return lhs = lhs + offset;
- }
-
- RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset)
- {
- return lhs + -offset;
- }
-
- RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
- {
- return lhs + -offset;
- }
-
- RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
- {
- return lhs + -offset;
- }
-
- RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset)
- {
- return lhs = lhs - offset;
- }
-
- RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset)
- {
- return lhs = lhs - offset;
- }
-
- RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset)
- {
- return lhs = lhs - offset;
- }
-
- void Return()
- {
- Nucleus::createRetVoid();
- Nucleus::setInsertBlock(Nucleus::createBasicBlock());
- Nucleus::createUnreachable();
- }
-
- void Return(RValue<Int> ret)
- {
- Nucleus::createRet(ret.value);
- Nucleus::setInsertBlock(Nucleus::createBasicBlock());
- Nucleus::createUnreachable();
- }
-
- void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB)
- {
- Nucleus::createCondBr(cmp.value, bodyBB, endBB);
- Nucleus::setInsertBlock(bodyBB);
- }
-
RValue<Long> Ticks()
{
assert(false && "UNIMPLEMENTED"); return RValue<Long>(V(nullptr));