1 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=corei7-avx -mattr=+avx | FileCheck %s 2 3 declare i32 @llvm.x86.avx.ptestz.256(<4 x i64> %p1, <4 x i64> %p2) nounwind 4 declare i32 @llvm.x86.avx.ptestc.256(<4 x i64> %p1, <4 x i64> %p2) nounwind 5 6 define <4 x float> @test1(<4 x i64> %a, <4 x float> %b) nounwind { 7 entry: 8 ; CHECK-LABEL: test1: 9 ; CHECK: vptest 10 ; CHECK-NEXT: jne 11 ; CHECK: ret 12 13 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind 14 %one = icmp ne i32 %res, 0 15 br i1 %one, label %bb1, label %bb2 16 17 bb1: 18 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 19 br label %return 20 21 bb2: 22 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 23 br label %return 24 25 return: 26 %e = phi <4 x float> [%c, %bb1], [%d, %bb2] 27 ret <4 x float> %e 28 } 29 30 define <4 x float> @test3(<4 x i64> %a, <4 x float> %b) nounwind { 31 entry: 32 ; CHECK-LABEL: test3: 33 ; CHECK: vptest 34 ; CHECK-NEXT: jne 35 ; CHECK: ret 36 37 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind 38 %one = trunc i32 %res to i1 39 br i1 %one, label %bb1, label %bb2 40 41 bb1: 42 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 43 br label %return 44 45 bb2: 46 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 47 br label %return 48 49 return: 50 %e = phi <4 x float> [%c, %bb1], [%d, %bb2] 51 ret <4 x float> %e 52 } 53 54 define <4 x float> @test4(<4 x i64> %a, <4 x float> %b) nounwind { 55 entry: 56 ; CHECK-LABEL: test4: 57 ; CHECK: vptest 58 ; CHECK-NEXT: jae 59 ; CHECK: ret 60 61 %res = call i32 @llvm.x86.avx.ptestc.256(<4 x i64> %a, <4 x i64> %a) nounwind 62 %one = icmp ne i32 %res, 0 63 br i1 %one, label %bb1, label %bb2 64 65 bb1: 66 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 67 br label %return 68 69 bb2: 70 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 71 br label %return 72 73 return: 74 %e = phi <4 x float> [%c, %bb1], [%d, %bb2] 75 ret <4 x float> %e 76 } 77 78 define <4 x float> @test6(<4 x i64> %a, <4 x float> %b) nounwind { 79 entry: 80 ; CHECK-LABEL: test6: 81 ; CHECK: vptest 82 ; CHECK-NEXT: jae 83 ; CHECK: ret 84 85 %res = call i32 @llvm.x86.avx.ptestc.256(<4 x i64> %a, <4 x i64> %a) nounwind 86 %one = trunc i32 %res to i1 87 br i1 %one, label %bb1, label %bb2 88 89 bb1: 90 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 91 br label %return 92 93 bb2: 94 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 95 br label %return 96 97 return: 98 %e = phi <4 x float> [%c, %bb1], [%d, %bb2] 99 ret <4 x float> %e 100 } 101 102 define <4 x float> @test7(<4 x i64> %a, <4 x float> %b) nounwind { 103 entry: 104 ; CHECK-LABEL: test7: 105 ; CHECK: vptest 106 ; CHECK-NEXT: jne 107 ; CHECK: ret 108 109 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind 110 %one = icmp eq i32 %res, 1 111 br i1 %one, label %bb1, label %bb2 112 113 bb1: 114 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 115 br label %return 116 117 bb2: 118 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 119 br label %return 120 121 return: 122 %e = phi <4 x float> [%c, %bb1], [%d, %bb2] 123 ret <4 x float> %e 124 } 125 126 define <4 x float> @test8(<4 x i64> %a, <4 x float> %b) nounwind { 127 entry: 128 ; CHECK-LABEL: test8: 129 ; CHECK: vptest 130 ; CHECK-NEXT: je 131 ; CHECK: ret 132 133 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind 134 %one = icmp ne i32 %res, 1 135 br i1 %one, label %bb1, label %bb2 136 137 bb1: 138 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 139 br label %return 140 141 bb2: 142 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 > 143 br label %return 144 145 return: 146 %e = phi <4 x float> [%c, %bb1], [%d, %bb2] 147 ret <4 x float> %e 148 } 149 150 151