http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55303



--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> 2013-03-02 16:23:57 
UTC ---

For non-SH2A targets there is an opportunity to generate better insn sequences

for the special case



unsigned int test (unsigned int a)

{

  return a > 1 ? 1 : a;

}



on SH2A:

   tst     r4,r4

   movrt   r0



if zero-displacement branches are not good:

   tst     r4,r4

   mov     #-1,r0

   negc    r0,r0



if zero-displacement branches are good:

   tst     r4,r4

   bt      0f

   mov     #1,r1

0f:



This can be done by implementing a pattern

  (umin:SI (match_operand:SI 1 "arith_reg_operand")

           (const_int 1))



as it is already done for SH2A in attachment 29567.

Reply via email to