source: trunk/lib_ir/gen/test_llc.pytemplate.cpp @ 3977

Last change on this file since 3977 was 3977, checked in by linmengl, 5 years ago

Create a template system to generate lowering logic for v64i2 and the test cases.

File size: 829 bytes
Line 
1/******************
2 * Python template to auto gen llc test file.
3 * sudo easy_install Jinja2 to install the Jinja2 template system
4 * {{HeaderComment}}
5 */
6
7#include "utility.h"
8#include <iostream>
9#include <cstdlib>
10using namespace std;
11
12extern "C" {
13{% for name in FunctionNames %}
14  SIMD_type {{ name.c }}(SIMD_type a, SIMD_type b);
15{% endfor %}
16}
17
18void fill_random(SIMD_type &a, SIMD_type &b)
19{
20  a = mvmd<32>::fill((int)rand() % 10000);
21  b = mvmd<32>::fill((int)rand() % 10000);
22}
23
24int main() {
25  SIMD_type a, b, c, d;
26
27  for (unsigned i = 0; i < 5; ++i) {
28    fill_random(a, b);
29
30{% for name in FunctionNames %}
31    c = {{ name.c }}(a, b);
32    d = {{ name.cxx }}(a, b);
33    if (Store2String(c,1) != Store2String(d,1)) {
34      cout << "{{ name.c }} faild." << endl;
35      return 1;
36    }
37
38{% endfor %}
39  }
40
41  return 0;
42}
43
Note: See TracBrowser for help on using the repository browser.