1; RUN: opt -mtriple=nvptx64-nvidia-cuda -load-store-vectorizer -S -o - %s | FileCheck %s 2 3define void @ldg_f16(half* nocapture align 16 %rd0) { 4 %in1b = bitcast half* %rd0 to <2 x half>* 5 %load1 = load <2 x half>, <2 x half>* %in1b, align 4 6 %p1 = fcmp ogt <2 x half> %load1, zeroinitializer 7 %s1 = select <2 x i1> %p1, <2 x half> %load1, <2 x half> zeroinitializer 8 store <2 x half> %s1, <2 x half>* %in1b, align 4 9 %in2 = getelementptr half, half* %rd0, i64 2 10 %in2b = bitcast half* %in2 to <2 x half>* 11 %load2 = load <2 x half>, <2 x half>* %in2b, align 4 12 %p2 = fcmp ogt <2 x half> %load2, zeroinitializer 13 %s2 = select <2 x i1> %p2, <2 x half> %load2, <2 x half> zeroinitializer 14 store <2 x half> %s2, <2 x half>* %in2b, align 4 15 %in3 = getelementptr half, half* %rd0, i64 4 16 %in3b = bitcast half* %in3 to <2 x half>* 17 %load3 = load <2 x half>, <2 x half>* %in3b, align 4 18 %p3 = fcmp ogt <2 x half> %load3, zeroinitializer 19 %s3 = select <2 x i1> %p3, <2 x half> %load3, <2 x half> zeroinitializer 20 store <2 x half> %s3, <2 x half>* %in3b, align 4 21 %in4 = getelementptr half, half* %rd0, i64 6 22 %in4b = bitcast half* %in4 to <2 x half>* 23 %load4 = load <2 x half>, <2 x half>* %in4b, align 4 24 %p4 = fcmp ogt <2 x half> %load4, zeroinitializer 25 %s4 = select <2 x i1> %p4, <2 x half> %load4, <2 x half> zeroinitializer 26 store <2 x half> %s4, <2 x half>* %in4b, align 4 27 ret void 28 29; CHECK-LABEL: @ldg_f16 30; CHECK: %[[LD:.*]] = load <8 x half>, <8 x half>* 31; CHECK: shufflevector <8 x half> %[[LD]], <8 x half> poison, <2 x i32> <i32 0, i32 1> 32; CHECK: shufflevector <8 x half> %[[LD]], <8 x half> poison, <2 x i32> <i32 2, i32 3> 33; CHECK: shufflevector <8 x half> %[[LD]], <8 x half> poison, <2 x i32> <i32 4, i32 5> 34; CHECK: shufflevector <8 x half> %[[LD]], <8 x half> poison, <2 x i32> <i32 6, i32 7> 35; CHECK: store <8 x half> 36} 37 38define void @no_nonpow2_vector(half* nocapture align 16 %rd0) { 39 %in1b = bitcast half* %rd0 to <3 x half>* 40 %load1 = load <3 x half>, <3 x half>* %in1b, align 4 41 %p1 = fcmp ogt <3 x half> %load1, zeroinitializer 42 %s1 = select <3 x i1> %p1, <3 x half> %load1, <3 x half> zeroinitializer 43 store <3 x half> %s1, <3 x half>* %in1b, align 4 44 %in2 = getelementptr half, half* %rd0, i64 3 45 %in2b = bitcast half* %in2 to <3 x half>* 46 %load2 = load <3 x half>, <3 x half>* %in2b, align 4 47 %p2 = fcmp ogt <3 x half> %load2, zeroinitializer 48 %s2 = select <3 x i1> %p2, <3 x half> %load2, <3 x half> zeroinitializer 49 store <3 x half> %s2, <3 x half>* %in2b, align 4 50 %in3 = getelementptr half, half* %rd0, i64 6 51 %in3b = bitcast half* %in3 to <3 x half>* 52 %load3 = load <3 x half>, <3 x half>* %in3b, align 4 53 %p3 = fcmp ogt <3 x half> %load3, zeroinitializer 54 %s3 = select <3 x i1> %p3, <3 x half> %load3, <3 x half> zeroinitializer 55 store <3 x half> %s3, <3 x half>* %in3b, align 4 56 %in4 = getelementptr half, half* %rd0, i64 9 57 %in4b = bitcast half* %in4 to <3 x half>* 58 %load4 = load <3 x half>, <3 x half>* %in4b, align 4 59 %p4 = fcmp ogt <3 x half> %load4, zeroinitializer 60 %s4 = select <3 x i1> %p4, <3 x half> %load4, <3 x half> zeroinitializer 61 store <3 x half> %s4, <3 x half>* %in4b, align 4 62 ret void 63 64; CHECK-LABEL: @no_nonpow2_vector 65; CHECK-NOT: shufflevector 66} 67 68define void @no_pointer_vector(half** nocapture align 16 %rd0) { 69 %in1b = bitcast half** %rd0 to <2 x half*>* 70 %load1 = load <2 x half*>, <2 x half*>* %in1b, align 4 71 %p1 = icmp ne <2 x half*> %load1, zeroinitializer 72 %s1 = select <2 x i1> %p1, <2 x half*> %load1, <2 x half*> zeroinitializer 73 store <2 x half*> %s1, <2 x half*>* %in1b, align 4 74 %in2 = getelementptr half*, half** %rd0, i64 2 75 %in2b = bitcast half** %in2 to <2 x half*>* 76 %load2 = load <2 x half*>, <2 x half*>* %in2b, align 4 77 %p2 = icmp ne <2 x half*> %load2, zeroinitializer 78 %s2 = select <2 x i1> %p2, <2 x half*> %load2, <2 x half*> zeroinitializer 79 store <2 x half*> %s2, <2 x half*>* %in2b, align 4 80 %in3 = getelementptr half*, half** %rd0, i64 4 81 %in3b = bitcast half** %in3 to <2 x half*>* 82 %load3 = load <2 x half*>, <2 x half*>* %in3b, align 4 83 %p3 = icmp ne <2 x half*> %load3, zeroinitializer 84 %s3 = select <2 x i1> %p3, <2 x half*> %load3, <2 x half*> zeroinitializer 85 store <2 x half*> %s3, <2 x half*>* %in3b, align 4 86 %in4 = getelementptr half*, half** %rd0, i64 6 87 %in4b = bitcast half** %in4 to <2 x half*>* 88 %load4 = load <2 x half*>, <2 x half*>* %in4b, align 4 89 %p4 = icmp ne <2 x half*> %load4, zeroinitializer 90 %s4 = select <2 x i1> %p4, <2 x half*> %load4, <2 x half*> zeroinitializer 91 store <2 x half*> %s4, <2 x half*>* %in4b, align 4 92 ret void 93 94; CHECK-LABEL: @no_pointer_vector 95; CHECK-NOT: shufflevector 96} 97