source: trunk/lib_ir/gen/llc_func.pytemplate.ll @ 3997

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

some refactoring, mult for i4/i8 ready now

File size: 1.3 KB
Line 
1{% for name in FunctionNamesI2 %}
2define <64 x i2> @{{ name.c }}(<64 x i2> %a, <64 x i2> %b) {
3entry:
4  %c = {{ name.op }} <64 x i2> %a, %b
5{% if "icmp" in name.op %}
6  %d = sext <64 x i1> %c to <64 x i2>
7  ret <64 x i2> %d
8{% else %}
9  ret <64 x i2> %c
10{% endif %}
11}
12{% endfor %}
13
14{% for i in [0, 1, 17] %}
15{% for x in range(0, 4) %}
16define <64 x i2> @insertelement_idx{{ i }}_elt{{ x }}(<64 x i2> %a) {
17entry:
18  %c = insertelement <64 x i2> %a, i2 {{ x }}, i32 {{ i }}
19  ret <64 x i2> %c
20}
21
22{% endfor %}
23{% endfor %}
24
25{% for x in [0, 1, 17] %}
26define i8 @extractelement_idx{{ x }}(<64 x i2> %a) {
27entry:
28  %c = extractelement <64 x i2> %a, i32 {{ x }}
29  %d = zext i2 %c to i8
30  ret i8 %d
31}
32{% endfor %}
33
34; v32i4 starts here
35{% for name in FunctionNamesI4 %}
36define <32 x i4> @{{name.c}}(<32 x i4> %a, <32 x i4> %b) {
37entry:
38  %c = {{ name.op }} <32 x i4> %a, %b
39  {% if "icmp" in name.op %}
40  %d = sext <32 x i1> %c to <32 x i4>
41  ret <32 x i4> %d
42  {% else %}
43  ret <32 x i4> %c
44  {% endif %}
45}
46{% endfor %}
47
48; v16i8 starts here
49{% for name in FunctionNamesI8 %}
50define <16 x i8> @{{name.c}}(<16 x i8> %a, <16 x i8> %b) {
51entry:
52  %c = {{ name.op }} <16 x i8> %a, %b
53  {% if "icmp" in name.op %}
54  %d = sext <16 x i1> %c to <16 x i8>
55  ret <16 x i8> %d
56  {% else %}
57  ret <16 x i8> %c
58  {% endif %}
59}
60{% endfor %}
Note: See TracBrowser for help on using the repository browser.