1*f4a2713aSLionel Sambuc; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+sse4.1,-avx < %s | FileCheck %s --check-prefix SSE41 2*f4a2713aSLionel Sambuc; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx,-avx2 < %s | FileCheck %s --check-prefix AVX 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambucdefine i32 @veccond128(<4 x i32> %input) { 5*f4a2713aSLionel Sambucentry: 6*f4a2713aSLionel Sambuc %0 = bitcast <4 x i32> %input to i128 7*f4a2713aSLionel Sambuc %1 = icmp ne i128 %0, 0 8*f4a2713aSLionel Sambuc br i1 %1, label %if-true-block, label %endif-block 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambucif-true-block: ; preds = %entry 11*f4a2713aSLionel Sambuc ret i32 0 12*f4a2713aSLionel Sambucendif-block: ; preds = %entry, 13*f4a2713aSLionel Sambuc ret i32 1 14*f4a2713aSLionel Sambuc; SSE41: veccond128 15*f4a2713aSLionel Sambuc; SSE41: ptest 16*f4a2713aSLionel Sambuc; SSE41: ret 17*f4a2713aSLionel Sambuc; AVX: veccond128 18*f4a2713aSLionel Sambuc; AVX: vptest %xmm{{.*}}, %xmm{{.*}} 19*f4a2713aSLionel Sambuc; AVX: ret 20*f4a2713aSLionel Sambuc} 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambucdefine i32 @veccond256(<8 x i32> %input) { 23*f4a2713aSLionel Sambucentry: 24*f4a2713aSLionel Sambuc %0 = bitcast <8 x i32> %input to i256 25*f4a2713aSLionel Sambuc %1 = icmp ne i256 %0, 0 26*f4a2713aSLionel Sambuc br i1 %1, label %if-true-block, label %endif-block 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambucif-true-block: ; preds = %entry 29*f4a2713aSLionel Sambuc ret i32 0 30*f4a2713aSLionel Sambucendif-block: ; preds = %entry, 31*f4a2713aSLionel Sambuc ret i32 1 32*f4a2713aSLionel Sambuc; SSE41: veccond256 33*f4a2713aSLionel Sambuc; SSE41: por 34*f4a2713aSLionel Sambuc; SSE41: ptest 35*f4a2713aSLionel Sambuc; SSE41: ret 36*f4a2713aSLionel Sambuc; AVX: veccond256 37*f4a2713aSLionel Sambuc; AVX: vptest %ymm{{.*}}, %ymm{{.*}} 38*f4a2713aSLionel Sambuc; AVX: ret 39*f4a2713aSLionel Sambuc} 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambucdefine i32 @veccond512(<16 x i32> %input) { 42*f4a2713aSLionel Sambucentry: 43*f4a2713aSLionel Sambuc %0 = bitcast <16 x i32> %input to i512 44*f4a2713aSLionel Sambuc %1 = icmp ne i512 %0, 0 45*f4a2713aSLionel Sambuc br i1 %1, label %if-true-block, label %endif-block 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambucif-true-block: ; preds = %entry 48*f4a2713aSLionel Sambuc ret i32 0 49*f4a2713aSLionel Sambucendif-block: ; preds = %entry, 50*f4a2713aSLionel Sambuc ret i32 1 51*f4a2713aSLionel Sambuc; SSE41: veccond512 52*f4a2713aSLionel Sambuc; SSE41: por 53*f4a2713aSLionel Sambuc; SSE41: por 54*f4a2713aSLionel Sambuc; SSE41: por 55*f4a2713aSLionel Sambuc; SSE41: ptest 56*f4a2713aSLionel Sambuc; SSE41: ret 57*f4a2713aSLionel Sambuc; AVX: veccond512 58*f4a2713aSLionel Sambuc; AVX: vorps 59*f4a2713aSLionel Sambuc; AVX: vptest %ymm{{.*}}, %ymm{{.*}} 60*f4a2713aSLionel Sambuc; AVX: ret 61*f4a2713aSLionel Sambuc} 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambucdefine i32 @vectest128(<4 x i32> %input) { 64*f4a2713aSLionel Sambucentry: 65*f4a2713aSLionel Sambuc %0 = bitcast <4 x i32> %input to i128 66*f4a2713aSLionel Sambuc %1 = icmp ne i128 %0, 0 67*f4a2713aSLionel Sambuc %2 = zext i1 %1 to i32 68*f4a2713aSLionel Sambuc ret i32 %2 69*f4a2713aSLionel Sambuc; SSE41: vectest128 70*f4a2713aSLionel Sambuc; SSE41: ptest 71*f4a2713aSLionel Sambuc; SSE41: ret 72*f4a2713aSLionel Sambuc; AVX: vectest128 73*f4a2713aSLionel Sambuc; AVX: vptest %xmm{{.*}}, %xmm{{.*}} 74*f4a2713aSLionel Sambuc; AVX: ret 75*f4a2713aSLionel Sambuc} 76*f4a2713aSLionel Sambuc 77*f4a2713aSLionel Sambucdefine i32 @vectest256(<8 x i32> %input) { 78*f4a2713aSLionel Sambucentry: 79*f4a2713aSLionel Sambuc %0 = bitcast <8 x i32> %input to i256 80*f4a2713aSLionel Sambuc %1 = icmp ne i256 %0, 0 81*f4a2713aSLionel Sambuc %2 = zext i1 %1 to i32 82*f4a2713aSLionel Sambuc ret i32 %2 83*f4a2713aSLionel Sambuc; SSE41: vectest256 84*f4a2713aSLionel Sambuc; SSE41: por 85*f4a2713aSLionel Sambuc; SSE41: ptest 86*f4a2713aSLionel Sambuc; SSE41: ret 87*f4a2713aSLionel Sambuc; AVX: vectest256 88*f4a2713aSLionel Sambuc; AVX: vptest %ymm{{.*}}, %ymm{{.*}} 89*f4a2713aSLionel Sambuc; AVX: ret 90*f4a2713aSLionel Sambuc} 91*f4a2713aSLionel Sambuc 92*f4a2713aSLionel Sambucdefine i32 @vectest512(<16 x i32> %input) { 93*f4a2713aSLionel Sambucentry: 94*f4a2713aSLionel Sambuc %0 = bitcast <16 x i32> %input to i512 95*f4a2713aSLionel Sambuc %1 = icmp ne i512 %0, 0 96*f4a2713aSLionel Sambuc %2 = zext i1 %1 to i32 97*f4a2713aSLionel Sambuc ret i32 %2 98*f4a2713aSLionel Sambuc; SSE41: vectest512 99*f4a2713aSLionel Sambuc; SSE41: por 100*f4a2713aSLionel Sambuc; SSE41: por 101*f4a2713aSLionel Sambuc; SSE41: por 102*f4a2713aSLionel Sambuc; SSE41: ptest 103*f4a2713aSLionel Sambuc; SSE41: ret 104*f4a2713aSLionel Sambuc; AVX: vectest512 105*f4a2713aSLionel Sambuc; AVX: vorps 106*f4a2713aSLionel Sambuc; AVX: vptest %ymm{{.*}}, %ymm{{.*}} 107*f4a2713aSLionel Sambuc; AVX: ret 108*f4a2713aSLionel Sambuc} 109*f4a2713aSLionel Sambuc 110*f4a2713aSLionel Sambucdefine i32 @vecsel128(<4 x i32> %input, i32 %a, i32 %b) { 111*f4a2713aSLionel Sambucentry: 112*f4a2713aSLionel Sambuc %0 = bitcast <4 x i32> %input to i128 113*f4a2713aSLionel Sambuc %1 = icmp ne i128 %0, 0 114*f4a2713aSLionel Sambuc %2 = select i1 %1, i32 %a, i32 %b 115*f4a2713aSLionel Sambuc ret i32 %2 116*f4a2713aSLionel Sambuc; SSE41: vecsel128 117*f4a2713aSLionel Sambuc; SSE41: ptest 118*f4a2713aSLionel Sambuc; SSE41: ret 119*f4a2713aSLionel Sambuc; AVX: vecsel128 120*f4a2713aSLionel Sambuc; AVX: vptest %xmm{{.*}}, %xmm{{.*}} 121*f4a2713aSLionel Sambuc; AVX: ret 122*f4a2713aSLionel Sambuc} 123*f4a2713aSLionel Sambuc 124*f4a2713aSLionel Sambucdefine i32 @vecsel256(<8 x i32> %input, i32 %a, i32 %b) { 125*f4a2713aSLionel Sambucentry: 126*f4a2713aSLionel Sambuc %0 = bitcast <8 x i32> %input to i256 127*f4a2713aSLionel Sambuc %1 = icmp ne i256 %0, 0 128*f4a2713aSLionel Sambuc %2 = select i1 %1, i32 %a, i32 %b 129*f4a2713aSLionel Sambuc ret i32 %2 130*f4a2713aSLionel Sambuc; SSE41: vecsel256 131*f4a2713aSLionel Sambuc; SSE41: por 132*f4a2713aSLionel Sambuc; SSE41: ptest 133*f4a2713aSLionel Sambuc; SSE41: ret 134*f4a2713aSLionel Sambuc; AVX: vecsel256 135*f4a2713aSLionel Sambuc; AVX: vptest %ymm{{.*}}, %ymm{{.*}} 136*f4a2713aSLionel Sambuc; AVX: ret 137*f4a2713aSLionel Sambuc} 138*f4a2713aSLionel Sambuc 139*f4a2713aSLionel Sambucdefine i32 @vecsel512(<16 x i32> %input, i32 %a, i32 %b) { 140*f4a2713aSLionel Sambucentry: 141*f4a2713aSLionel Sambuc %0 = bitcast <16 x i32> %input to i512 142*f4a2713aSLionel Sambuc %1 = icmp ne i512 %0, 0 143*f4a2713aSLionel Sambuc %2 = select i1 %1, i32 %a, i32 %b 144*f4a2713aSLionel Sambuc ret i32 %2 145*f4a2713aSLionel Sambuc; SSE41: vecsel512 146*f4a2713aSLionel Sambuc; SSE41: por 147*f4a2713aSLionel Sambuc; SSE41: por 148*f4a2713aSLionel Sambuc; SSE41: por 149*f4a2713aSLionel Sambuc; SSE41: ptest 150*f4a2713aSLionel Sambuc; SSE41: ret 151*f4a2713aSLionel Sambuc; AVX: vecsel512 152*f4a2713aSLionel Sambuc; AVX: vorps 153*f4a2713aSLionel Sambuc; AVX: vptest %ymm{{.*}}, %ymm{{.*}} 154*f4a2713aSLionel Sambuc; AVX: ret 155*f4a2713aSLionel Sambuc} 156