Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: crosstest/test_arith_main.cpp

Issue 547033002: Subzero: Be more strict about i1 calculations. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Revert unnecessary changes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: crosstest/test_arith_main.cpp
diff --git a/crosstest/test_arith_main.cpp b/crosstest/test_arith_main.cpp
index 84bc6b72ebd6827d4df56e5cf4164e5f2791de4b..6d4ca824b852be6b0c629da2115013a60fd38d05 100644
--- a/crosstest/test_arith_main.cpp
+++ b/crosstest/test_arith_main.cpp
@@ -11,8 +11,9 @@
//
//===----------------------------------------------------------------------===//
-/* crosstest.py --test=test_arith.cpp --test=test_arith_frem.ll \
- --test=test_arith_sqrt.ll --driver=test_arith_main.cpp \
+/* crosstest.py --test=test_arith.cpp --test=test_arith_bool.ll \
+ --test=test_arith_frem.ll --test=test_arith_sqrt.ll \
+ --driver=test_arith_main.cpp \
--prefix=Subzero_ --output=test_arith */
#include <stdint.h>
@@ -32,7 +33,12 @@ namespace Subzero_ {
#include "test_arith.h"
}
-template <class T> bool inputsMayTriggerException(T Value1, T Value2) {
+template <class T>
+bool inputsMayTriggerException(T Value1, T Value2, bool IsReallyBool = false) {
+ if (IsReallyBool) {
+ Value1 &= 1;
+ Value2 &= 1;
+ }
// Avoid HW divide-by-zero exception.
if (Value2 == 0)
return true;
@@ -60,18 +66,22 @@ void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
FuncTypeSigned FuncLlcSigned;
FuncTypeSigned FuncSzSigned;
bool ExcludeDivExceptions; // for divide related tests
+ bool IsReallyBool;
} Funcs[] = {
#define X(inst, op, isdiv, isshift) \
- { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv } \
- ,
+ { \
+ "Bool" STR(inst), testBool##inst, Subzero_::testBool##inst, NULL, NULL, \
+ isdiv, true \
+ } \
+ , { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv, false },
UINTOP_TABLE
#undef X
#define X(inst, op, isdiv, isshift) \
- { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv } \
+ { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv, false } \
,
- SINTOP_TABLE
+ SINTOP_TABLE
#undef X
- };
+ };
const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) {
@@ -84,13 +94,14 @@ void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
TypeUnsigned Value2 = Values[j];
// Avoid HW divide-by-zero exception.
if (Funcs[f].ExcludeDivExceptions &&
- inputsMayTriggerException<TypeSigned>(Value1, Value2))
+ inputsMayTriggerException<TypeSigned>(Value1, Value2,
+ Funcs[f].IsReallyBool))
continue;
++TotalTests;
TypeUnsigned ResultSz, ResultLlc;
if (Funcs[f].FuncSzUnsigned) {
- ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2);
ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2);
+ ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2);
} else {
ResultSz = Funcs[f].FuncSzSigned(Value1, Value2);
ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2);
@@ -100,8 +111,9 @@ void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
} else {
++Failures;
std::cout << "test" << Funcs[f].Name
- << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1
- << ", " << Value2 << "): sz=" << (unsigned)ResultSz
+ << (CHAR_BIT * sizeof(TypeUnsigned)) << "("
+ << (unsigned)Value1 << ", " << (unsigned)Value2
+ << "): sz=" << (unsigned)ResultSz
<< " llc=" << (unsigned)ResultLlc << "\n";
}
}
« no previous file with comments | « crosstest/test_arith_bool.ll ('k') | src/IceGlobalContext.cpp » ('j') | src/IceInstX8632.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698