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
12 %2 = load <4 x i32>, <4 x i32>* %0, align 16
13 %3 = call <4 x i32> @llvm.x86.sse41.pminud(<4 x i32> %2, <4 x i32> <i32 127, i32 127, i32 127, i32 127>)
14 %4 = extractelement <4 x i32> %3, i32 0
15 %5 = extractelement <4 x i32> %3, i32 1
16 %6 = extractelement <4 x i32> %3, i32 2
17 %7 = extractelement <4 x i32> %3, i32 3
18 %8 = bitcast i32 %4 to <2 x i16>
19 %9 = bitcast i32 %5 to <2 x i16>
23 define <2 x i16> @bad(<4 x i32>*, <4 x i8>*) {
25 ; CHECK: # %bb.0: # %entry
26 ; CHECK-NEXT: movdqa (%rdi), %xmm0
27 ; CHECK-NEXT: pminud {{.*}}(%rip), %xmm0
28 ; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
31 %2 = load <4 x i32>, <4 x i32>* %0, align 16
32 %3 = call <4 x i32> @llvm.x86.sse41.pminud(<4 x i32> %2, <4 x i32> <i32 127, i32 127, i32 127, i32 127>)
33 %4 = extractelement <4 x i32> %3, i32 0
34 %5 = extractelement <4 x i32> %3, i32 1
35 %6 = extractelement <4 x i32> %3, i32 2
36 %7 = extractelement <4 x i32> %3, i32 3
37 %8 = bitcast i32 %4 to <2 x i16>
38 %9 = bitcast i32 %5 to <2 x i16>