[llvm-commits] [Patch] assembly-written implementation of {u, }{div, mod}si3 for SPARC64

Ed Schouten ed at 80386.nl
Sat Dec 31 05:04:25 PST 2011


Hello all,

According to a developer at the FreeBSD project, FreeBSD's total
compilation time increases by 2.6% when the host system is built against
compiler-rt instead of libgcc. This is likely due to the fact that GCC
has assembly-written versions of the division and modulo routines, while
compiler-rt does not.

The division and modulo routines used by GCC can easily be re-used by
compiler-rt. They are provided for free in The SPARC Architecture Manual
Version 8. Attached to this bug report is a patch that I have written
for compiler-rt. It contains the M4 file that is listed in the manual,
with some small modifications:

- The M4 file uses exponentiation (2^N). This seems to be a Sun-specific
  extension to M4, as I cannot reproduce it with GNU and BSD m4. Fix
  this similar to OpenBSD's version by replacing 2^N with TWOSUPN.

- Use the same register layout as GCC's version.

- Integrate into compiler-rt's codebase by using
  DEFINE_COMPILERRT_FUNCTION().

To generate the proper assembly files, simply run the `generate.sh'
script.

The patch lacks modifications to CMake files, but this is due to the
fact that we use a custom BSD Makefile. As I have very little experience
with CMake, I hope one of you can add this glue.

The u*si3.S files in this patch are simply added because our own
Makefile is written in such a way that it prefers the MI assembly files
over the MD C files.

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sparc64.diff
Type: text/x-diff
Size: 8195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111231/3ade395c/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111231/3ade395c/attachment.sig>


More information about the llvm-commits mailing list