This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/82498] Missed optimization for x86 rotate instruction


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]