1
1
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
+ ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3
+ ; RUN: | FileCheck %s -check-prefixes=CHECK,NOZBS,RV32,RV32I
2
4
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
3
- ; RUN: | FileCheck %s -check-prefix=RV64I
5
+ ; RUN: | FileCheck %s -check-prefixes=CHECK,NOZBS,RV64,RV64I
6
+ ; RUN: llc -mtriple=riscv32 -mattr=+zbs -verify-machineinstrs < %s \
7
+ ; RUN: | FileCheck %s -check-prefixes=CHECK,ZBS,RV32,RV32ZBS
4
8
; RUN: llc -mtriple=riscv64 -mattr=+zbs -verify-machineinstrs < %s \
5
- ; RUN: | FileCheck %s -check-prefix= RV64ZBS
9
+ ; RUN: | FileCheck %s -check-prefixes=CHECK,ZBS,RV64, RV64ZBS
6
10
7
11
define signext i32 @bittest_7_i32 (i32 signext %a ) nounwind {
8
- ; RV64I-LABEL: bittest_7_i32:
9
- ; RV64I: # %bb.0:
10
- ; RV64I-NEXT: andi a0, a0, 128
11
- ; RV64I-NEXT: seqz a0, a0
12
- ; RV64I-NEXT: ret
13
- ;
14
- ; RV64ZBS-LABEL: bittest_7_i32:
15
- ; RV64ZBS: # %bb.0:
16
- ; RV64ZBS-NEXT: andi a0, a0, 128
17
- ; RV64ZBS-NEXT: seqz a0, a0
18
- ; RV64ZBS-NEXT: ret
12
+ ; CHECK-LABEL: bittest_7_i32:
13
+ ; CHECK: # %bb.0:
14
+ ; CHECK-NEXT: andi a0, a0, 128
15
+ ; CHECK-NEXT: seqz a0, a0
16
+ ; CHECK-NEXT: ret
19
17
%shr = lshr i32 %a , 7
20
18
%not = xor i32 %shr , -1
21
19
%and = and i32 %not , 1
22
20
ret i32 %and
23
21
}
24
22
25
23
define signext i32 @bittest_10_i32 (i32 signext %a ) nounwind {
26
- ; RV64I-LABEL: bittest_10_i32:
27
- ; RV64I: # %bb.0:
28
- ; RV64I-NEXT: andi a0, a0, 1024
29
- ; RV64I-NEXT: seqz a0, a0
30
- ; RV64I-NEXT: ret
31
- ;
32
- ; RV64ZBS-LABEL: bittest_10_i32:
33
- ; RV64ZBS: # %bb.0:
34
- ; RV64ZBS-NEXT: andi a0, a0, 1024
35
- ; RV64ZBS-NEXT: seqz a0, a0
36
- ; RV64ZBS-NEXT: ret
24
+ ; CHECK-LABEL: bittest_10_i32:
25
+ ; CHECK: # %bb.0:
26
+ ; CHECK-NEXT: andi a0, a0, 1024
27
+ ; CHECK-NEXT: seqz a0, a0
28
+ ; CHECK-NEXT: ret
37
29
%shr = lshr i32 %a , 10
38
30
%not = xor i32 %shr , -1
39
31
%and = and i32 %not , 1
40
32
ret i32 %and
41
33
}
42
34
43
35
define signext i32 @bittest_11_i32 (i32 signext %a ) nounwind {
44
- ; RV64I -LABEL: bittest_11_i32:
45
- ; RV64I : # %bb.0:
46
- ; RV64I -NEXT: srli a0, a0, 11
47
- ; RV64I -NEXT: not a0, a0
48
- ; RV64I -NEXT: andi a0, a0, 1
49
- ; RV64I -NEXT: ret
36
+ ; NOZBS -LABEL: bittest_11_i32:
37
+ ; NOZBS : # %bb.0:
38
+ ; NOZBS -NEXT: srli a0, a0, 11
39
+ ; NOZBS -NEXT: not a0, a0
40
+ ; NOZBS -NEXT: andi a0, a0, 1
41
+ ; NOZBS -NEXT: ret
50
42
;
51
- ; RV64ZBS -LABEL: bittest_11_i32:
52
- ; RV64ZBS : # %bb.0:
53
- ; RV64ZBS -NEXT: bexti a0, a0, 11
54
- ; RV64ZBS -NEXT: xori a0, a0, 1
55
- ; RV64ZBS -NEXT: ret
43
+ ; ZBS -LABEL: bittest_11_i32:
44
+ ; ZBS : # %bb.0:
45
+ ; ZBS -NEXT: bexti a0, a0, 11
46
+ ; ZBS -NEXT: xori a0, a0, 1
47
+ ; ZBS -NEXT: ret
56
48
%shr = lshr i32 %a , 11
57
49
%not = xor i32 %shr , -1
58
50
%and = and i32 %not , 1
59
51
ret i32 %and
60
52
}
61
53
62
54
define signext i32 @bittest_31_i32 (i32 signext %a ) nounwind {
63
- ; RV64I -LABEL: bittest_31_i32:
64
- ; RV64I : # %bb.0:
65
- ; RV64I -NEXT: not a0, a0
66
- ; RV64I -NEXT: srliw a0, a0, 31
67
- ; RV64I -NEXT: ret
55
+ ; RV32 -LABEL: bittest_31_i32:
56
+ ; RV32 : # %bb.0:
57
+ ; RV32 -NEXT: not a0, a0
58
+ ; RV32 -NEXT: srli a0, a0, 31
59
+ ; RV32 -NEXT: ret
68
60
;
69
- ; RV64ZBS -LABEL: bittest_31_i32:
70
- ; RV64ZBS : # %bb.0:
71
- ; RV64ZBS -NEXT: not a0, a0
72
- ; RV64ZBS -NEXT: srliw a0, a0, 31
73
- ; RV64ZBS -NEXT: ret
61
+ ; RV64 -LABEL: bittest_31_i32:
62
+ ; RV64 : # %bb.0:
63
+ ; RV64 -NEXT: not a0, a0
64
+ ; RV64 -NEXT: srliw a0, a0, 31
65
+ ; RV64 -NEXT: ret
74
66
%shr = lshr i32 %a , 31
75
67
%not = xor i32 %shr , -1
76
68
%and = and i32 %not , 1
77
69
ret i32 %and
78
70
}
79
71
80
72
define i64 @bittest_7_i64 (i64 %a ) nounwind {
81
- ; RV64I-LABEL: bittest_7_i64:
82
- ; RV64I: # %bb.0:
83
- ; RV64I-NEXT: andi a0, a0, 128
84
- ; RV64I-NEXT: seqz a0, a0
85
- ; RV64I-NEXT: ret
73
+ ; RV32-LABEL: bittest_7_i64:
74
+ ; RV32: # %bb.0:
75
+ ; RV32-NEXT: andi a0, a0, 128
76
+ ; RV32-NEXT: seqz a0, a0
77
+ ; RV32-NEXT: li a1, 0
78
+ ; RV32-NEXT: ret
86
79
;
87
- ; RV64ZBS -LABEL: bittest_7_i64:
88
- ; RV64ZBS : # %bb.0:
89
- ; RV64ZBS -NEXT: andi a0, a0, 128
90
- ; RV64ZBS -NEXT: seqz a0, a0
91
- ; RV64ZBS -NEXT: ret
80
+ ; RV64 -LABEL: bittest_7_i64:
81
+ ; RV64 : # %bb.0:
82
+ ; RV64 -NEXT: andi a0, a0, 128
83
+ ; RV64 -NEXT: seqz a0, a0
84
+ ; RV64 -NEXT: ret
92
85
%shr = lshr i64 %a , 7
93
86
%not = xor i64 %shr , -1
94
87
%and = and i64 %not , 1
95
88
ret i64 %and
96
89
}
97
90
98
91
define i64 @bittest_10_i64 (i64 %a ) nounwind {
99
- ; RV64I-LABEL: bittest_10_i64:
100
- ; RV64I: # %bb.0:
101
- ; RV64I-NEXT: andi a0, a0, 1024
102
- ; RV64I-NEXT: seqz a0, a0
103
- ; RV64I-NEXT: ret
92
+ ; RV32-LABEL: bittest_10_i64:
93
+ ; RV32: # %bb.0:
94
+ ; RV32-NEXT: andi a0, a0, 1024
95
+ ; RV32-NEXT: seqz a0, a0
96
+ ; RV32-NEXT: li a1, 0
97
+ ; RV32-NEXT: ret
104
98
;
105
- ; RV64ZBS -LABEL: bittest_10_i64:
106
- ; RV64ZBS : # %bb.0:
107
- ; RV64ZBS -NEXT: andi a0, a0, 1024
108
- ; RV64ZBS -NEXT: seqz a0, a0
109
- ; RV64ZBS -NEXT: ret
99
+ ; RV64 -LABEL: bittest_10_i64:
100
+ ; RV64 : # %bb.0:
101
+ ; RV64 -NEXT: andi a0, a0, 1024
102
+ ; RV64 -NEXT: seqz a0, a0
103
+ ; RV64 -NEXT: ret
110
104
%shr = lshr i64 %a , 10
111
105
%not = xor i64 %shr , -1
112
106
%and = and i64 %not , 1
113
107
ret i64 %and
114
108
}
115
109
116
110
define i64 @bittest_11_i64 (i64 %a ) nounwind {
111
+ ; RV32I-LABEL: bittest_11_i64:
112
+ ; RV32I: # %bb.0:
113
+ ; RV32I-NEXT: srli a0, a0, 11
114
+ ; RV32I-NEXT: not a0, a0
115
+ ; RV32I-NEXT: andi a0, a0, 1
116
+ ; RV32I-NEXT: li a1, 0
117
+ ; RV32I-NEXT: ret
118
+ ;
117
119
; RV64I-LABEL: bittest_11_i64:
118
120
; RV64I: # %bb.0:
119
121
; RV64I-NEXT: srli a0, a0, 11
120
122
; RV64I-NEXT: not a0, a0
121
123
; RV64I-NEXT: andi a0, a0, 1
122
124
; RV64I-NEXT: ret
123
125
;
126
+ ; RV32ZBS-LABEL: bittest_11_i64:
127
+ ; RV32ZBS: # %bb.0:
128
+ ; RV32ZBS-NEXT: bexti a0, a0, 11
129
+ ; RV32ZBS-NEXT: xori a0, a0, 1
130
+ ; RV32ZBS-NEXT: li a1, 0
131
+ ; RV32ZBS-NEXT: ret
132
+ ;
124
133
; RV64ZBS-LABEL: bittest_11_i64:
125
134
; RV64ZBS: # %bb.0:
126
135
; RV64ZBS-NEXT: bexti a0, a0, 11
@@ -133,6 +142,13 @@ define i64 @bittest_11_i64(i64 %a) nounwind {
133
142
}
134
143
135
144
define i64 @bittest_31_i64 (i64 %a ) nounwind {
145
+ ; RV32-LABEL: bittest_31_i64:
146
+ ; RV32: # %bb.0:
147
+ ; RV32-NEXT: not a0, a0
148
+ ; RV32-NEXT: srli a0, a0, 31
149
+ ; RV32-NEXT: li a1, 0
150
+ ; RV32-NEXT: ret
151
+ ;
136
152
; RV64I-LABEL: bittest_31_i64:
137
153
; RV64I: # %bb.0:
138
154
; RV64I-NEXT: srli a0, a0, 31
@@ -152,6 +168,13 @@ define i64 @bittest_31_i64(i64 %a) nounwind {
152
168
}
153
169
154
170
define i64 @bittest_32_i64 (i64 %a ) nounwind {
171
+ ; RV32-LABEL: bittest_32_i64:
172
+ ; RV32: # %bb.0:
173
+ ; RV32-NEXT: not a0, a1
174
+ ; RV32-NEXT: andi a0, a0, 1
175
+ ; RV32-NEXT: li a1, 0
176
+ ; RV32-NEXT: ret
177
+ ;
155
178
; RV64I-LABEL: bittest_32_i64:
156
179
; RV64I: # %bb.0:
157
180
; RV64I-NEXT: srli a0, a0, 32
@@ -171,17 +194,18 @@ define i64 @bittest_32_i64(i64 %a) nounwind {
171
194
}
172
195
173
196
define i64 @bittest_63_i64 (i64 %a ) nounwind {
174
- ; RV64I-LABEL: bittest_63_i64:
175
- ; RV64I: # %bb.0:
176
- ; RV64I-NEXT: not a0, a0
177
- ; RV64I-NEXT: srli a0, a0, 63
178
- ; RV64I-NEXT: ret
197
+ ; RV32-LABEL: bittest_63_i64:
198
+ ; RV32: # %bb.0:
199
+ ; RV32-NEXT: not a0, a1
200
+ ; RV32-NEXT: srli a0, a0, 31
201
+ ; RV32-NEXT: li a1, 0
202
+ ; RV32-NEXT: ret
179
203
;
180
- ; RV64ZBS -LABEL: bittest_63_i64:
181
- ; RV64ZBS : # %bb.0:
182
- ; RV64ZBS -NEXT: not a0, a0
183
- ; RV64ZBS -NEXT: srli a0, a0, 63
184
- ; RV64ZBS -NEXT: ret
204
+ ; RV64 -LABEL: bittest_63_i64:
205
+ ; RV64 : # %bb.0:
206
+ ; RV64 -NEXT: not a0, a0
207
+ ; RV64 -NEXT: srli a0, a0, 63
208
+ ; RV64 -NEXT: ret
185
209
%shr = lshr i64 %a , 63
186
210
%not = xor i64 %shr , -1
187
211
%and = and i64 %not , 1
0 commit comments