1 ; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s 2 3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4 target triple = "x86_64-unknown-linux-gnu" 5 6 declare <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32>, <4 x i32>) nounwind readnone 7 declare <32 x i8> @llvm.x86.avx2.packuswb(<16 x i16> %a, <16 x i16> %b) nounwind readnone 8 declare x86_mmx @llvm.x86.mmx.packuswb(x86_mmx, x86_mmx) nounwind readnone 9 10 define <8 x i16> @Test_packssdw_128(<4 x i32> %a, <4 x i32> %b) sanitize_memory { 11 entry: 12 %c = tail call <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32> %a, <4 x i32> %b) nounwind 13 ret <8 x i16> %c 14 } 15 16 ; CHECK-LABEL: @Test_packssdw_128( 17 ; CHECK-DAG: icmp ne <4 x i32> {{.*}}, zeroinitializer 18 ; CHECK-DAG: sext <4 x i1> {{.*}} to <4 x i32> 19 ; CHECK-DAG: icmp ne <4 x i32> {{.*}}, zeroinitializer 20 ; CHECK-DAG: sext <4 x i1> {{.*}} to <4 x i32> 21 ; CHECK-DAG: call <8 x i16> @llvm.x86.sse2.packssdw.128( 22 ; CHECK-DAG: call <8 x i16> @llvm.x86.sse2.packssdw.128( 23 ; CHECK: ret <8 x i16> 24 25 26 define <32 x i8> @Test_avx_packuswb(<16 x i16> %a, <16 x i16> %b) sanitize_memory { 27 entry: 28 %c = tail call <32 x i8> @llvm.x86.avx2.packuswb(<16 x i16> %a, <16 x i16> %b) nounwind 29 ret <32 x i8> %c 30 } 31 32 ; CHECK-LABEL: @Test_avx_packuswb( 33 ; CHECK-DAG: icmp ne <16 x i16> {{.*}}, zeroinitializer 34 ; CHECK-DAG: sext <16 x i1> {{.*}} to <16 x i16> 35 ; CHECK-DAG: icmp ne <16 x i16> {{.*}}, zeroinitializer 36 ; CHECK-DAG: sext <16 x i1> {{.*}} to <16 x i16> 37 ; CHECK-DAG: call <32 x i8> @llvm.x86.avx2.packsswb( 38 ; CHECK-DAG: call <32 x i8> @llvm.x86.avx2.packuswb( 39 ; CHECK: ret <32 x i8> 40 41 42 define x86_mmx @Test_mmx_packuswb(x86_mmx %a, x86_mmx %b) sanitize_memory { 43 entry: 44 %c = tail call x86_mmx @llvm.x86.mmx.packuswb(x86_mmx %a, x86_mmx %b) nounwind 45 ret x86_mmx %c 46 } 47 48 ; CHECK-LABEL: @Test_mmx_packuswb( 49 ; CHECK-DAG: bitcast i64 {{.*}} to <4 x i16> 50 ; CHECK-DAG: bitcast i64 {{.*}} to <4 x i16> 51 ; CHECK-DAG: icmp ne <4 x i16> {{.*}}, zeroinitializer 52 ; CHECK-DAG: sext <4 x i1> {{.*}} to <4 x i16> 53 ; CHECK-DAG: icmp ne <4 x i16> {{.*}}, zeroinitializer 54 ; CHECK-DAG: sext <4 x i1> {{.*}} to <4 x i16> 55 ; CHECK-DAG: bitcast <4 x i16> {{.*}} to x86_mmx 56 ; CHECK-DAG: bitcast <4 x i16> {{.*}} to x86_mmx 57 ; CHECK-DAG: call x86_mmx @llvm.x86.mmx.packsswb({{.*}} 58 ; CHECK-DAG: bitcast x86_mmx {{.*}} to i64 59 ; CHECK-DAG: call x86_mmx @llvm.x86.mmx.packuswb({{.*}} 60 ; CHECK: ret x86_mmx 61