This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82498] Missed optimization for x86 rotate instruction
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Oct 2017 20:50:06 +0000
- Subject: [Bug target/82498] Missed optimization for x86 rotate instruction
- Auto-submitted: auto-generated
- References: <bug-82498-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82498
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-10-10
Ever confirmed|0 |1
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Looks like https://stackoverflow.com/q/44000956/1918193 . During combine, we
try to match
(set (reg:SI 97)
(rotate:SI (reg/v:SI 90 [ input ])
(and:QI (subreg:QI (reg:SI 92 [ rot ]) 0)
(const_int 31 [0x1f]))))
But the pattern in i386.md has 'and' and 'subreg' reversed.
For the other part, we have a very limited transform that removes the test in
this case:
uint32_t rotate_left(uint32_t input, int rot)
{
if(rot == 0)
return input;
return static_cast<uint32_t>((input << rot) | (input >>
(8*sizeof(uint32_t)-rot)));;
}
But it only works when there is a single gimple insn involved, not
and+cast+rotate.