1; RUN: llc -march=amdgcn -mtriple=amdgcn-- -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s 2 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 20; GCN: v_bfe_i32 21; GCN: v_bfe_i32 22 23define <2 x i16> @extract_2xi16(<8 x i16> addrspace(1) * %p0, <8 x i16> addrspace(1) * %p1) { 24 br i1 undef, label %T, label %F 25 26T: 27 %t = load volatile <8 x i16>, <8 x i16> addrspace(1) * %p0 28 br label %exit 29 30F: 31 %f = load volatile <8 x i16>, <8 x i16> addrspace(1) * %p1 32 br label %exit 33 34exit: 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> 39 ret <2 x i16> %r2 40} 41 42; GCN-LABEL: extract_2xi64 43; GCN-COUNT-2: v_cndmask_b32 44define <2 x i64> @extract_2xi64(<8 x i64> addrspace(1) * %p0, <8 x i64> addrspace(1) * %p1) { 45 br i1 undef, label %T, label %F 46 47T: 48 %t = load volatile <8 x i64>, <8 x i64> addrspace(1) * %p0 49 br label %exit 50 51F: 52 %f = load volatile <8 x i64>, <8 x i64> addrspace(1) * %p1 53 br label %exit 54 55exit: 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> 60 ret <2 x i64> %r2 61} 62 63; GCN-LABEL: extract_4xi64 64; GCN-COUNT-4: v_cndmask_b32 65define <4 x i64> @extract_4xi64(<8 x i64> addrspace(1) * %p0, <8 x i64> addrspace(1) * %p1) { 66 br i1 undef, label %T, label %F 67 68T: 69 %t = load volatile <8 x i64>, <8 x i64> addrspace(1) * %p0 70 br label %exit 71 72F: 73 %f = load volatile <8 x i64>, <8 x i64> addrspace(1) * %p1 74 br label %exit 75 76exit: 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> 81 ret <4 x i64> %r2 82} 83 84; GCN-LABEL: extract_8xi64 85; GCN-COUNT-8: v_cndmask_b32 86define <8 x i64> @extract_8xi64(<16 x i64> addrspace(1) * %p0, <16 x i64> addrspace(1) * %p1) { 87 br i1 undef, label %T, label %F 88 89T: 90 %t = load volatile <16 x i64>, <16 x i64> addrspace(1) * %p0 91 br label %exit 92 93F: 94 %f = load volatile <16 x i64>, <16 x i64> addrspace(1) * %p1 95 br label %exit 96 97exit: 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> 102 ret <8 x i64> %r2 103} 104 105; GCN-LABEL: extract_2xf64 106; GCN-COUNT-2: v_cndmask_b32 107define <2 x double> @extract_2xf64(<8 x double> addrspace(1) * %p0, <8 x double> addrspace(1) * %p1) { 108 br i1 undef, label %T, label %F 109 110T: 111 %t = load volatile <8 x double>, <8 x double> addrspace(1) * %p0 112 br label %exit 113 114F: 115 %f = load volatile <8 x double>, <8 x double> addrspace(1) * %p1 116 br label %exit 117 118exit: 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> 123 ret <2 x double> %r2 124} 125 126; GCN-LABEL: extract_4xf64 127; GCN-COUNT-4: v_cndmask_b32 128define <4 x double> @extract_4xf64(<8 x double> addrspace(1) * %p0, <8 x double> addrspace(1) * %p1) { 129 br i1 undef, label %T, label %F 130 131T: 132 %t = load volatile <8 x double>, <8 x double> addrspace(1) * %p0 133 br label %exit 134 135F: 136 %f = load volatile <8 x double>, <8 x double> addrspace(1) * %p1 137 br label %exit 138 139exit: 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> 144 ret <4 x double> %r2 145} 146 147; GCN-LABEL: extract_8xf64 148; GCN-COUNT-8: v_cndmask_b32 149define <8 x double> @extract_8xf64(<16 x double> addrspace(1) * %p0, <16 x double> addrspace(1) * %p1) { 150 br i1 undef, label %T, label %F 151 152T: 153 %t = load volatile <16 x double>, <16 x double> addrspace(1) * %p0 154 br label %exit 155 156F: 157 %f = load volatile <16 x double>, <16 x double> addrspace(1) * %p1 158 br label %exit 159 160exit: 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> 165 ret <8 x double> %r2 166} 167