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

Unified Diff: crosstest/mem_intrin_main.c

Issue 321993002: Add a few Subzero intrinsics (not the atomic ones yet). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: tweak test some Created 6 years, 6 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/mem_intrin_main.c
diff --git a/crosstest/mem_intrin_main.c b/crosstest/mem_intrin_main.c
new file mode 100644
index 0000000000000000000000000000000000000000..31016131e516fcddce084f948d9c26209086ef7b
--- /dev/null
+++ b/crosstest/mem_intrin_main.c
@@ -0,0 +1,38 @@
+/* crosstest.py --test=mem_intrin.c --driver=mem_intrin_main.c \
+ --prefix=Subzero_ --output=mem_intrin */
+
+#include <stdint.h>
+#include <stdio.h>
+
+int memcpy_test(uint8_t n);
+int memmove_test(uint8_t n);
+int memset_test(uint8_t n);
+int Subzero_memcpy_test(uint8_t n);
+int Subzero_memmove_test(uint8_t n);
+int Subzero_memset_test(uint8_t n);
+
+int main(int argc, char **argv) {
+ unsigned TotalTests = 0;
+ unsigned Passes = 0;
+ unsigned Failures = 0;
+#define do_test(test_func) \
Jim Stichnoth 2014/06/12 20:52:07 Do you think this test will be getting much bigger
jvoung (off chromium) 2014/06/16 20:51:59 Added some variable-length mem() calls, (vs the fi
+ for (uint8_t i = 0; i < 100; ++i) { \
+ ++TotalTests; \
+ int llc_result = test_func(i); \
+ int sz_result = Subzero_##test_func(i); \
+ if (llc_result == sz_result) { \
+ ++Passes; \
+ } else { \
+ ++Failures; \
+ printf("Failure (%s): i=%d, llc=%d, sz=%d\n", #test_func, \
+ i, llc_result, sz_result); \
+ } \
+ }
+
+ do_test(memcpy_test)
+ do_test(memmove_test)
+ /* Broken: invalid push byte for val argument */
+ /* do_test(memset_test) */
+ printf("TotalTests=%u Passes=%u Failures=%u\n", TotalTests, Passes, Failures);
+ return Failures;
+}

Powered by Google App Engine
This is Rietveld 408576698