[all-commits] [llvm/llvm-project] d6216e: [X86] Fix handling of i128<->fp on Windows

Martin Storsjö via All-commits all-commits at lists.llvm.org
Wed Sep 29 03:06:39 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6216e2cd1a5e07f8509215ee5422ff5ee358da8
      https://github.com/llvm/llvm-project/commit/d6216e2cd1a5e07f8509215ee5422ff5ee358da8
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-09-29 (Wed, 29 Sep 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    A llvm/test/CodeGen/X86/i128-fpconv-win64-strict.ll
    A llvm/test/CodeGen/X86/i128-fpconv-win64.ll

  Log Message:
  -----------
  [X86] Fix handling of i128<->fp on Windows

On Windows, i128 arguments are passed as indirect arguments, and
they are returned in xmm0.

This is mostly fixed up by `WinX86_64ABIInfo::classify` in Clang, making
the IR functions return v2i64 instead of i128, and making the arguments
indirect. However for cases where libcalls are generated in the target
lowering, the lowering uses the default x86_64 calling convention for
i128, where they are passed/returned as a register pair.

Add custom lowering logic, similar to the existing logic for i128
div/mod (added in 4a406d32e97b1748c4eed6674a2c1819b9cf98ea),
manually making the libcall (while overriding the return type to
v2i64 or passing the arguments as pointers to arguments on the stack).

X86CallingConv.td doesn't seem to handle i128 at all, otherwise
the windows specific behaviours would ideally be implemented as
overrides there, in generic code, handling these cases automatically.

This fixes https://bugs.llvm.org/show_bug.cgi?id=48940.

Differential Revision: https://reviews.llvm.org/D110413




More information about the All-commits mailing list