[PATCH] D100225: [Clang][AArch64] Coerce integer return values through an undef vector

Andrew Savonichev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 11 11:52:36 PDT 2021


asavonic added a comment.

In D100225#2681809 <https://reviews.llvm.org/D100225#2681809>, @rjmccall wrote:

> Why does the ABI "require" this to be returned as an i64 if some of the bits are undefined?

AArch64 ABI requires return values (of composite types) to be rounded up to 64 bits (see `AArch64ABIInfo::classifyReturnType`). I assume that if a value, say i16, is rounded up to i64, then the upper 48 bits can be arbitrary (undefined). I think this is aligned with the description of `CreateCoercedLoad`:

  /// CreateCoercedLoad - Create a load from \arg SrcPtr interpreted as
  /// a pointer to an object of type \arg Ty, known to be aligned to
  /// \arg SrcAlign bytes.
  ///
  /// This safely handles the case when the src type is smaller than the
  /// destination type; in this situation the values of bits which not
  /// present in the src are undefined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100225



More information about the cfe-commits mailing list