[PATCH] D78785: Fix x86/x86_64 calling convention for _ExtInt

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 21:42:37 PDT 2020


Quuxplusone added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:2804
+    return;
+  }
+
----------------
Asking silly questions because I don't stand a chance of understanding either the code or the tests...

In the x86-64 ABI, an ordinary 16-byte `struct` would be passed in `rdi/rsi` and returned in `rdx/rax`. An ordinary 17-byte `struct` would be passed by hidden reference and returned by hidden reference.

Is your intent here that `_ExtInt` will follow the same convention, i.e., `_ExtInt(128)` will be passed in `rdi/rsi` and returned in `rdx/rax`? and `_ExtInt(129)` will be passed and returned by hidden reference?

Clang trunk currently passes `_ExtInt(256)` in `rdi/rsi/rdx/rcx/r8/r9/stack` as if it were a series of `uint64_t`s. (I hadn't noticed until now.) That's kind of cute. Is the current PR motivated by performance concerns with the multi-`uint64_t` approach, or just trying to be consistent with the `struct` rules?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78785/new/

https://reviews.llvm.org/D78785





More information about the cfe-commits mailing list