1 ; RUN: llc < %s -mtriple=x86_64-linux-pc -mcpu=corei7 | FileCheck %s
3 declare <4 x i32> @llvm.x86.sse41.pminud(<4 x i32>, <4 x i32>)
5 define <2 x i16> @good(<4 x i32>*, <4 x i8>*) {
7 ; CHECK: # BB#0: # %entry
8 ; CHECK-NEXT: movdqa (%rdi), %xmm0
9 ; CHECK-NEXT: pminud {{.*}}(%rip), %xmm0
10 ; CHECK-NEXT: pmovzxwq %xmm0, %xmm0
13 %2 = load <4 x i32>, <4 x i32>* %0, align 16
14 %3 = call <4 x i32> @llvm.x86.sse41.pminud(<4 x i32> %2, <4 x i32> <i32 127, i32 127, i32 127, i32 127>)
15 %4 = extractelement <4 x i32> %3, i32 0
16 %5 = extractelement <4 x i32> %3, i32 1
17 %6 = extractelement <4 x i32> %3, i32 2
18 %7 = extractelement <4 x i32> %3, i32 3
19 %8 = bitcast i32 %4 to <2 x i16>
20 %9 = bitcast i32 %5 to <2 x i16>
24 define <2 x i16> @bad(<4 x i32>*, <4 x i8>*) {
26 ; CHECK: # BB#0: # %entry
27 ; CHECK-NEXT: movdqa (%rdi), %xmm0
28 ; CHECK-NEXT: pminud {{.*}}(%rip), %xmm0
29 ; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
30 ; CHECK-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
33 %2 = load <4 x i32>, <4 x i32>* %0, align 16
34 %3 = call <4 x i32> @llvm.x86.sse41.pminud(<4 x i32> %2, <4 x i32> <i32 127, i32 127, i32 127, i32 127>)
35 %4 = extractelement <4 x i32> %3, i32 0
36 %5 = extractelement <4 x i32> %3, i32 1
37 %6 = extractelement <4 x i32> %3, i32 2
38 %7 = extractelement <4 x i32> %3, i32 3
39 %8 = bitcast i32 %4 to <2 x i16>
40 %9 = bitcast i32 %5 to <2 x i16>