Added missing Nucleus level operations Very few operations were missing in Nucleus for integer types support, but there were a few nonetheless, so Int4 and UInt4 now have new operators: divide, modulo, right shift (from non constant) and left shift (from non constant). These were simply un-commented out as they were already there, just commented out. Change-Id: I4c124c9297cd4d3d755c37f11168a43dcfeee290 Reviewed-on: https://swiftshader-review.googlesource.com/3886 Tested-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/Nucleus.cpp b/src/Reactor/Nucleus.cpp index ee082e6..f018f76 100644 --- a/src/Reactor/Nucleus.cpp +++ b/src/Reactor/Nucleus.cpp
@@ -5264,15 +5264,15 @@ 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::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::createSRem(lhs.value, rhs.value)); + } RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs) { @@ -5291,18 +5291,24 @@ RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs) { - // return RValue<Int4>(Nucleus::createShl(lhs.value, rhs.value)); - return x86::pslld(lhs, rhs); } RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs) { - // return RValue<Int4>(Nucleus::createAShr(lhs.value, rhs.value)); - return x86::psrad(lhs, rhs); } + 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+=(const Int4 &lhs, RValue<Int4> rhs) { return lhs = lhs + rhs; @@ -5603,15 +5609,15 @@ 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::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::createURem(lhs.value, rhs.value)); + } RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs) { @@ -5630,18 +5636,24 @@ RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs) { - // return RValue<UInt4>(Nucleus::createShl(lhs.value, rhs.value)); - return As<UInt4>(x86::pslld(As<Int4>(lhs), rhs)); } RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs) { - // return RValue<UInt4>(Nucleus::createLShr(lhs.value, rhs.value)); - return x86::psrld(lhs, rhs); } + 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+=(const UInt4 &lhs, RValue<UInt4> rhs) { return lhs = lhs + rhs;