Struct equality comparison fixed
There's an LLVM bug currently that prevents us from using ICMP_EQ,
but ICMP_NE works fine, so the "equality" test has been changed to
"!inequality" to fix the issue. The fix should be reverted once
LLVM is updated to a version where the ICMP_EQ issue is fixed.
Change-Id: I79d6ca99554317cc64ffa2905ae2804bd4805e2a
Reviewed-on: https://swiftshader-review.googlesource.com/5193
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/Nucleus.cpp b/src/Reactor/Nucleus.cpp
index 9b1d245..b52abd8 100644
--- a/src/Reactor/Nucleus.cpp
+++ b/src/Reactor/Nucleus.cpp
@@ -5522,7 +5522,10 @@
RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y)
{
- return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
+ // FIXME: An LLVM bug prevents us from using createICmpEQ currently.
+ // Restore the following line when LLVM is updated to a version where this issue is fixed.
+ // return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
+ return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpNE(x.value, y.value), Int4::getType())) ^ Int4(0xFFFFFFFF);
}
RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y)
@@ -5867,7 +5870,10 @@
RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y)
{
- return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
+ // FIXME: An LLVM bug prevents us from using createICmpEQ currently.
+ // Restore the following line when LLVM is updated to a version where this issue is fixed.
+ // return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
+ return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpNE(x.value, y.value), Int4::getType())) ^ UInt4(0xFFFFFFFF);
}
RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y)