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

Unified Diff: crosstest/test_stacksave_main.c

Issue 396993009: Lower stacksave and restore intrinsics. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase Created 6 years, 5 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_stacksave.c ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crosstest/test_stacksave_main.c
diff --git a/crosstest/test_stacksave_main.c b/crosstest/test_stacksave_main.c
new file mode 100644
index 0000000000000000000000000000000000000000..a5ab2483b27a1256403d63091566cd41487c5919
--- /dev/null
+++ b/crosstest/test_stacksave_main.c
@@ -0,0 +1,61 @@
+//===- subzero/crosstest/test_stacksave_main.c - Driver for tests ---------===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Driver for cross testing stacksave/stackrestore intrinsics.
+//
+//===----------------------------------------------------------------------===//
+
+/* crosstest.py --test=test_stacksave.c --driver=test_stacksave_main.c \
+ --prefix=Subzero_ --output=test_stacksave */
+
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "test_stacksave.h"
+DECLARE_TESTS()
+DECLARE_TESTS(Subzero_)
+
+int main(int argc, char **argv) {
+ size_t TotalTests = 0;
+ size_t Passes = 0;
+ size_t Failures = 0;
+ typedef uint32_t (*FuncType)(uint32_t, uint32_t, uint32_t);
+ static struct {
+ const char *Name;
+ FuncType FuncLlc;
+ FuncType FuncSz;
+ } Funcs[] = {
+ { "test_basic_vla", test_basic_vla, Subzero_test_basic_vla },
+ { "test_vla_in_loop", test_vla_in_loop, Subzero_test_vla_in_loop },
+ { "test_two_vlas_in_loops", test_two_vlas_in_loops,
+ Subzero_test_two_vlas_in_loops }
+ };
+ const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
+ const uint32_t size_to_test = 128;
+ for (size_t f = 0; f < NumFuncs; ++f) {
+ for (uint32_t start = 0; start < size_to_test / 2; ++start) {
+ ++TotalTests;
+ uint32_t inc = (start / 10) + 1;
+ uint32_t llc_result = Funcs[f].FuncLlc(size_to_test, start, inc);
+ uint32_t sz_result = Funcs[f].FuncSz(size_to_test, start, inc);
+ if (llc_result == sz_result) {
+ ++Passes;
+ } else {
+ ++Failures;
+ printf("Failure %s: start=%" PRIu32 ", "
+ "llc=%" PRIu32 ", sz=%" PRIu32 "\n",
+ Funcs[f].Name, start, llc_result, sz_result);
+ }
+ }
+ }
+ printf("TotalTests=%zu Passes=%zu Failures=%zu\n",
+ TotalTests, Passes, Failures);
+ return Failures;
+}
« no previous file with comments | « crosstest/test_stacksave.c ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698