[Bug target/49468] SH Target: inefficient integer abs code
oleg.endo@t-online.de
gcc-bugzilla@gcc.gnu.org
Sun Jun 19 15:30:00 GMT 2011
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.
More information about the Gcc-bugs
mailing list