Debian Codegraph @

flang/test/Lower/PowerPC/ppc-vec-sel.f90

raw
1 ! RUN: %flang_fc1 -flang-experimental-hlfir -emit-llvm %s -o - | FileCheck --check-prefixes="LLVMIR" %s
2 ! REQUIRES: target=powerpc{{.*}}
3
4 !----------------------
5 ! vec_sel
6 !----------------------
7
8 ! CHECK-LABEL: vec_sel_testi1
9 subroutine vec_sel_testi1(arg1, arg2, arg3)
10 vector(integer(1)) :: arg1, arg2, r
11 vector(unsigned(1)) :: arg3
12 r = vec_sel(arg1, arg2, arg3)
13
14 ! LLVMIR: %[[arg1:.*]] = load <16 x i8>, ptr %{{.*}}, align 16
15 ! LLVMIR: %[[arg2:.*]] = load <16 x i8>, ptr %{{.*}}, align 16
16 ! LLVMIR: %[[arg3:.*]] = load <16 x i8>, ptr %{{.*}}, align 16
17 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[arg3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
18 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[arg1]], %[[comp]]
19 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[arg2]], %[[arg3]]
20 ! LLVMIR: %{{[0-9]+}} = or <16 x i8> %[[and1]], %[[and2]]
21 end subroutine vec_sel_testi1
22
23 ! CHECK-LABEL: vec_sel_testi2
24 subroutine vec_sel_testi2(arg1, arg2, arg3)
25 vector(integer(2)) :: arg1, arg2, r
26 vector(unsigned(2)) :: arg3
27 r = vec_sel(arg1, arg2, arg3)
28
29 ! LLVMIR: %[[arg1:.*]] = load <8 x i16>, ptr %{{.*}}, align 16
30 ! LLVMIR: %[[arg2:.*]] = load <8 x i16>, ptr %{{.*}}, align 16
31 ! LLVMIR: %[[arg3:.*]] = load <8 x i16>, ptr %{{.*}}, align 16
32 ! LLVMIR: %[[bc1:.*]] = bitcast <8 x i16> %5 to <16 x i8>
33 ! LLVMIR: %[[bc2:.*]] = bitcast <8 x i16> %6 to <16 x i8>
34 ! LLVMIR: %[[bc3:.*]] = bitcast <8 x i16> %7 to <16 x i8>
35 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
36 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
37 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
38 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
39 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <8 x i16>
40 end subroutine vec_sel_testi2
41
42 ! CHECK-LABEL: vec_sel_testi4
43 subroutine vec_sel_testi4(arg1, arg2, arg3)
44 vector(integer(4)) :: arg1, arg2, r
45 vector(unsigned(4)) :: arg3
46 r = vec_sel(arg1, arg2, arg3)
47
48 ! LLVMIR: %[[arg1:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
49 ! LLVMIR: %[[arg2:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
50 ! LLVMIR: %[[arg3:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
51 ! LLVMIR: %[[bc1:.*]] = bitcast <4 x i32> %5 to <16 x i8>
52 ! LLVMIR: %[[bc2:.*]] = bitcast <4 x i32> %6 to <16 x i8>
53 ! LLVMIR: %[[bc3:.*]] = bitcast <4 x i32> %7 to <16 x i8>
54 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
55 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
56 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
57 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
58 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <4 x i32>
59 end subroutine vec_sel_testi4
60
61 ! CHECK-LABEL: vec_sel_testi8
62 subroutine vec_sel_testi8(arg1, arg2, arg3)
63 vector(integer(8)) :: arg1, arg2, r
64 vector(unsigned(8)) :: arg3
65 r = vec_sel(arg1, arg2, arg3)
66
67 ! LLVMIR: %[[arg1:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
68 ! LLVMIR: %[[arg2:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
69 ! LLVMIR: %[[arg3:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
70 ! LLVMIR: %[[bc1:.*]] = bitcast <2 x i64> %5 to <16 x i8>
71 ! LLVMIR: %[[bc2:.*]] = bitcast <2 x i64> %6 to <16 x i8>
72 ! LLVMIR: %[[bc3:.*]] = bitcast <2 x i64> %7 to <16 x i8>
73 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
74 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
75 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
76 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
77 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <2 x i64>
78 end subroutine vec_sel_testi8
79
80 ! CHECK-LABEL: vec_sel_testu1
81 subroutine vec_sel_testu1(arg1, arg2, arg3)
82 vector(unsigned(1)) :: arg1, arg2, r
83 vector(unsigned(1)) :: arg3
84 r = vec_sel(arg1, arg2, arg3)
85
86 ! LLVMIR: %[[arg1:.*]] = load <16 x i8>, ptr %{{.*}}, align 16
87 ! LLVMIR: %[[arg2:.*]] = load <16 x i8>, ptr %{{.*}}, align 16
88 ! LLVMIR: %[[arg3:.*]] = load <16 x i8>, ptr %{{.*}}, align 16
89 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[arg3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
90 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[arg1]], %[[comp]]
91 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[arg2]], %[[arg3]]
92 ! LLVMIR: %{{[0-9]+}} = or <16 x i8> %[[and1]], %[[and2]]
93 end subroutine vec_sel_testu1
94
95 ! CHECK-LABEL: vec_sel_testu2
96 subroutine vec_sel_testu2(arg1, arg2, arg3)
97 vector(unsigned(2)) :: arg1, arg2, r
98 vector(unsigned(2)) :: arg3
99 r = vec_sel(arg1, arg2, arg3)
100
101 ! LLVMIR: %[[arg1:.*]] = load <8 x i16>, ptr %{{.*}}, align 16
102 ! LLVMIR: %[[arg2:.*]] = load <8 x i16>, ptr %{{.*}}, align 16
103 ! LLVMIR: %[[arg3:.*]] = load <8 x i16>, ptr %{{.*}}, align 16
104 ! LLVMIR: %[[bc1:.*]] = bitcast <8 x i16> %5 to <16 x i8>
105 ! LLVMIR: %[[bc2:.*]] = bitcast <8 x i16> %6 to <16 x i8>
106 ! LLVMIR: %[[bc3:.*]] = bitcast <8 x i16> %7 to <16 x i8>
107 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
108 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
109 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
110 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
111 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <8 x i16>
112 end subroutine vec_sel_testu2
113
114 ! CHECK-LABEL: vec_sel_testu4
115 subroutine vec_sel_testu4(arg1, arg2, arg3)
116 vector(unsigned(4)) :: arg1, arg2, r
117 vector(unsigned(4)) :: arg3
118 r = vec_sel(arg1, arg2, arg3)
119
120 ! LLVMIR: %[[arg1:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
121 ! LLVMIR: %[[arg2:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
122 ! LLVMIR: %[[arg3:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
123 ! LLVMIR: %[[bc1:.*]] = bitcast <4 x i32> %5 to <16 x i8>
124 ! LLVMIR: %[[bc2:.*]] = bitcast <4 x i32> %6 to <16 x i8>
125 ! LLVMIR: %[[bc3:.*]] = bitcast <4 x i32> %7 to <16 x i8>
126 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
127 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
128 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
129 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
130 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <4 x i32>
131 end subroutine vec_sel_testu4
132
133 ! CHECK-LABEL: vec_sel_testu8
134 subroutine vec_sel_testu8(arg1, arg2, arg3)
135 vector(unsigned(8)) :: arg1, arg2, r
136 vector(unsigned(8)) :: arg3
137 r = vec_sel(arg1, arg2, arg3)
138
139
140 ! LLVMIR: %[[arg1:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
141 ! LLVMIR: %[[arg2:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
142 ! LLVMIR: %[[arg3:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
143 ! LLVMIR: %[[bc1:.*]] = bitcast <2 x i64> %5 to <16 x i8>
144 ! LLVMIR: %[[bc2:.*]] = bitcast <2 x i64> %6 to <16 x i8>
145 ! LLVMIR: %[[bc3:.*]] = bitcast <2 x i64> %7 to <16 x i8>
146 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
147 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
148 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
149 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
150 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <2 x i64>
151 end subroutine vec_sel_testu8
152
153 ! CHECK-LABEL: vec_sel_testr4
154 subroutine vec_sel_testr4(arg1, arg2, arg3)
155 vector(real(4)) :: arg1, arg2, r
156 vector(unsigned(4)) :: arg3
157 r = vec_sel(arg1, arg2, arg3)
158
159 ! LLVMIR: %[[arg1:.*]] = load <4 x float>, ptr %{{.*}}, align 16
160 ! LLVMIR: %[[arg2:.*]] = load <4 x float>, ptr %{{.*}}, align 16
161 ! LLVMIR: %[[arg3:.*]] = load <4 x i32>, ptr %{{.*}}, align 16
162 ! LLVMIR: %[[bc1:.*]] = bitcast <4 x float> %5 to <16 x i8>
163 ! LLVMIR: %[[bc2:.*]] = bitcast <4 x float> %6 to <16 x i8>
164 ! LLVMIR: %[[bc3:.*]] = bitcast <4 x i32> %7 to <16 x i8>
165 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
166 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
167 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
168 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
169 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <4 x float>
170 end subroutine vec_sel_testr4
171
172 ! CHECK-LABEL: vec_sel_testr8
173 subroutine vec_sel_testr8(arg1, arg2, arg3)
174 vector(real(8)) :: arg1, arg2, r
175 vector(unsigned(8)) :: arg3
176 r = vec_sel(arg1, arg2, arg3)
177
178 ! LLVMIR: %[[arg1:.*]] = load <2 x double>, ptr %{{.*}}, align 16
179 ! LLVMIR: %[[arg2:.*]] = load <2 x double>, ptr %{{.*}}, align 16
180 ! LLVMIR: %[[arg3:.*]] = load <2 x i64>, ptr %{{.*}}, align 16
181 ! LLVMIR: %[[bc1:.*]] = bitcast <2 x double> %5 to <16 x i8>
182 ! LLVMIR: %[[bc2:.*]] = bitcast <2 x double> %6 to <16 x i8>
183 ! LLVMIR: %[[bc3:.*]] = bitcast <2 x i64> %7 to <16 x i8>
184 ! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
185 ! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]
186 ! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]
187 ! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]
188 ! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <2 x double>
189 end subroutine vec_sel_testr8