[llvm-dev] (Question regarding the) incomplete "builtins library" of "Compiler-RT"

Stefan Kanthak via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 1 09:02:47 PST 2018

"Eli Friedman" <efriedma at codeaurora.org> wrote:

> On 11/30/2018 8:31 AM, Stefan Kanthak via llvm-dev wrote:
>> Hi @ll,
>> compiler-rt implements (for example) the MSVC (really Windows)
>> specific routines compiler-rt/lib/builtins/i386/chkstk.S and
>> compiler-rt/lib/builtins/x86_64/chkstk.S as __chkstk_ms()
>> See <http://msdn.microsoft.com/en-us/library/ms648426.aspx>
>> Is there any special reason why compiler-rt doesn't implement
>> other MSVC specific functions (alias builtins or "compiler
>> intrinsics") for which clang/LLVM but generates calls?
> There are two "Windows" targets supported by LLVM: one using the MinGW 
> runtime, and the other using the MSVC runtime. If you're targeting the 
> MSVC runtime, it provides _aulldiv and friends; if you're targeting 
> MinGW, LLVM won't refer to those routines. So I can't see a scenario 
> where we would need those routines in compiler-rt.

According to <https://compiler-rt.llvm.org/index.html>

| builtins - a simple library that provides an implementation of
| the low-level target-specific hooks required by code generation
| and other runtime components. ...

these routines SHOULD but be part of the builtins library.

EITHER document the implementation,
OR implement according to the documentation,

tertium datur: document the exceptions from the general rule cited

Stefan Kanthak

PS: if you are interested, I can provide an implementation of _aulldiv
    and friends, which I derived from __divdi3 etc.
    They are about 3-4 times faster than the routines from the MSVC

More information about the llvm-dev mailing list