70 lines · plain
1; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck %s2; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s3; REQUIRES: x86-registered-target4 5target 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"6target triple = "x86_64-unknown-linux-gnu"7 8; Store intrinsic.9 10define void @StoreIntrinsic(ptr %p, <4 x float> %x) nounwind uwtable sanitize_memory {11 call void @llvm.x86.sse.storeu.ps(ptr %p, <4 x float> %x)12 ret void13}14 15declare void @llvm.x86.sse.storeu.ps(ptr, <4 x float>) nounwind16 17; CHECK-LABEL: @StoreIntrinsic18; CHECK-NOT: br19; CHECK-NOT: = or20; CHECK: store <4 x i32> {{.*}} align 121; CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 1{{$}}22; CHECK: ret void23 24 25; Load intrinsic.26 27define <16 x i8> @LoadIntrinsic(ptr %p) nounwind uwtable sanitize_memory {28 %call = call <16 x i8> @llvm.x86.sse3.ldu.dq(ptr %p)29 ret <16 x i8> %call30}31 32declare <16 x i8> @llvm.x86.sse3.ldu.dq(ptr %p) nounwind33 34; CHECK-LABEL: @LoadIntrinsic35; CHECK: load <16 x i8>, ptr {{.*}} align 136; CHECK-ORIGINS: [[ORIGIN:%[01-9a-z]+]] = load i32, ptr {{.*}}37; CHECK-NOT: br38; CHECK-NOT: = or39; CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq40; CHECK: store <16 x i8> {{.*}} @__msan_retval_tls41; CHECK-ORIGINS: store i32 {{.*}}[[ORIGIN]], ptr @__msan_retval_origin_tls42; CHECK: ret <16 x i8>43 44 45; Simple NoMem intrinsic46; Check that shadow is OR'ed, and origin is Select'ed47; And no shadow checks!48 49define <8 x i16> @Pmulhuw128(<8 x i16> %a, <8 x i16> %b) nounwind uwtable sanitize_memory {50 %call = call <8 x i16> @llvm.x86.sse2.pmulhu.w(<8 x i16> %a, <8 x i16> %b)51 ret <8 x i16> %call52}53 54declare <8 x i16> @llvm.x86.sse2.pmulhu.w(<8 x i16> %a, <8 x i16> %b) nounwind55 56; CHECK-LABEL: @Pmulhuw12857; CHECK-NEXT: load <8 x i16>, ptr @__msan_param_tls58; CHECK-ORIGINS: load i32, ptr @__msan_param_origin_tls59; CHECK-NEXT: load <8 x i16>, ptr {{.*}} @__msan_param_tls60; CHECK-ORIGINS: load i32, ptr {{.*}} @__msan_param_origin_tls61; CHECK-NEXT: call void @llvm.donothing62; CHECK-NEXT: = or <8 x i16>63; CHECK-ORIGINS: = bitcast <8 x i16> {{.*}} to i12864; CHECK-ORIGINS-NEXT: = icmp ne i128 {{.*}}, 065; CHECK-ORIGINS-NEXT: = select i1 {{.*}}, i32 {{.*}}, i3266; CHECK-NEXT: call <8 x i16> @llvm.x86.sse2.pmulhu.w67; CHECK-NEXT: store <8 x i16> {{.*}} @__msan_retval_tls68; CHECK-ORIGINS: store i32 {{.*}} @__msan_retval_origin_tls69; CHECK-NEXT: ret <8 x i16>70