This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/49468] SH Target: inefficient integer abs code
- From: "oleg dot endo at t-online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 19 Jun 2011 15:30:03 +0000
- Subject: [Bug target/49468] SH Target: inefficient integer abs code
- Auto-submitted: auto-generated
- References: <bug-49468-4@http.gcc.gnu.org/bugzilla/>
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.