http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57177
Bug #: 57177
Summary: [SH] Improve integer division
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
Target: sh*-*-*
Currently integer division on SH is implemented with some optimized library
functions for 32 bit division only. There are some data type combinations
where a more efficient implementation could be used.
E.g. "uint8_t / uint8_t -> uint8_t" can be implemented as:
extu.b r4,r4
extu.b r5,r5
div0u
shll8 r5
div1 r5,r4
div1 r5,r4
div1 r5,r4
div1 r5,r4
div1 r5,r4
div1 r5,r4
div1 r5,r4
div1 r5,r4
rotcl r4
extu.b r4,r0
which should be faster for such cases as the current division functions.
Some other interesting cases:
32 bit / 16 bit -> 16 bit
64 bit / 32 bit -> 32 bit
16 bit / 16 bit -> 16 bit
Small sequence such as above could also be expanded directly instead of using
library function calls.