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

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

do exhaust test on insert/extract vector elt on both i2/i4

File size: 1.5 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
14define <64 x i2> @insertelement_2(<64 x i2> %a, i8 %elt, i32 %idx) {
15entry:
16  %e = trunc i8 %elt to i2
17  %c = insertelement <64 x i2> %a, i2 %e, i32 %idx
18  ret <64 x i2> %c
19}
20
21define i8 @extractelement_2(<64 x i2> %a, i32 %idx) {
22entry:
23  %c = extractelement <64 x i2> %a, i32 %idx
24  %d = zext i2 %c to i8
25  ret i8 %d
26}
27
28; v32i4 starts here
29{% for name in FunctionNamesI4 %}
30define <32 x i4> @{{name.c}}(<32 x i4> %a, <32 x i4> %b) {
31entry:
32  %c = {{ name.op }} <32 x i4> %a, %b
33  {% if "icmp" in name.op %}
34  %d = sext <32 x i1> %c to <32 x i4>
35  ret <32 x i4> %d
36  {% else %}
37  ret <32 x i4> %c
38  {% endif %}
39}
40{% endfor %}
41
42define <32 x i4> @insertelement_4(<32 x i4> %a, i8 %elt, i32 %idx) {
43entry:
44  %e = trunc i8 %elt to i4
45  %c = insertelement <32 x i4> %a, i4 %e, i32 %idx
46  ret <32 x i4> %c
47}
48
49define i8 @extractelement_4(<32 x i4> %a, i32 %idx) {
50entry:
51  %c = extractelement <32 x i4> %a, i32 %idx
52  %d = zext i4 %c to i8
53  ret i8 %d
54}
55
56; v16i8 starts here
57{% for name in FunctionNamesI8 %}
58define <16 x i8> @{{name.c}}(<16 x i8> %a, <16 x i8> %b) {
59entry:
60  %c = {{ name.op }} <16 x i8> %a, %b
61  {% if "icmp" in name.op %}
62  %d = sext <16 x i1> %c to <16 x i8>
63  ret <16 x i8> %d
64  {% else %}
65  ret <16 x i8> %c
66  {% endif %}
67}
68{% endfor %}
Note: See TracBrowser for help on using the repository browser.