1 ; RUN: opt < %s -S -mcpu=z13 -msan-kernel=1 -float-abi=soft -passes=msan 2>&1 | FileCheck %s
3 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"
4 target triple = "s390x-unknown-linux-gnu"
6 define void @Store1(ptr %p, i8 %x) sanitize_memory {
12 ; CHECK-LABEL: define {{[^@]+}}@Store1(
13 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
14 ; CHECK: call void @__msan_metadata_ptr_for_store_1(ptr [[META_PTR]], ptr %p)
15 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
16 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
17 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
18 ; CHECK: store i8 {{.+}}, ptr [[SHADOW]]
21 define void @Store2(ptr %p, i16 %x) sanitize_memory {
27 ; CHECK-LABEL: define {{[^@]+}}@Store2(
28 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
29 ; CHECK: call void @__msan_metadata_ptr_for_store_2(ptr [[META_PTR]], ptr %p)
30 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
31 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
32 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
33 ; CHECK: store i16 {{.+}}, ptr [[SHADOW]]
36 define void @Store4(ptr %p, i32 %x) sanitize_memory {
42 ; CHECK-LABEL: define {{[^@]+}}@Store4(
43 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
44 ; CHECK: call void @__msan_metadata_ptr_for_store_4(ptr [[META_PTR]], ptr %p)
45 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
46 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
47 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
48 ; CHECK: store i32 {{.+}}, ptr [[SHADOW]]
51 define void @Store8(ptr %p, i64 %x) sanitize_memory {
57 ; CHECK-LABEL: define {{[^@]+}}@Store8(
58 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
59 ; CHECK: call void @__msan_metadata_ptr_for_store_8(ptr [[META_PTR]], ptr %p)
60 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
61 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
62 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
63 ; CHECK: store i64 {{.+}}, ptr [[SHADOW]]
66 define void @Store16(ptr %p, i128 %x) sanitize_memory {
72 ; CHECK-LABEL: define {{[^@]+}}@Store16(
73 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
74 ; CHECK: call void @__msan_metadata_ptr_for_store_n(ptr [[META_PTR]], ptr %p, i64 16)
75 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
76 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
77 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
78 ; CHECK: store i128 {{.+}}, ptr [[SHADOW]]
81 define i8 @Load1(ptr %p) sanitize_memory {
87 ; CHECK-LABEL: define {{[^@]+}}@Load1(
88 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
89 ; CHECK: call void @__msan_metadata_ptr_for_load_1(ptr [[META_PTR]], ptr %p)
90 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
91 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
92 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
93 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i8, ptr [[SHADOW]]
94 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
95 ; CHECK: store i8 [[SHADOW_VAL]], ptr %retval_shadow
96 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
97 ; CHECK: ret i8 {{.+}}
99 define i16 @Load2(ptr %p) sanitize_memory {
101 %0 = load i16, ptr %p
105 ; CHECK-LABEL: define {{[^@]+}}@Load2(
106 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
107 ; CHECK: call void @__msan_metadata_ptr_for_load_2(ptr [[META_PTR]], ptr %p)
108 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
109 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
110 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
111 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i16, ptr [[SHADOW]]
112 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
113 ; CHECK: store i16 [[SHADOW_VAL]], ptr %retval_shadow
114 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
115 ; CHECK: ret i16 {{.+}}
117 define i32 @Load4(ptr %p) sanitize_memory {
119 %0 = load i32, ptr %p
123 ; CHECK-LABEL: define {{[^@]+}}@Load4(
124 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
125 ; CHECK: call void @__msan_metadata_ptr_for_load_4(ptr [[META_PTR]], ptr %p)
126 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
127 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
128 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
129 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i32, ptr [[SHADOW]]
130 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
131 ; CHECK: store i32 [[SHADOW_VAL]], ptr %retval_shadow
132 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
133 ; CHECK: ret i32 {{.+}}
135 define i64 @Load8(ptr %p) sanitize_memory {
137 %0 = load i64, ptr %p
141 ; CHECK-LABEL: define {{[^@]+}}@Load8(
142 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
143 ; CHECK: call void @__msan_metadata_ptr_for_load_8(ptr [[META_PTR]], ptr %p)
144 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
145 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
146 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
147 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i64, ptr [[SHADOW]]
148 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
149 ; CHECK: store i64 [[SHADOW_VAL]], ptr %retval_shadow
150 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
151 ; CHECK: ret i64 {{.+}}
153 define i128 @Load16(ptr %p) sanitize_memory {
155 %0 = load i128, ptr %p
159 ; CHECK-LABEL: define {{[^@]+}}@Load16(
160 ; CHECK: [[META_PTR:%[a-z0-9_]+]] = alloca { ptr, ptr }
161 ; CHECK: call void @__msan_metadata_ptr_for_load_n(ptr [[META_PTR]], ptr %p, i64 16)
162 ; CHECK: [[META:%[a-z0-9_]+]] = load { ptr, ptr }, ptr [[META_PTR]]
163 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
164 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
165 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i128, ptr [[SHADOW]]
166 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
167 ; CHECK: store i128 [[SHADOW_VAL]], ptr %retval_shadow
168 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
169 ; CHECK: ret i128 {{.+}}