[cfe-commits] [Patch] compiler-rt: SPARC64-optimized multiply/divide

Chris Lattner clattner at apple.com
Thu Oct 18 15:05:06 PDT 2012

On Oct 18, 2012, at 1:00 AM, Ed Schouten <ed at 80386.nl> wrote:

> Hi all,
> Attached is the latest version of a patch we use at FreeBSD to add
> optimized multiply/divide functions on SPARC64. Description from the
> original bug report[1]:

Very cool.  Please send this to llvm-commits though.


> "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()."
> The diff includes a `generate.sh', which generates the actual assembly
> files. I guess we don't want to depend on M4 to build compiler-rt, so
> it may be easier to run generate.sh and store the resulting C files in
> the repository as well. Sorry for not providing a CMakefile. At
> FreeBSD, we never build compiler-rt with CMake, as we imported
> compiler-rt into our own build infrastructure.
> -- 
> Ed Schouten <ed at 80386.nl>
> [1] http://llvm.org/bugs/show_bug.cgi?id=11667
> <compiler-rt-sparc64.txt>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

More information about the cfe-commits mailing list