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

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

more testings done, on v64i2 add/sub/mul/eq/lt/gt/ult/ugt/vsll/vsrl/vsra

File size: 1.3 KB
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    {% if name.flag == "" %}
32    c = {{ name.c }}(a, b);
33    d = {{ name.cxx }}(a, b);
34    if (Store2String(c,1) != Store2String(d,1)) {
35      cout << "{{ name.c }} faild." << endl;
36      return 1;
37    }
38
39    {% endif %}
40  {% endfor %}
41
42    //Shifting tests need special treatment
43  {% for name in FunctionNames %}
44    {% if name.flag == "shifting" %}
45      {% for x in [0, 1] %}
46    b = mvmd<2>::fill({{ x }});
47    c = {{ name.cxx }}<{{ x }}>(a);
48    d = {{ name.c }}(a, b);
49    if (Store2String(c,1) != Store2String(d,1)) {
50      cout << "{{ name.c }} faild." << endl;
51      return 1;
52    }
53
54      {% endfor %}
55    {% endif %}
56  {% endfor %}
57  }
58
59  return 0;
60}
61
Note: See TracBrowser for help on using the repository browser.