@@ -106,23 +106,24 @@ define i32 @ctpop_mask3(i32 %x) nounwind readnone {
106
106
;
107
107
; X86-NO-POPCOUNT-LABEL: ctpop_mask3:
108
108
; X86-NO-POPCOUNT: # %bb.0:
109
- ; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %eax
110
- ; X86-NO-POPCOUNT-NEXT: andl $5, %eax
111
- ; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax , %eax # imm = 0x8040201
112
- ; X86-NO-POPCOUNT-NEXT: shrl $3 , %eax
113
- ; X86-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111
114
- ; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax , %eax # imm = 0x11111111
115
- ; X86-NO-POPCOUNT-NEXT: shrl $28 , %eax
109
+ ; X86-NO-POPCOUNT-NEXT: movl {{[0-9]+}}(%esp), %ecx
110
+ ; X86-NO-POPCOUNT-NEXT: andl $5, %ecx
111
+ ; X86-NO-POPCOUNT-NEXT: addl %ecx , %ecx
112
+ ; X86-NO-POPCOUNT-NEXT: movl $59796 , %eax # imm = 0xE994
113
+ ; X86-NO-POPCOUNT-NEXT: # kill: def $cl killed $cl killed $ecx
114
+ ; X86-NO-POPCOUNT-NEXT: shrl %cl , %eax
115
+ ; X86-NO-POPCOUNT-NEXT: andl $3 , %eax
116
116
; X86-NO-POPCOUNT-NEXT: retl
117
117
;
118
118
; X64-NO-POPCOUNT-LABEL: ctpop_mask3:
119
119
; X64-NO-POPCOUNT: # %bb.0:
120
+ ; X64-NO-POPCOUNT-NEXT: # kill: def $edi killed $edi def $rdi
120
121
; X64-NO-POPCOUNT-NEXT: andl $5, %edi
121
- ; X64-NO-POPCOUNT-NEXT: imull $134480385, %edi , %eax # imm = 0x8040201
122
- ; X64-NO-POPCOUNT-NEXT: shrl $3 , %eax
123
- ; X64-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111
124
- ; X64-NO-POPCOUNT-NEXT: imull $286331153, %eax , %eax # imm = 0x11111111
125
- ; X64-NO-POPCOUNT-NEXT: shrl $28 , %eax
122
+ ; X64-NO-POPCOUNT-NEXT: leal (%rdi,%rdi) , %ecx
123
+ ; X64-NO-POPCOUNT-NEXT: movl $59796 , %eax # imm = 0xE994
124
+ ; X64-NO-POPCOUNT-NEXT: # kill: def $cl killed $cl killed $ecx
125
+ ; X64-NO-POPCOUNT-NEXT: shrl %cl , %eax
126
+ ; X64-NO-POPCOUNT-NEXT: andl $3 , %eax
126
127
; X64-NO-POPCOUNT-NEXT: retq
127
128
%mask = and i32 %x , 5 ; 0b101
128
129
%count = tail call i32 @llvm.ctpop.i32 (i32 %mask )
@@ -147,24 +148,23 @@ define i16 @ctpop_shifted_mask3(i16 %x) nounwind readnone {
147
148
;
148
149
; X86-NO-POPCOUNT-LABEL: ctpop_shifted_mask3:
149
150
; X86-NO-POPCOUNT: # %bb.0:
150
- ; X86-NO-POPCOUNT-NEXT: movzwl {{[0-9]+}}(%esp), %eax
151
- ; X86-NO-POPCOUNT-NEXT: andl $14, %eax
152
- ; X86-NO-POPCOUNT-NEXT: imull $134480385, %eax, %eax # imm = 0x8040201
153
- ; X86-NO-POPCOUNT-NEXT: shrl $3, %eax
154
- ; X86-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111
155
- ; X86-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111
156
- ; X86-NO-POPCOUNT-NEXT: shrl $28, %eax
151
+ ; X86-NO-POPCOUNT-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
152
+ ; X86-NO-POPCOUNT-NEXT: andl $14, %ecx
153
+ ; X86-NO-POPCOUNT-NEXT: movl $59796, %eax # imm = 0xE994
154
+ ; X86-NO-POPCOUNT-NEXT: # kill: def $cl killed $cl killed $ecx
155
+ ; X86-NO-POPCOUNT-NEXT: shrl %cl, %eax
156
+ ; X86-NO-POPCOUNT-NEXT: andl $3, %eax
157
157
; X86-NO-POPCOUNT-NEXT: # kill: def $ax killed $ax killed $eax
158
158
; X86-NO-POPCOUNT-NEXT: retl
159
159
;
160
160
; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask3:
161
161
; X64-NO-POPCOUNT: # %bb.0:
162
- ; X64-NO-POPCOUNT-NEXT: andl $14 , %edi
163
- ; X64-NO-POPCOUNT-NEXT: imull $134480385 , %edi, %eax # imm = 0x8040201
164
- ; X64-NO-POPCOUNT-NEXT: shrl $3 , %eax
165
- ; X64-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111
166
- ; X64-NO-POPCOUNT-NEXT: imull $286331153, %eax , %eax # imm = 0x11111111
167
- ; X64-NO-POPCOUNT-NEXT: shrl $28 , %eax
162
+ ; X64-NO-POPCOUNT-NEXT: movl %edi , %ecx
163
+ ; X64-NO-POPCOUNT-NEXT: andl $14 , %ecx
164
+ ; X64-NO-POPCOUNT-NEXT: movl $59796 , %eax # imm = 0xE994
165
+ ; X64-NO-POPCOUNT-NEXT: # kill: def $cl killed $cl killed $ecx
166
+ ; X64-NO-POPCOUNT-NEXT: shrl %cl , %eax
167
+ ; X64-NO-POPCOUNT-NEXT: andl $3 , %eax
168
168
; X64-NO-POPCOUNT-NEXT: # kill: def $ax killed $ax killed $eax
169
169
; X64-NO-POPCOUNT-NEXT: retq
170
170
%mask = and i16 %x , 14 ; 7 << 1
@@ -202,11 +202,11 @@ define i64 @ctpop_mask4(i64 %x) nounwind readnone {
202
202
; X64-NO-POPCOUNT-LABEL: ctpop_mask4:
203
203
; X64-NO-POPCOUNT: # %bb.0:
204
204
; X64-NO-POPCOUNT-NEXT: andl $15, %edi
205
- ; X64-NO-POPCOUNT-NEXT: imull $134480385, %edi, %eax # imm = 0x8040201
206
- ; X64-NO-POPCOUNT-NEXT: shrl $3 , %eax
207
- ; X64-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111
208
- ; X64-NO-POPCOUNT-NEXT: imull $286331153, %eax , %eax # imm = 0x11111111
209
- ; X64-NO-POPCOUNT-NEXT: shrl $28 , %eax
205
+ ; X64-NO-POPCOUNT-NEXT: leal (,%rdi,4), %ecx
206
+ ; X64-NO-POPCOUNT-NEXT: movabsq $4841987667533046032 , %rax # imm = 0x4332322132212110
207
+ ; X64-NO-POPCOUNT-NEXT: # kill: def $cl killed $cl killed $ecx
208
+ ; X64-NO-POPCOUNT-NEXT: shrq %cl , %rax
209
+ ; X64-NO-POPCOUNT-NEXT: andl $7 , %eax
210
210
; X64-NO-POPCOUNT-NEXT: retq
211
211
%mask = and i64 %x , 15
212
212
%count = tail call i64 @llvm.ctpop.i64 (i64 %mask )
@@ -241,13 +241,14 @@ define i32 @ctpop_shifted_mask4(i32 %x) nounwind readnone {
241
241
;
242
242
; X64-NO-POPCOUNT-LABEL: ctpop_shifted_mask4:
243
243
; X64-NO-POPCOUNT: # %bb.0:
244
- ; X64-NO-POPCOUNT-NEXT: shrl $9, %edi
245
- ; X64-NO-POPCOUNT-NEXT: andl $15, %edi
246
- ; X64-NO-POPCOUNT-NEXT: imull $134480385, %edi, %eax # imm = 0x8040201
247
- ; X64-NO-POPCOUNT-NEXT: shrl $3, %eax
248
- ; X64-NO-POPCOUNT-NEXT: andl $17895697, %eax # imm = 0x1111111
249
- ; X64-NO-POPCOUNT-NEXT: imull $286331153, %eax, %eax # imm = 0x11111111
250
- ; X64-NO-POPCOUNT-NEXT: shrl $28, %eax
244
+ ; X64-NO-POPCOUNT-NEXT: movl %edi, %ecx
245
+ ; X64-NO-POPCOUNT-NEXT: shrl $7, %ecx
246
+ ; X64-NO-POPCOUNT-NEXT: andl $60, %ecx
247
+ ; X64-NO-POPCOUNT-NEXT: movabsq $4841987667533046032, %rax # imm = 0x4332322132212110
248
+ ; X64-NO-POPCOUNT-NEXT: # kill: def $cl killed $cl killed $ecx
249
+ ; X64-NO-POPCOUNT-NEXT: shrq %cl, %rax
250
+ ; X64-NO-POPCOUNT-NEXT: andl $7, %eax
251
+ ; X64-NO-POPCOUNT-NEXT: # kill: def $eax killed $eax killed $rax
251
252
; X64-NO-POPCOUNT-NEXT: retq
252
253
%mask = and i32 %x , 7680 ; 15 << 9
253
254
%count = tail call i32 @llvm.ctpop.i32 (i32 %mask )
0 commit comments