[PATCH] 128-bit ABI for x86_64-w64-mingw32 incorrectly generated

Jameson Nash vtjnash at gmail.com
Sat Apr 19 15:33:32 PDT 2014


  > It looks like you're trying to match VCPP here, since you're using "-win32" target triple. However, you're calling __modti3 here, which is definitely not provided by VCPP...

  It appears that MSVC-compiled LLVM generates identical code (including `callq __modti3`), although it moves one of the instructions, so my initial tests do not succeed, without reordering the assembly instructions in the test to match:
  ```
  ; WIN64-NOT: movl       $3, %r8d
  ; WIN64-NOT: xorl       %r9d, %r9d
  ; WIN64: leaq    -72(%rsp), %rsp
  ; WIN64: movq    %rdx, 56(%rsp)
  ; WIN64: movq    %rcx, 48(%rsp)
  ; WIN64: leaq    48(%rsp), %rcx
  ; WIN64: leaq    32(%rsp), %rdx # <= this instruction moved
  ; WIN64: movq    $0, 40(%rsp)
  ; WIN64: movq    $3, 32(%rsp)
  ; WIN64: callq   __modti3
  ; WIN64: movd    %xmm0, %rax
  ; WIN64: punpckhqdq      %xmm0, %xmm0
  ; WIN64: movd    %xmm0, %rdx
  ; WIN64: leaq    72(%rsp), %rsp
  ```

  note that __modti3 can be optained as part of llvm (http://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/modti3.c) for compilers where it is not present, although my initial impression is that it would need to be ported to win32/pe-coff

http://reviews.llvm.org/D1998






More information about the llvm-commits mailing list