1 ; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
3 ; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
4 ; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
5 ; RUN: -check-prefix=CHECK-ORIGINS %s
6 ; REQUIRES: x86-registered-target
8 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"
9 target triple = "x86_64-unknown-linux-gnu"
13 define void @StoreIntrinsic(ptr %p, <4 x float> %x) nounwind uwtable sanitize_memory {
14 call void @llvm.x86.sse.storeu.ps(ptr %p, <4 x float> %x)
18 declare void @llvm.x86.sse.storeu.ps(ptr, <4 x float>) nounwind
20 ; CHECK-LABEL: @StoreIntrinsic
23 ; CHECK: store <4 x i32> {{.*}} align 1
24 ; CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 1{{$}}
30 define <16 x i8> @LoadIntrinsic(ptr %p) nounwind uwtable sanitize_memory {
31 %call = call <16 x i8> @llvm.x86.sse3.ldu.dq(ptr %p)
35 declare <16 x i8> @llvm.x86.sse3.ldu.dq(ptr %p) nounwind
37 ; CHECK-LABEL: @LoadIntrinsic
38 ; CHECK: load <16 x i8>, ptr {{.*}} align 1
39 ; CHECK-ORIGINS: [[ORIGIN:%[01-9a-z]+]] = load i32, ptr {{.*}}
42 ; CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq
43 ; CHECK: store <16 x i8> {{.*}} @__msan_retval_tls
44 ; CHECK-ORIGINS: store i32 {{.*}}[[ORIGIN]], ptr @__msan_retval_origin_tls
45 ; CHECK: ret <16 x i8>
48 ; Simple NoMem intrinsic
49 ; Check that shadow is OR'ed, and origin is Select'ed
50 ; And no shadow checks!
52 define <8 x i16> @Pmulhuw128(<8 x i16> %a, <8 x i16> %b) nounwind uwtable sanitize_memory {
53 %call = call <8 x i16> @llvm.x86.sse2.pmulhu.w(<8 x i16> %a, <8 x i16> %b)
57 declare <8 x i16> @llvm.x86.sse2.pmulhu.w(<8 x i16> %a, <8 x i16> %b) nounwind
59 ; CHECK-LABEL: @Pmulhuw128
60 ; CHECK-NEXT: load <8 x i16>, ptr @__msan_param_tls
61 ; CHECK-ORIGINS: load i32, ptr @__msan_param_origin_tls
62 ; CHECK-NEXT: load <8 x i16>, ptr {{.*}} @__msan_param_tls
63 ; CHECK-ORIGINS: load i32, ptr {{.*}} @__msan_param_origin_tls
64 ; CHECK-NEXT: call void @llvm.donothing
65 ; CHECK-NEXT: = or <8 x i16>
66 ; CHECK-ORIGINS: = bitcast <8 x i16> {{.*}} to i128
67 ; CHECK-ORIGINS-NEXT: = icmp ne i128 {{.*}}, 0
68 ; CHECK-ORIGINS-NEXT: = select i1 {{.*}}, i32 {{.*}}, i32
69 ; CHECK-NEXT: call <8 x i16> @llvm.x86.sse2.pmulhu.w
70 ; CHECK-NEXT: store <8 x i16> {{.*}} @__msan_retval_tls
71 ; CHECK-ORIGINS: store i32 {{.*}} @__msan_retval_origin_tls
72 ; CHECK-NEXT: ret <8 x i16>