1 | #include "utility.h" |
---|
2 | #include "s2p.h" |
---|
3 | #include "s2p_back.hpp" |
---|
4 | #include <iostream> |
---|
5 | #include <cstdlib> |
---|
6 | using namespace std; |
---|
7 | |
---|
8 | int main(int argc, char **argv) |
---|
9 | { |
---|
10 | SIMD_type a, b, c, d, e; |
---|
11 | |
---|
12 | //Test packh_8 |
---|
13 | a = mvmd<32>::fill((int)rand() % 10000); |
---|
14 | b = mvmd<32>::fill((int)rand() % 1000); |
---|
15 | c = hsimd<8>::packh(a, b); |
---|
16 | d = packh_8(a, b); |
---|
17 | |
---|
18 | if (Store2String(c,1) != Store2String(d,1)) { |
---|
19 | cout << Store2String(c,1) << endl; |
---|
20 | cout << Store2String(d,1) << endl; |
---|
21 | cout << "packh_8 faild." << endl; |
---|
22 | return 1; |
---|
23 | } |
---|
24 | |
---|
25 | //Test packl_8 |
---|
26 | a = mvmd<32>::fill((int)rand() % 10000); |
---|
27 | b = mvmd<32>::fill((int)rand() % 1000); |
---|
28 | c = hsimd<8>::packl(a, b); |
---|
29 | d = packl_8(a, b); |
---|
30 | |
---|
31 | if (Store2String(c,1) != Store2String(d,1)) { |
---|
32 | cout << Store2String(c,1) << endl; |
---|
33 | cout << Store2String(d,1) << endl; |
---|
34 | cout << "packl_8 faild." << endl; |
---|
35 | return 1; |
---|
36 | } |
---|
37 | |
---|
38 | //Test packh_4 |
---|
39 | a = mvmd<32>::fill((int)rand() % 10000); |
---|
40 | b = mvmd<32>::fill((int)rand() % 1000); |
---|
41 | c = hsimd<4>::packh(a, b); |
---|
42 | d = packh_4(a, b); |
---|
43 | |
---|
44 | if (Store2String(c,1) != Store2String(d,1)) { |
---|
45 | cout << Store2String(c,1) << endl; |
---|
46 | cout << Store2String(d,1) << endl; |
---|
47 | cout << "packh_4 faild." << endl; |
---|
48 | return 1; |
---|
49 | } |
---|
50 | |
---|
51 | //Test packl_4 |
---|
52 | a = mvmd<32>::fill((int)rand() % 10000); |
---|
53 | b = mvmd<32>::fill((int)rand() % 1000); |
---|
54 | c = hsimd<4>::packl(a, b); |
---|
55 | d = packl_4(a, b); |
---|
56 | |
---|
57 | if (Store2String(c,1) != Store2String(d,1)) { |
---|
58 | cout << Store2String(c,1) << endl; |
---|
59 | cout << Store2String(d,1) << endl; |
---|
60 | cout << "packl_4 faild." << endl; |
---|
61 | return 1; |
---|
62 | } |
---|
63 | |
---|
64 | //Test packh_2 |
---|
65 | a = mvmd<32>::fill((int)rand() % 10000); |
---|
66 | b = mvmd<32>::fill((int)rand() % 1000); |
---|
67 | c = hsimd<2>::packh(a, b); |
---|
68 | d = packh_2(a, b); |
---|
69 | |
---|
70 | if (Store2String(c,1) != Store2String(d,1)) { |
---|
71 | cout << Store2String(c,1) << endl; |
---|
72 | cout << Store2String(d,1) << endl; |
---|
73 | cout << "packh_2 faild." << endl; |
---|
74 | return 1; |
---|
75 | } |
---|
76 | |
---|
77 | //Test packl_2 |
---|
78 | a = mvmd<32>::fill((int)rand() % 10000); |
---|
79 | b = mvmd<32>::fill((int)rand() % 1000); |
---|
80 | c = hsimd<2>::packl(a, b); |
---|
81 | d = packl_2(a, b); |
---|
82 | |
---|
83 | if (Store2String(c,1) != Store2String(d,1)) { |
---|
84 | cout << Store2String(c,1) << endl; |
---|
85 | cout << Store2String(d,1) << endl; |
---|
86 | cout << "packl_4 faild." << endl; |
---|
87 | return 1; |
---|
88 | } |
---|
89 | |
---|
90 | return 0; |
---|
91 | } |
---|
92 | |
---|
93 | |
---|
94 | |
---|