1 ; RUN: llc < %s -mtriple=x86_64-linux-pc -mcpu=corei7 | FileCheck %s 2 3 declare <4 x i32> @llvm.x86.sse41.pminud(<4 x i32>, <4 x i32>) 4 5 define <2 x i16> @good(<4 x i32>*, <4 x i8>*) { 6 ; CHECK-LABEL: good: 7 ; CHECK: # BB#0: # %entry 8 ; CHECK-NEXT: movdqa (%rdi), %xmm0 9 ; CHECK-NEXT: pminud {{.*}}(%rip), %xmm0 10 ; CHECK-NEXT: pmovzxwq %xmm0, %xmm0 11 ; CHECK-NEXT: retq 12 entry: 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> 21 ret <2 x i16> %8 22 } 23 24 define <2 x i16> @bad(<4 x i32>*, <4 x i8>*) { 25 ; CHECK-LABEL: bad: 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 31 ; CHECK-NEXT: retq 32 entry: 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> 41 ret <2 x i16> %9 42 } 43