[Bug target/122018] x86 doesn't use BTS bitmanip instruction to both set and test bit
ubizjak at gmail dot com via Gcc-bugs <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122018
--- Comment #21 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 65313
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65313&action=edit
Prototype patch that converts BTS to a canonical form
(In reply to Uroš Bizjak from comment #20)
> (parallel [
> (set (zero_extract:SI (reg/v:SI 102 [ a ])
> (const_int 1 [0x1])
> (subreg:QI (reg/v:SI 103 [ b ]) 0))
> (const_int 1 [0x1]))
> (clobber (reg:CC 17 flags))
> ])
>
> which is another (and probably canonical) form of bit set RTX.
The attached patch converts BTS to its canonical form. Compiles the testcase
from Comment#18 to:
f:
.LFB0:
.cfi_startproc
btl %esi, %edi
movl %edi, %eax
jnc .L8
ret
.L8:
subq $24, %rsp
btsl %esi, %eax
movl %eax, 12(%rsp)
call g
movl 12(%rsp), %eax
addq $24, %rsp
ret