OLD | NEW |
1 //===- subzero/crosstest/test_vector_ops.h - Test prototypes ----*- C++ -*-===// | 1 //===- subzero/crosstest/test_vector_ops.h - Test prototypes ----*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the function prototypes for crosstesting insertelement | 10 // This file declares the function prototypes for crosstesting insertelement |
11 // and extractelement operations. | 11 // and extractelement operations. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #ifndef TEST_VECTOR_OPS_H | 15 #ifndef TEST_VECTOR_OPS_H |
16 #define TEST_VECTOR_OPS_H | 16 #define TEST_VECTOR_OPS_H |
17 | 17 |
18 #include "vectors.h" | 18 #include "vectors.h" |
19 | 19 |
20 // The VectorOps<> class acts like Vectors<> but also has insertelement, | 20 // The VectorOps<> class acts like Vectors<> but also has insertelement, |
21 // Subzero_insertelement, extractelement, and Subzero_extractelement | 21 // Subzero_insertelement, extractelement, Subzero_extractelement, |
22 // fields. | 22 // shufflevector, Subzero_shufflevector, and shufflevector_count fields. |
23 | 23 |
24 template <typename T> struct VectorOps; | 24 template <typename T> struct VectorOps; |
25 #define FIELD(TYNAME, FIELDNAME) VectorOps<TYNAME>::FIELDNAME | 25 #define FIELD(TYNAME, FIELDNAME) VectorOps<TYNAME>::FIELDNAME |
26 #define TY(TYNAME) FIELD(TYNAME, Ty) | 26 #define TY(TYNAME) FIELD(TYNAME, Ty) |
27 #define CASTTY(TYNAME) FIELD(TYNAME, CastTy) | 27 #define CASTTY(TYNAME) FIELD(TYNAME, CastTy) |
28 #define DECLARE_VECTOR_OPS(NAME) \ | 28 #define DECLARE_VECTOR_OPS(NAME) \ |
29 template <> struct VectorOps<NAME> : public Vectors<NAME> { \ | 29 template <> struct VectorOps<NAME> : public Vectors<NAME> { \ |
30 static Ty (*insertelement)(Ty, CastTy, int32_t); \ | 30 static Ty (*insertelement)(Ty, CastTy, int32_t); \ |
| 31 static Ty (*shufflevector)(Ty, Ty, uint32_t); \ |
31 static CastTy (*extractelement)(Ty, int32_t); \ | 32 static CastTy (*extractelement)(Ty, int32_t); \ |
32 static Ty (*Subzero_insertelement)(Ty, CastTy, int32_t); \ | 33 static Ty (*Subzero_insertelement)(Ty, CastTy, int32_t); \ |
| 34 static Ty (*Subzero_shufflevector)(Ty, Ty, uint32_t); \ |
33 static CastTy (*Subzero_extractelement)(Ty, int32_t); \ | 35 static CastTy (*Subzero_extractelement)(Ty, int32_t); \ |
| 36 static uint32_t (*shufflevector_count)(); \ |
34 }; \ | 37 }; \ |
35 extern "C" { \ | 38 extern "C" { \ |
36 TY(NAME) insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \ | 39 TY(NAME) insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \ |
37 TY(NAME) Subzero_insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \ | 40 TY(NAME) Subzero_insertelement_##NAME(TY(NAME), CASTTY(NAME), int32_t); \ |
38 CASTTY(NAME) extractelement_##NAME(TY(NAME), int32_t); \ | 41 CASTTY(NAME) extractelement_##NAME(TY(NAME), int32_t); \ |
39 CASTTY(NAME) Subzero_extractelement_##NAME(TY(NAME), int32_t); \ | 42 CASTTY(NAME) Subzero_extractelement_##NAME(TY(NAME), int32_t); \ |
| 43 TY(NAME) shufflevector_##NAME(TY(NAME), TY(NAME), uint32_t); \ |
| 44 TY(NAME) Subzero_shufflevector_##NAME(TY(NAME), TY(NAME), uint32_t); \ |
| 45 uint32_t shufflevector_count_##NAME(); \ |
40 } \ | 46 } \ |
41 TY(NAME) (*FIELD(NAME, insertelement))(TY(NAME), CASTTY(NAME), int32_t) = \ | 47 TY(NAME) (*FIELD(NAME, insertelement))(TY(NAME), CASTTY(NAME), int32_t) = \ |
42 &insertelement_##NAME; \ | 48 &insertelement_##NAME; \ |
43 TY(NAME) (*FIELD(NAME, Subzero_insertelement))( \ | 49 TY(NAME) (*FIELD(NAME, Subzero_insertelement))( \ |
44 TY(NAME), CASTTY(NAME), int32_t) = &Subzero_insertelement_##NAME; \ | 50 TY(NAME), CASTTY(NAME), int32_t) = &Subzero_insertelement_##NAME; \ |
45 CASTTY(NAME) (*FIELD(NAME, extractelement))(TY(NAME), int32_t) = \ | 51 CASTTY(NAME) (*FIELD(NAME, extractelement))(TY(NAME), int32_t) = \ |
46 &extractelement_##NAME; \ | 52 &extractelement_##NAME; \ |
47 CASTTY(NAME) (*FIELD(NAME, Subzero_extractelement))(TY(NAME), int32_t) = \ | 53 CASTTY(NAME) (*FIELD(NAME, Subzero_extractelement))(TY(NAME), int32_t) = \ |
48 &Subzero_extractelement_##NAME; | 54 &Subzero_extractelement_##NAME; \ |
| 55 TY(NAME) (*FIELD(NAME, shufflevector))(TY(NAME), TY(NAME), uint32_t) = \ |
| 56 &shufflevector_##NAME; \ |
| 57 TY(NAME) (*FIELD(NAME, Subzero_shufflevector))( \ |
| 58 TY(NAME), TY(NAME), uint32_t) = &Subzero_shufflevector_##NAME; \ |
| 59 uint32_t (*FIELD(NAME, shufflevector_count))() = &shufflevector_count_##NAME; |
49 | 60 |
50 #define X(ty, eltty, castty) DECLARE_VECTOR_OPS(ty) | 61 #define X(ty, eltty, castty) DECLARE_VECTOR_OPS(ty) |
51 VECTOR_TYPE_TABLE | 62 VECTOR_TYPE_TABLE |
52 #undef X | 63 #undef X |
53 | 64 |
54 #define X(ty, eltty, numelements) DECLARE_VECTOR_OPS(ty) | 65 #define X(ty, eltty, numelements) DECLARE_VECTOR_OPS(ty) |
55 I1_VECTOR_TYPE_TABLE | 66 I1_VECTOR_TYPE_TABLE |
56 #undef X | 67 #undef X |
57 | 68 |
58 #endif // TEST_VECTOR_OPS_H | 69 #endif // TEST_VECTOR_OPS_H |
OLD | NEW |