1 ; RUN: llc -mtriple=amdgcn-- -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: extract_2xi16
4 ; GCN: buffer_load_ushort
5 ; GCN: buffer_load_ushort
6 ; GCN: buffer_load_ushort
7 ; GCN: buffer_load_ushort
8 ; GCN: buffer_load_ushort
9 ; GCN: buffer_load_ushort
10 ; GCN: buffer_load_ushort
11 ; GCN: buffer_load_ushort
12 ; GCN: buffer_load_ushort
13 ; GCN: buffer_load_ushort
14 ; GCN: buffer_load_ushort
15 ; GCN: buffer_load_ushort
16 ; GCN: buffer_load_ushort
17 ; GCN: buffer_load_ushort
18 ; GCN: buffer_load_ushort
19 ; GCN: buffer_load_ushort
23 define <2 x i16> @extract_2xi16(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
24 br i1 %c0, label %T, label %F
27 %t = load volatile <8 x i16>, ptr addrspace(1) %p0
31 %f = load volatile <8 x i16>, ptr addrspace(1) %p1
35 %m = phi <8 x i16> [ %t, %T ], [ %f, %F ]
36 %v2 = shufflevector <8 x i16> %m, <8 x i16> undef, <2 x i32> <i32 0, i32 1>
37 %b2 = icmp sgt <2 x i16> %v2, <i16 -1, i16 -1>
38 %r2 = select <2 x i1> %b2, <2 x i16> <i16 -32768, i16 -32768>, <2 x i16> <i16 -1, i16 -1>
42 ; GCN-LABEL: extract_2xi64
43 ; GCN-COUNT-2: v_cndmask_b32
44 define <2 x i64> @extract_2xi64(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
45 br i1 %c0, label %T, label %F
48 %t = load volatile <8 x i64>, ptr addrspace(1) %p0
52 %f = load volatile <8 x i64>, ptr addrspace(1) %p1
56 %m = phi <8 x i64> [ %t, %T ], [ %f, %F ]
57 %v2 = shufflevector <8 x i64> %m, <8 x i64> undef, <2 x i32> <i32 0, i32 1>
58 %b2 = icmp sgt <2 x i64> %v2, <i64 -1, i64 -1>
59 %r2 = select <2 x i1> %b2, <2 x i64> <i64 -32768, i64 -32768>, <2 x i64> <i64 -1, i64 -1>
63 ; GCN-LABEL: extract_4xi64
64 ; GCN-COUNT-4: v_cndmask_b32
65 define <4 x i64> @extract_4xi64(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
66 br i1 %c0, label %T, label %F
69 %t = load volatile <8 x i64>, ptr addrspace(1) %p0
73 %f = load volatile <8 x i64>, ptr addrspace(1) %p1
77 %m = phi <8 x i64> [ %t, %T ], [ %f, %F ]
78 %v2 = shufflevector <8 x i64> %m, <8 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
79 %b2 = icmp sgt <4 x i64> %v2, <i64 -1, i64 -1, i64 -1, i64 -1>
80 %r2 = select <4 x i1> %b2, <4 x i64> <i64 -32768, i64 -32768, i64 -32768, i64 -32768>, <4 x i64> <i64 -1, i64 -1, i64 -1, i64 -1>
84 ; GCN-LABEL: extract_8xi64
85 ; GCN-COUNT-8: v_cndmask_b32
86 define <8 x i64> @extract_8xi64(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
87 br i1 %c0, label %T, label %F
90 %t = load volatile <16 x i64>, ptr addrspace(1) %p0
94 %f = load volatile <16 x i64>, ptr addrspace(1) %p1
98 %m = phi <16 x i64> [ %t, %T ], [ %f, %F ]
99 %v2 = shufflevector <16 x i64> %m, <16 x i64> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
100 %b2 = icmp sgt <8 x i64> %v2, <i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1>
101 %r2 = select <8 x i1> %b2, <8 x i64> <i64 -32768, i64 -32768, i64 -32768, i64 -32768, i64 -32768, i64 -32768, i64 -32768, i64 -32768>, <8 x i64> <i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1>
105 ; GCN-LABEL: extract_2xf64
106 ; GCN-COUNT-2: v_cndmask_b32
107 define <2 x double> @extract_2xf64(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
108 br i1 %c0, label %T, label %F
111 %t = load volatile <8 x double>, ptr addrspace(1) %p0
115 %f = load volatile <8 x double>, ptr addrspace(1) %p1
119 %m = phi <8 x double> [ %t, %T ], [ %f, %F ]
120 %v2 = shufflevector <8 x double> %m, <8 x double> undef, <2 x i32> <i32 0, i32 1>
121 %b2 = fcmp ogt <2 x double> %v2, <double -1.0, double -1.0>
122 %r2 = select <2 x i1> %b2, <2 x double> <double -2.0, double -2.0>, <2 x double> <double -1.0, double -1.0>
126 ; GCN-LABEL: extract_4xf64
127 ; GCN-COUNT-4: v_cndmask_b32
128 define <4 x double> @extract_4xf64(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
129 br i1 %c0, label %T, label %F
132 %t = load volatile <8 x double>, ptr addrspace(1) %p0
136 %f = load volatile <8 x double>, ptr addrspace(1) %p1
140 %m = phi <8 x double> [ %t, %T ], [ %f, %F ]
141 %v2 = shufflevector <8 x double> %m, <8 x double> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
142 %b2 = fcmp ogt <4 x double> %v2, <double -1.0, double -1.0, double -1.0, double -1.0>
143 %r2 = select <4 x i1> %b2, <4 x double> <double -2.0, double -2.0, double -2.0, double -2.0>, <4 x double> <double -1.0, double -1.0, double -1.0, double -1.0>
147 ; GCN-LABEL: extract_8xf64
148 ; GCN-COUNT-8: v_cndmask_b32
149 define <8 x double> @extract_8xf64(ptr addrspace(1) %p0, ptr addrspace(1) %p1, i1 %c0) {
150 br i1 %c0, label %T, label %F
153 %t = load volatile <16 x double>, ptr addrspace(1) %p0
157 %f = load volatile <16 x double>, ptr addrspace(1) %p1
161 %m = phi <16 x double> [ %t, %T ], [ %f, %F ]
162 %v2 = shufflevector <16 x double> %m, <16 x double> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
163 %b2 = fcmp ogt <8 x double> %v2, <double -1.0, double -1.0, double -1.0, double -1.0, double -1.0, double -1.0, double -1.0, double -1.0>
164 %r2 = select <8 x i1> %b2, <8 x double> <double -2.0, double -2.0, double -2.0, double -2.0, double -2.0, double -2.0, double -2.0, double -2.0>, <8 x double> <double -1.0, double -1.0, double -1.0, double -1.0, double -1.0, double -1.0, double -1.0, double -1.0>