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

Unified Diff: crosstest/test_arith_main.cpp

Issue 443203003: Subzero: Use scalar arithmetic when no vector instruction exists. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: TODO(stichnot) Created 6 years, 4 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
« no previous file with comments | « crosstest/test_arith.def ('k') | src/IceInstX8632.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crosstest/test_arith_main.cpp
diff --git a/crosstest/test_arith_main.cpp b/crosstest/test_arith_main.cpp
index b032a5fcc06a0c4705f9b437ba11b704f8ee090f..84bc6b72ebd6827d4df56e5cf4164e5f2791de4b 100644
--- a/crosstest/test_arith_main.cpp
+++ b/crosstest/test_arith_main.cpp
@@ -61,12 +61,12 @@ void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
FuncTypeSigned FuncSzSigned;
bool ExcludeDivExceptions; // for divide related tests
} Funcs[] = {
-#define X(inst, op, isdiv) \
+#define X(inst, op, isdiv, isshift) \
{ STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv } \
,
UINTOP_TABLE
#undef X
-#define X(inst, op, isdiv) \
+#define X(inst, op, isdiv, isshift) \
{ STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv } \
,
SINTOP_TABLE
@@ -172,17 +172,18 @@ void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
FuncTypeSigned FuncLlcSigned;
FuncTypeSigned FuncSzSigned;
bool ExcludeDivExceptions; // for divide related tests
+ bool MaskShiftOperations; // for shift related tests
} Funcs[] = {
-#define X(inst, op, isdiv) \
+#define X(inst, op, isdiv, isshift) \
{ \
- STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv \
+ STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv, isshift \
} \
,
UINTOP_TABLE
#undef X
-#define X(inst, op, isdiv) \
+#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, isshift \
} \
,
SINTOP_TABLE
@@ -201,6 +202,8 @@ void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
if (Funcs[f].ExcludeDivExceptions &&
inputsMayTriggerException<ElementTypeSigned>(Element1, Element2))
continue;
+ if (Funcs[f].MaskShiftOperations)
+ Element2 &= CHAR_BIT * sizeof(ElementTypeUnsigned) - 1;
Value1[j] = Element1;
Value2[j] = Element2;
++j;
@@ -360,37 +363,3 @@ int main(int argc, char **argv) {
return Failures;
}
-extern "C" {
-// Subzero helpers
- v4si32 Sz_shl_v4i32(v4si32 a, v4si32 b) { return a << b; }
- v4si32 Sz_ashr_v4i32(v4si32 a, v4si32 b) { return a >> b; }
- v4ui32 Sz_lshr_v4i32(v4ui32 a, v4ui32 b) { return a >> b; }
- v4si32 Sz_sdiv_v4i32(v4si32 a, v4si32 b) { return a / b; }
- v4ui32 Sz_udiv_v4i32(v4ui32 a, v4ui32 b) { return a / b; }
- v4si32 Sz_srem_v4i32(v4si32 a, v4si32 b) { return a % b; }
- v4ui32 Sz_urem_v4i32(v4ui32 a, v4ui32 b) { return a % b; }
-
- v8si16 Sz_shl_v8i16(v8si16 a, v8si16 b) { return a << b; }
- v8si16 Sz_ashr_v8i16(v8si16 a, v8si16 b) { return a >> b; }
- v8ui16 Sz_lshr_v8i16(v8ui16 a, v8ui16 b) { return a >> b; }
- v8si16 Sz_sdiv_v8i16(v8si16 a, v8si16 b) { return a / b; }
- v8ui16 Sz_udiv_v8i16(v8ui16 a, v8ui16 b) { return a / b; }
- v8si16 Sz_srem_v8i16(v8si16 a, v8si16 b) { return a % b; }
- v8ui16 Sz_urem_v8i16(v8ui16 a, v8ui16 b) { return a % b; }
-
- v16ui8 Sz_mul_v16i8(v16ui8 a, v16ui8 b) { return a * b; }
- v16si8 Sz_shl_v16i8(v16si8 a, v16si8 b) { return a << b; }
- v16si8 Sz_ashr_v16i8(v16si8 a, v16si8 b) { return a >> b; }
- v16ui8 Sz_lshr_v16i8(v16ui8 a, v16ui8 b) { return a >> b; }
- v16si8 Sz_sdiv_v16i8(v16si8 a, v16si8 b) { return a / b; }
- v16ui8 Sz_udiv_v16i8(v16ui8 a, v16ui8 b) { return a / b; }
- v16si8 Sz_srem_v16i8(v16si8 a, v16si8 b) { return a % b; }
- v16ui8 Sz_urem_v16i8(v16ui8 a, v16ui8 b) { return a % b; }
-
- v4f32 Sz_frem_v4f32(v4f32 a, v4f32 b) {
- v4f32 Result;
- for (int i = 0; i < 4; ++i)
- Result[i] = fmodf(a[i], b[i]);
- return Result;
- }
-}
« no previous file with comments | « crosstest/test_arith.def ('k') | src/IceInstX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698