• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -dfsan -S | FileCheck %s
2target 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"
3target triple = "x86_64-unknown-linux-gnu"
4
5define i8 @add(i8 %a, i8 %b) {
6  ; CHECK: @"dfs$add"
7  ; CHECK-DAG: %[[ALABEL:.*]] = load [[SHADOWTYPE:i16]], [[SHADOWTYPE]]* bitcast ([[ARGTLSTYPE:\[100 x i64\]]]* @__dfsan_arg_tls to [[SHADOWTYPE]]*), align [[ALIGN:2]]
8  ; CHECK-DAG: %[[BLABEL:.*]] = load [[SHADOWTYPE]], [[SHADOWTYPE]]* inttoptr (i64 add (i64 ptrtoint ([[ARGTLSTYPE]]* @__dfsan_arg_tls to i64), i64 2) to [[SHADOWTYPE]]*), align [[ALIGN]]
9  ; CHECK: %[[UNION:.*]] = call zeroext [[SHADOWTYPE]] @__dfsan_union([[SHADOWTYPE]] zeroext %[[ALABEL]], [[SHADOWTYPE]] zeroext %[[BLABEL]])
10  ; CHECK: %[[ADDLABEL:.*]] = phi [[SHADOWTYPE]] [ %[[UNION]], {{.*}} ], [ %[[ALABEL]], {{.*}} ]
11  ; CHECK: add i8
12  ; CHECK: store [[SHADOWTYPE]] %[[ADDLABEL]], [[SHADOWTYPE]]* bitcast ([100 x i64]* @__dfsan_retval_tls to [[SHADOWTYPE]]*), align [[ALIGN]]
13  ; CHECK: ret i8
14  %c = add i8 %a, %b
15  ret i8 %c
16}
17
18define i8 @sub(i8 %a, i8 %b) {
19  ; CHECK: @"dfs$sub"
20  ; CHECK: load{{.*}}__dfsan_arg_tls
21  ; CHECK: load{{.*}}__dfsan_arg_tls
22  ; CHECK: call{{.*}}__dfsan_union
23  ; CHECK: sub i8
24  ; CHECK: store{{.*}}__dfsan_retval_tls
25  ; CHECK: ret i8
26  %c = sub i8 %a, %b
27  ret i8 %c
28}
29
30define i8 @mul(i8 %a, i8 %b) {
31  ; CHECK: @"dfs$mul"
32  ; CHECK: load{{.*}}__dfsan_arg_tls
33  ; CHECK: load{{.*}}__dfsan_arg_tls
34  ; CHECK: call{{.*}}__dfsan_union
35  ; CHECK: mul i8
36  ; CHECK: store{{.*}}__dfsan_retval_tls
37  ; CHECK: ret i8
38  %c = mul i8 %a, %b
39  ret i8 %c
40}
41
42define i8 @sdiv(i8 %a, i8 %b) {
43  ; CHECK: @"dfs$sdiv"
44  ; CHECK: load{{.*}}__dfsan_arg_tls
45  ; CHECK: load{{.*}}__dfsan_arg_tls
46  ; CHECK: call{{.*}}__dfsan_union
47  ; CHECK: sdiv i8
48  ; CHECK: store{{.*}}__dfsan_retval_tls
49  ; CHECK: ret i8
50  %c = sdiv i8 %a, %b
51  ret i8 %c
52}
53
54define i8 @udiv(i8 %a, i8 %b) {
55  ; CHECK: @"dfs$udiv"
56  ; CHECK: load{{.*}}__dfsan_arg_tls
57  ; CHECK: load{{.*}}__dfsan_arg_tls
58  ; CHECK: call{{.*}}__dfsan_union
59  ; CHECK: udiv i8
60  ; CHECK: store{{.*}}__dfsan_retval_tls
61  ; CHECK: ret i8
62  %c = udiv i8 %a, %b
63  ret i8 %c
64}
65
66define double @fneg(double %a) {
67  ; CHECK: @"dfs$fneg"
68  ; CHECK: load{{.*}}__dfsan_arg_tls
69  ; CHECK: fneg double
70  ; CHECK: store{{.*}}__dfsan_retval_tls
71  ; CHECK: ret double
72  %c = fneg double %a
73  ret double %c
74}
75