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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===- subzero/crosstest/test_vector_ops.h - Test prototypes ----*- C++ -*-===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the function prototypes for crosstesting insertelement
11 // and extractelement operations.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef TEST_VECTOR_OPS_H
16 #define TEST_VECTOR_OPS_H
17
18 #include "vectors.h"
19
20 // The VectorOps<> class acts like Vectors<> but also has insertelement,
21 // Subzero_insertelement, extractelement, and Subzero_extractelement
22 // fields.
23
24 template <typename T> struct VectorOps;
25 #define FIELD(TYNAME, FIELDNAME) VectorOps<TYNAME>::FIELDNAME
26 #define TY(TYNAME) FIELD(TYNAME, Ty)
27 #define CASTTY(TYNAME) FIELD(TYNAME, CastTy)
28 #define DECLARE_VECTOR_OPS(NAME) \
29 template <> struct VectorOps<NAME> : public Vectors<NAME> { \
30 static Ty (*insertelement)(Ty, CastTy, int32_t); \
31 static CastTy (*extractelement)(Ty, int32_t); \
32 static Ty (*Subzero_insertelement)(Ty, CastTy, int32_t); \
33 static CastTy (*Subzero_extractelement)(Ty, int32_t); \
34 }; \
35 extern "C" { \
36 TY(NAME) insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \
37 TY(NAME) Subzero_insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \
38 CASTTY(NAME) extractelement_##NAME(TY(NAME), int32_t); \
39 CASTTY(NAME) Subzero_extractelement_##NAME(TY(NAME), int32_t); \
40 } \
41 TY(NAME) (*FIELD(NAME, insertelement))(TY(NAME), CASTTY(NAME), int32_t) = \
42 &insertelement_##NAME; \
43 TY(NAME) (*FIELD(NAME, Subzero_insertelement))( \
44 TY(NAME), CASTTY(NAME), int32_t) = &Subzero_insertelement_##NAME; \
45 CASTTY(NAME) (*FIELD(NAME, extractelement))(TY(NAME), int32_t) = \
46 &extractelement_##NAME; \
47 CASTTY(NAME) (*FIELD(NAME, Subzero_extractelement))(TY(NAME), int32_t) = \
48 &Subzero_extractelement_##NAME;
49
50 #define X(ty, eltty, castty) DECLARE_VECTOR_OPS(ty)
51 VECTOR_TYPE_TABLE
52 #undef X
53
54 #define X(ty, eltty, numelements) DECLARE_VECTOR_OPS(ty)
55 I1_VECTOR_TYPE_TABLE
56 #undef X
57
58 #endif // TEST_VECTOR_OPS_H
OLDNEW
« 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