• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -tsan -S | FileCheck %s
2; Check that atomic memory operations on floating-point types are converted to calls into ThreadSanitizer runtime.
3target 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
5define float @load_float(float* %fptr) {
6  %v = load atomic float, float* %fptr unordered, align 4
7  ret float %v
8  ; CHECK-LABEL: load_float
9  ; CHECK: call i32 @__tsan_atomic32_load(i32* %{{.+}}, i32 0)
10  ; CHECK: bitcast i32 {{.+}} to float
11}
12
13define double @load_double(double* %fptr) {
14  %v = load atomic double, double* %fptr unordered, align 8
15  ret double %v
16  ; CHECK-LABEL: load_double
17  ; CHECK: call i64 @__tsan_atomic64_load(i64* %{{.+}}, i32 0)
18  ; CHECK: bitcast i64 {{.+}} to double
19}
20
21define fp128 @load_fp128(fp128* %fptr) {
22  %v = load atomic fp128, fp128* %fptr unordered, align 16
23  ret fp128 %v
24  ; CHECK-LABEL: load_fp128
25  ; CHECK: call i128 @__tsan_atomic128_load(i128* %{{.+}}, i32 0)
26  ; CHECK: bitcast i128 {{.+}} to fp128
27}
28
29define void @store_float(float* %fptr, float %v) {
30  store atomic float %v, float* %fptr unordered, align 4
31  ret void
32  ; CHECK-LABEL: store_float
33  ; CHECK: bitcast float %v to i32
34  ; CHECK: call void @__tsan_atomic32_store(i32* %{{.+}}, i32 %{{.+}}, i32 0)
35}
36
37define void @store_double(double* %fptr, double %v) {
38  store atomic double %v, double* %fptr unordered, align 8
39  ret void
40  ; CHECK-LABEL: store_double
41  ; CHECK: bitcast double %v to i64
42  ; CHECK: call void @__tsan_atomic64_store(i64* %{{.+}}, i64 %{{.+}}, i32 0)
43}
44
45define void @store_fp128(fp128* %fptr, fp128 %v) {
46  store atomic fp128 %v, fp128* %fptr unordered, align 16
47  ret void
48  ; CHECK-LABEL: store_fp128
49  ; CHECK: bitcast fp128 %v to i128
50  ; CHECK: call void @__tsan_atomic128_store(i128* %{{.+}}, i128 %{{.+}}, i32 0)
51}
52