[cfe-dev] Stupid 64-bit divide question

Michael Spencer bigcheesegs at gmail.com
Thu Sep 30 10:41:20 PDT 2010


On Thu, Sep 30, 2010 at 6:16 AM, per at lumai.se <per at lumai.se> wrote:
> Hi all,
>
> I am experimenting with compiling C code under Windows (MSVC env., _not_
> mingw) via COFF -> exe file using clang x.c -emit-llvm and llc
> -filetype=obj followed by linking using the MSVC linker. This works well

Good to see someone else using this. Let me know if you find any
problems (I know of quite a few, and am currently working on them).

> except that some 64 bit arithmetic operations generate libcalls to
> functions like __divdi3 which have different names/uses in the MSVC
> runtime (i.e. __divdi3 ~= __alldiv in libcmt.lib). I assume that
> __divdi3 is something GNU specific. Is there a simple way to influence
> which libcalls are emitted? Any attempts to define my own __divdi3 seem
> to be ignored.

These calls are generated in the LLVM x86 backend, which needs to be
taught about the MSVC runtime, as currently it only knows about GNU.
Interestingly code using these constructs executes correctly if run
with the JIT, but I don't know how (there's no __divdi3 in the JIT
either).

In short, Windows support is still way behind GNU and Darwin support,
but there are quite a few of us working on it, and any help (including
reduced test cases) is appreciated.

> cheers,
> Per Lindén
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list