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/49468] SH Target: inefficient integer abs code


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

--- Comment #1 from Oleg Endo <oleg.endo@t-online.de> 2011-06-19 15:29:45 UTC ---
Created attachment 24560
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24560
Proposed patch

The patch adds explicit handling of abs:SI and abs:DI to the machine
description instead of relying on the default abs handling. On SH4 the
zero-offset branch way is definitely faster. It reduces pressure on EX group
instructions and improves parallel instruction execution. On other than SH4
zero-offset branches are not as fast, but the resulting code should still be
faster than the default branch-free abs code, at least it is more compact. 
The patch also handles the case of neg (abs (...)) by simply inverting the
branch condition.

Feedback appreciated.


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