bmi.ll
5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; REQUIRES: x86-registered-target
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"
target triple = "x86_64-unknown-linux-gnu"
declare i32 @llvm.x86.bmi.bzhi.32(i32, i32)
declare i32 @llvm.x86.bmi.bextr.32(i32, i32)
declare i32 @llvm.x86.bmi.pdep.32(i32, i32)
declare i32 @llvm.x86.bmi.pext.32(i32, i32)
declare i64 @llvm.x86.bmi.bzhi.64(i64, i64)
declare i64 @llvm.x86.bmi.bextr.64(i64, i64)
declare i64 @llvm.x86.bmi.pdep.64(i64, i64)
declare i64 @llvm.x86.bmi.pext.64(i64, i64)
define i32 @Test_bzhi_32(i32 %a, i32 %b) sanitize_memory {
entry:
%c = tail call i32 @llvm.x86.bmi.bzhi.32(i32 %a, i32 %b)
ret i32 %c
}
; CHECK-LABEL: @Test_bzhi_32(
; CHECK-DAG: %[[SA:.*]] = load i32, {{.*}}@__msan_param_tls to i32*)
; CHECK-DAG: %[[SB:.*]] = load i32, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i32 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i32
; CHECK-DAG: %[[X:.*]] = call i32 @llvm.x86.bmi.bzhi.32(i32 %[[SA]], i32 %b)
; CHECK-DAG: %[[S:.*]] = or i32 %[[SB1]], %[[X]]
; CHECK-DAG: store i32 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i32
define i64 @Test_bzhi_64(i64 %a, i64 %b) sanitize_memory {
entry:
%c = tail call i64 @llvm.x86.bmi.bzhi.64(i64 %a, i64 %b)
ret i64 %c
}
; CHECK-LABEL: @Test_bzhi_64(
; CHECK-DAG: %[[SA:.*]] = load i64, {{.*}}@__msan_param_tls, i32 0, i32 0
; CHECK-DAG: %[[SB:.*]] = load i64, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i64 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i64
; CHECK-DAG: %[[X:.*]] = call i64 @llvm.x86.bmi.bzhi.64(i64 %[[SA]], i64 %b)
; CHECK-DAG: %[[S:.*]] = or i64 %[[SB1]], %[[X]]
; CHECK-DAG: store i64 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i64
define i32 @Test_bextr_32(i32 %a, i32 %b) sanitize_memory {
entry:
%c = tail call i32 @llvm.x86.bmi.bextr.32(i32 %a, i32 %b)
ret i32 %c
}
; CHECK-LABEL: @Test_bextr_32(
; CHECK-DAG: %[[SA:.*]] = load i32, {{.*}}@__msan_param_tls to i32*)
; CHECK-DAG: %[[SB:.*]] = load i32, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i32 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i32
; CHECK-DAG: %[[X:.*]] = call i32 @llvm.x86.bmi.bextr.32(i32 %[[SA]], i32 %b)
; CHECK-DAG: %[[S:.*]] = or i32 %[[SB1]], %[[X]]
; CHECK-DAG: store i32 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i32
define i64 @Test_bextr_64(i64 %a, i64 %b) sanitize_memory {
entry:
%c = tail call i64 @llvm.x86.bmi.bextr.64(i64 %a, i64 %b)
ret i64 %c
}
; CHECK-LABEL: @Test_bextr_64(
; CHECK-DAG: %[[SA:.*]] = load i64, {{.*}}@__msan_param_tls, i32 0, i32 0
; CHECK-DAG: %[[SB:.*]] = load i64, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i64 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i64
; CHECK-DAG: %[[X:.*]] = call i64 @llvm.x86.bmi.bextr.64(i64 %[[SA]], i64 %b)
; CHECK-DAG: %[[S:.*]] = or i64 %[[SB1]], %[[X]]
; CHECK-DAG: store i64 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i64
define i32 @Test_pdep_32(i32 %a, i32 %b) sanitize_memory {
entry:
%c = tail call i32 @llvm.x86.bmi.pdep.32(i32 %a, i32 %b)
ret i32 %c
}
; CHECK-LABEL: @Test_pdep_32(
; CHECK-DAG: %[[SA:.*]] = load i32, {{.*}}@__msan_param_tls to i32*)
; CHECK-DAG: %[[SB:.*]] = load i32, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i32 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i32
; CHECK-DAG: %[[X:.*]] = call i32 @llvm.x86.bmi.pdep.32(i32 %[[SA]], i32 %b)
; CHECK-DAG: %[[S:.*]] = or i32 %[[SB1]], %[[X]]
; CHECK-DAG: store i32 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i32
define i64 @Test_pdep_64(i64 %a, i64 %b) sanitize_memory {
entry:
%c = tail call i64 @llvm.x86.bmi.pdep.64(i64 %a, i64 %b)
ret i64 %c
}
; CHECK-LABEL: @Test_pdep_64(
; CHECK-DAG: %[[SA:.*]] = load i64, {{.*}}@__msan_param_tls, i32 0, i32 0
; CHECK-DAG: %[[SB:.*]] = load i64, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i64 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i64
; CHECK-DAG: %[[X:.*]] = call i64 @llvm.x86.bmi.pdep.64(i64 %[[SA]], i64 %b)
; CHECK-DAG: %[[S:.*]] = or i64 %[[SB1]], %[[X]]
; CHECK-DAG: store i64 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i64
define i32 @Test_pext_32(i32 %a, i32 %b) sanitize_memory {
entry:
%c = tail call i32 @llvm.x86.bmi.pext.32(i32 %a, i32 %b)
ret i32 %c
}
; CHECK-LABEL: @Test_pext_32(
; CHECK-DAG: %[[SA:.*]] = load i32, {{.*}}@__msan_param_tls to i32*)
; CHECK-DAG: %[[SB:.*]] = load i32, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i32 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i32
; CHECK-DAG: %[[X:.*]] = call i32 @llvm.x86.bmi.pext.32(i32 %[[SA]], i32 %b)
; CHECK-DAG: %[[S:.*]] = or i32 %[[SB1]], %[[X]]
; CHECK-DAG: store i32 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i32
define i64 @Test_pext_64(i64 %a, i64 %b) sanitize_memory {
entry:
%c = tail call i64 @llvm.x86.bmi.pext.64(i64 %a, i64 %b)
ret i64 %c
}
; CHECK-LABEL: @Test_pext_64(
; CHECK-DAG: %[[SA:.*]] = load i64, {{.*}}@__msan_param_tls, i32 0, i32 0
; CHECK-DAG: %[[SB:.*]] = load i64, {{.*}}@__msan_param_tls to i64), i64 8)
; CHECK-DAG: %[[SB0:.*]] = icmp ne i64 %[[SB]], 0
; CHECK-DAG: %[[SB1:.*]] = sext i1 %[[SB0]] to i64
; CHECK-DAG: %[[X:.*]] = call i64 @llvm.x86.bmi.pext.64(i64 %[[SA]], i64 %b)
; CHECK-DAG: %[[S:.*]] = or i64 %[[SB1]], %[[X]]
; CHECK-DAG: store i64 %[[S]], {{.*}}@__msan_retval_tls
; CHECK: ret i64