1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -march=ve -mattr=+vpu | FileCheck %s
4 declare <256 x i32> @llvm.vec.select.v256i32(<256 x i1>, <256 x i32>, <256 x i32>, i32)
6 define fastcc <256 x i32> @test_vec_select_v256i32_vv(<256 x i32> %i0, <256 x i32> %i1, <256 x i1> %m) {
7 ; CHECK-LABEL: test_vec_select_v256i32_vv:
9 ; CHECK-NEXT: lea %s0, 256
11 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
12 ; CHECK-NEXT: lea %s16, 256
13 ; CHECK-NEXT: lvl %s16
14 ; CHECK-NEXT: vor %v0, (0)1, %v1
15 ; CHECK-NEXT: b.l.t (, %s10)
16 %r0 = select <256 x i1> %m, <256 x i32> %i0, <256 x i32> %i1
20 define fastcc <256 x i32> @test_vec_select_v256i32_vr(<256 x i32> %i0, i32 %s1, <256 x i1> %m) {
21 ; CHECK-LABEL: test_vec_select_v256i32_vr:
23 ; CHECK-NEXT: and %s0, %s0, (32)0
24 ; CHECK-NEXT: lea %s1, 256
26 ; CHECK-NEXT: vbrd %v1, %s0
27 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
28 ; CHECK-NEXT: lea %s16, 256
29 ; CHECK-NEXT: lvl %s16
30 ; CHECK-NEXT: vor %v0, (0)1, %v1
31 ; CHECK-NEXT: b.l.t (, %s10)
32 %xins = insertelement <256 x i32> undef, i32 %s1, i32 0
33 %i1 = shufflevector <256 x i32> %xins, <256 x i32> undef, <256 x i32> zeroinitializer
34 %r0 = select <256 x i1> %m, <256 x i32> %i0, <256 x i32> %i1
38 declare <256 x float> @llvm.vec.select.v256f32(<256 x i1>, <256 x float>, <256 x float>, i32)
40 define fastcc <256 x float> @test_vec_select_v256f32_vv(<256 x float> %i0, <256 x float> %i1, <256 x i1> %m) {
41 ; CHECK-LABEL: test_vec_select_v256f32_vv:
43 ; CHECK-NEXT: lea %s0, 256
45 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
46 ; CHECK-NEXT: lea %s16, 256
47 ; CHECK-NEXT: lvl %s16
48 ; CHECK-NEXT: vor %v0, (0)1, %v1
49 ; CHECK-NEXT: b.l.t (, %s10)
50 %r0 = select <256 x i1> %m, <256 x float> %i0, <256 x float> %i1
54 define fastcc <256 x float> @test_vec_select_v256f32_vr(<256 x float> %i0, float %s1, <256 x i1> %m) {
55 ; CHECK-LABEL: test_vec_select_v256f32_vr:
57 ; CHECK-NEXT: lea %s1, 256
59 ; CHECK-NEXT: vbrd %v1, %s0
60 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
61 ; CHECK-NEXT: lea %s16, 256
62 ; CHECK-NEXT: lvl %s16
63 ; CHECK-NEXT: vor %v0, (0)1, %v1
64 ; CHECK-NEXT: b.l.t (, %s10)
65 %xins = insertelement <256 x float> undef, float %s1, i32 0
66 %i1 = shufflevector <256 x float> %xins, <256 x float> undef, <256 x i32> zeroinitializer
67 %r0 = select <256 x i1> %m, <256 x float> %i0, <256 x float> %i1
71 declare <256 x double> @llvm.vec.select.v256f64(<256 x i1>, <256 x double>, <256 x double>, i32)
73 define fastcc <256 x double> @test_vec_select_v256f64_vv(<256 x double> %i0, <256 x double> %i1, <256 x i1> %m) {
74 ; CHECK-LABEL: test_vec_select_v256f64_vv:
76 ; CHECK-NEXT: lea %s0, 256
78 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
79 ; CHECK-NEXT: lea %s16, 256
80 ; CHECK-NEXT: lvl %s16
81 ; CHECK-NEXT: vor %v0, (0)1, %v1
82 ; CHECK-NEXT: b.l.t (, %s10)
83 %r0 = select <256 x i1> %m, <256 x double> %i0, <256 x double> %i1
84 ret <256 x double> %r0
87 define fastcc <256 x double> @test_vec_select_v256f64_vr(<256 x double> %i0, double %s1, <256 x i1> %m) {
88 ; CHECK-LABEL: test_vec_select_v256f64_vr:
90 ; CHECK-NEXT: lea %s1, 256
92 ; CHECK-NEXT: vbrd %v1, %s0
93 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
94 ; CHECK-NEXT: lea %s16, 256
95 ; CHECK-NEXT: lvl %s16
96 ; CHECK-NEXT: vor %v0, (0)1, %v1
97 ; CHECK-NEXT: b.l.t (, %s10)
98 %xins = insertelement <256 x double> undef, double %s1, i32 0
99 %i1 = shufflevector <256 x double> %xins, <256 x double> undef, <256 x i32> zeroinitializer
100 %r0 = select <256 x i1> %m, <256 x double> %i0, <256 x double> %i1
101 ret <256 x double> %r0
104 declare <256 x i64> @llvm.vec.select.v256i64(<256 x i1>, <256 x i64>, <256 x i64>, i32)
106 define fastcc <256 x i64> @test_vec_select_v256i64_vv(<256 x i64> %i0, <256 x i64> %i1, <256 x i1> %m) {
107 ; CHECK-LABEL: test_vec_select_v256i64_vv:
109 ; CHECK-NEXT: lea %s0, 256
110 ; CHECK-NEXT: lvl %s0
111 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
112 ; CHECK-NEXT: lea %s16, 256
113 ; CHECK-NEXT: lvl %s16
114 ; CHECK-NEXT: vor %v0, (0)1, %v1
115 ; CHECK-NEXT: b.l.t (, %s10)
116 %r0 = select <256 x i1> %m, <256 x i64> %i0, <256 x i64> %i1
120 define fastcc <256 x i64> @test_vec_select_v256i64_vr(<256 x i64> %i0, i64 %s1, <256 x i1> %m) {
121 ; CHECK-LABEL: test_vec_select_v256i64_vr:
123 ; CHECK-NEXT: lea %s1, 256
124 ; CHECK-NEXT: lvl %s1
125 ; CHECK-NEXT: vbrd %v1, %s0
126 ; CHECK-NEXT: vmrg %v1, %v1, %v0, %vm1
127 ; CHECK-NEXT: lea %s16, 256
128 ; CHECK-NEXT: lvl %s16
129 ; CHECK-NEXT: vor %v0, (0)1, %v1
130 ; CHECK-NEXT: b.l.t (, %s10)
131 %xins = insertelement <256 x i64> undef, i64 %s1, i32 0
132 %i1 = shufflevector <256 x i64> %xins, <256 x i64> undef, <256 x i32> zeroinitializer
133 %r0 = select <256 x i1> %m, <256 x i64> %i0, <256 x i64> %i1