1; RUN: llc < %s -mcpu=yonah -mtriple=i386-apple-darwin | FileCheck %s 2 3 4define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) nounwind { 5; CHECK-LABEL: test1: 6; CHECK: pcmpgtd 7; CHECK: ret 8 9 %C = icmp sgt <4 x i32> %A, %B 10 %D = sext <4 x i1> %C to <4 x i32> 11 ret <4 x i32> %D 12} 13 14define <4 x i32> @test2(<4 x i32> %A, <4 x i32> %B) nounwind { 15; CHECK-LABEL: test2: 16; CHECK: pcmp 17; CHECK: pcmp 18; CHECK: pxor 19; CHECK: ret 20 %C = icmp sge <4 x i32> %A, %B 21 %D = sext <4 x i1> %C to <4 x i32> 22 ret <4 x i32> %D 23} 24 25define <4 x i32> @test3(<4 x i32> %A, <4 x i32> %B) nounwind { 26; CHECK-LABEL: test3: 27; CHECK: pcmpgtd 28; CHECK: movdqa 29; CHECK: ret 30 %C = icmp slt <4 x i32> %A, %B 31 %D = sext <4 x i1> %C to <4 x i32> 32 ret <4 x i32> %D 33} 34 35define <4 x i32> @test4(<4 x i32> %A, <4 x i32> %B) nounwind { 36; CHECK-LABEL: test4: 37; CHECK: movdqa 38; CHECK: pcmpgtd 39; CHECK: ret 40 %C = icmp ugt <4 x i32> %A, %B 41 %D = sext <4 x i1> %C to <4 x i32> 42 ret <4 x i32> %D 43} 44 45define <2 x i64> @test5(<2 x i64> %A, <2 x i64> %B) nounwind { 46; CHECK-LABEL: test5: 47; CHECK: pcmpeqd 48; CHECK: pshufd $177 49; CHECK: pand 50; CHECK: ret 51 %C = icmp eq <2 x i64> %A, %B 52 %D = sext <2 x i1> %C to <2 x i64> 53 ret <2 x i64> %D 54} 55 56define <2 x i64> @test6(<2 x i64> %A, <2 x i64> %B) nounwind { 57; CHECK-LABEL: test6: 58; CHECK: pcmpeqd 59; CHECK: pshufd $177 60; CHECK: pand 61; CHECK: pcmpeqd 62; CHECK: pxor 63; CHECK: ret 64 %C = icmp ne <2 x i64> %A, %B 65 %D = sext <2 x i1> %C to <2 x i64> 66 ret <2 x i64> %D 67} 68 69define <2 x i64> @test7(<2 x i64> %A, <2 x i64> %B) nounwind { 70; CHECK: [[CONSTSEG:[A-Z0-9_]*]]: 71; CHECK: .long 2147483648 72; CHECK-NEXT: .long 0 73; CHECK-NEXT: .long 2147483648 74; CHECK-NEXT: .long 0 75; CHECK-LABEL: test7: 76; CHECK: movdqa [[CONSTSEG]], [[CONSTREG:%xmm[0-9]*]] 77; CHECK: pxor [[CONSTREG]] 78; CHECK: pxor [[CONSTREG]] 79; CHECK: pcmpgtd %xmm1 80; CHECK: pshufd $160 81; CHECK: pcmpeqd 82; CHECK: pshufd $245 83; CHECK: pand 84; CHECK: pshufd $245 85; CHECK: por 86; CHECK: ret 87 %C = icmp sgt <2 x i64> %A, %B 88 %D = sext <2 x i1> %C to <2 x i64> 89 ret <2 x i64> %D 90} 91 92define <2 x i64> @test8(<2 x i64> %A, <2 x i64> %B) nounwind { 93; CHECK-LABEL: test8: 94; CHECK: pxor 95; CHECK: pxor 96; CHECK: pcmpgtd %xmm0 97; CHECK: pshufd $160 98; CHECK: pcmpeqd 99; CHECK: pshufd $245 100; CHECK: pand 101; CHECK: pshufd $245 102; CHECK: por 103; CHECK: ret 104 %C = icmp slt <2 x i64> %A, %B 105 %D = sext <2 x i1> %C to <2 x i64> 106 ret <2 x i64> %D 107} 108 109define <2 x i64> @test9(<2 x i64> %A, <2 x i64> %B) nounwind { 110; CHECK-LABEL: test9: 111; CHECK: pxor 112; CHECK: pxor 113; CHECK: pcmpgtd %xmm0 114; CHECK: pshufd $160 115; CHECK: pcmpeqd 116; CHECK: pshufd $245 117; CHECK: pand 118; CHECK: pshufd $245 119; CHECK: por 120; CHECK: pcmpeqd 121; CHECK: pxor 122; CHECK: ret 123 %C = icmp sge <2 x i64> %A, %B 124 %D = sext <2 x i1> %C to <2 x i64> 125 ret <2 x i64> %D 126} 127 128define <2 x i64> @test10(<2 x i64> %A, <2 x i64> %B) nounwind { 129; CHECK-LABEL: test10: 130; CHECK: pxor 131; CHECK: pxor 132; CHECK: pcmpgtd %xmm1 133; CHECK: pshufd $160 134; CHECK: pcmpeqd 135; CHECK: pshufd $245 136; CHECK: pand 137; CHECK: pshufd $245 138; CHECK: por 139; CHECK: pcmpeqd 140; CHECK: pxor 141; CHECK: ret 142 %C = icmp sle <2 x i64> %A, %B 143 %D = sext <2 x i1> %C to <2 x i64> 144 ret <2 x i64> %D 145} 146 147define <2 x i64> @test11(<2 x i64> %A, <2 x i64> %B) nounwind { 148; CHECK: [[CONSTSEG:[A-Z0-9_]*]]: 149; CHECK: .long 2147483648 150; CHECK-NEXT: .long 2147483648 151; CHECK-NEXT: .long 2147483648 152; CHECK-NEXT: .long 2147483648 153; CHECK-LABEL: test11: 154; CHECK: movdqa [[CONSTSEG]], [[CONSTREG:%xmm[0-9]*]] 155; CHECK: pxor [[CONSTREG]] 156; CHECK: pxor [[CONSTREG]] 157; CHECK: pcmpgtd %xmm1 158; CHECK: pshufd $160 159; CHECK: pcmpeqd 160; CHECK: pshufd $245 161; CHECK: pand 162; CHECK: pshufd $245 163; CHECK: por 164; CHECK: ret 165 %C = icmp ugt <2 x i64> %A, %B 166 %D = sext <2 x i1> %C to <2 x i64> 167 ret <2 x i64> %D 168} 169 170define <2 x i64> @test12(<2 x i64> %A, <2 x i64> %B) nounwind { 171; CHECK-LABEL: test12: 172; CHECK: pxor 173; CHECK: pxor 174; CHECK: pcmpgtd %xmm0 175; CHECK: pshufd $160 176; CHECK: pcmpeqd 177; CHECK: pshufd $245 178; CHECK: pand 179; CHECK: pshufd $245 180; CHECK: por 181; CHECK: ret 182 %C = icmp ult <2 x i64> %A, %B 183 %D = sext <2 x i1> %C to <2 x i64> 184 ret <2 x i64> %D 185} 186 187define <2 x i64> @test13(<2 x i64> %A, <2 x i64> %B) nounwind { 188; CHECK-LABEL: test13: 189; CHECK: pxor 190; CHECK: pxor 191; CHECK: pcmpgtd %xmm0 192; CHECK: pshufd $160 193; CHECK: pcmpeqd 194; CHECK: pshufd $245 195; CHECK: pand 196; CHECK: pshufd $245 197; CHECK: por 198; CHECK: pcmpeqd 199; CHECK: pxor 200; CHECK: ret 201 %C = icmp uge <2 x i64> %A, %B 202 %D = sext <2 x i1> %C to <2 x i64> 203 ret <2 x i64> %D 204} 205 206define <2 x i64> @test14(<2 x i64> %A, <2 x i64> %B) nounwind { 207; CHECK-LABEL: test14: 208; CHECK: pxor 209; CHECK: pxor 210; CHECK: pcmpgtd %xmm1 211; CHECK: pshufd $160 212; CHECK: pcmpeqd 213; CHECK: pshufd $245 214; CHECK: pand 215; CHECK: pshufd $245 216; CHECK: por 217; CHECK: pcmpeqd 218; CHECK: pxor 219; CHECK: ret 220 %C = icmp ule <2 x i64> %A, %B 221 %D = sext <2 x i1> %C to <2 x i64> 222 ret <2 x i64> %D 223} 224