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

Unified Diff: crosstest/test_vector_ops.h

Issue 407543003: Factor out common vector crosstesting code. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Add missing include guard #endif comment 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_arith_main.cpp ('k') | crosstest/test_vector_ops_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crosstest/test_vector_ops.h
diff --git a/crosstest/test_vector_ops.h b/crosstest/test_vector_ops.h
new file mode 100644
index 0000000000000000000000000000000000000000..32903a987198628af5ab53e699049e8f2615090a
--- /dev/null
+++ b/crosstest/test_vector_ops.h
@@ -0,0 +1,58 @@
+//===- subzero/crosstest/test_vector_ops.h - Test prototypes ----*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the function prototypes for crosstesting insertelement
+// and extractelement operations.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_VECTOR_OPS_H
+#define TEST_VECTOR_OPS_H
+
+#include "vectors.h"
+
+// The VectorOps<> class acts like Vectors<> but also has insertelement,
+// Subzero_insertelement, extractelement, and Subzero_extractelement
+// fields.
+
+template <typename T> struct VectorOps;
+#define FIELD(TYNAME, FIELDNAME) VectorOps<TYNAME>::FIELDNAME
+#define TY(TYNAME) FIELD(TYNAME, Ty)
+#define CASTTY(TYNAME) FIELD(TYNAME, CastTy)
+#define DECLARE_VECTOR_OPS(NAME) \
+ template <> struct VectorOps<NAME> : public Vectors<NAME> { \
+ static Ty (*insertelement)(Ty, CastTy, int32_t); \
+ static CastTy (*extractelement)(Ty, int32_t); \
+ static Ty (*Subzero_insertelement)(Ty, CastTy, int32_t); \
+ static CastTy (*Subzero_extractelement)(Ty, int32_t); \
+ }; \
+ extern "C" { \
+ TY(NAME) insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \
+ TY(NAME) Subzero_insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \
+ CASTTY(NAME) extractelement_##NAME(TY(NAME), int32_t); \
+ CASTTY(NAME) Subzero_extractelement_##NAME(TY(NAME), int32_t); \
+ } \
+ TY(NAME) (*FIELD(NAME, insertelement))(TY(NAME), CASTTY(NAME), int32_t) = \
+ &insertelement_##NAME; \
+ TY(NAME) (*FIELD(NAME, Subzero_insertelement))( \
+ TY(NAME), CASTTY(NAME), int32_t) = &Subzero_insertelement_##NAME; \
+ CASTTY(NAME) (*FIELD(NAME, extractelement))(TY(NAME), int32_t) = \
+ &extractelement_##NAME; \
+ CASTTY(NAME) (*FIELD(NAME, Subzero_extractelement))(TY(NAME), int32_t) = \
+ &Subzero_extractelement_##NAME;
+
+#define X(ty, eltty, castty) DECLARE_VECTOR_OPS(ty)
+VECTOR_TYPE_TABLE
+#undef X
+
+#define X(ty, eltty, numelements) DECLARE_VECTOR_OPS(ty)
+I1_VECTOR_TYPE_TABLE
+#undef X
+
+#endif // TEST_VECTOR_OPS_H
« no previous file with comments | « crosstest/test_arith_main.cpp ('k') | crosstest/test_vector_ops_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698