From 0c7f131ed2ce008e8d17aa8530f790f934242713 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 27 Apr 2020 13:44:42 -0700 Subject: [PATCH] arm: Fix some bugs in the aapcs64 implementation. The templates which checked for short vectors, and our approximation of HFA, HVA and HXA types were not correct. This change actually simplifies them along with getting them to produce correct results. In the case of HXA, there was a logic bug where an && was used where an || was intended. There may still be bugs in the actual collection of arguments and setting of return values since those aspects are harder to test. Change-Id: Ice3177205a98c678ecb43ba600813b3909c44e6b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28267 Reviewed-by: Nikos Nikoleris Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/arch/arm/aapcs64.hh | 46 ++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/src/arch/arm/aapcs64.hh b/src/arch/arm/aapcs64.hh index 203846d43..30597f59e 100644 --- a/src/arch/arm/aapcs64.hh +++ b/src/arch/arm/aapcs64.hh @@ -70,24 +70,17 @@ namespace GuestABI // A short vector is a machine type that is composed of repeated instances of // one fundamental integral or floating- point type. It may be 8 or 16 bytes -// in total size. We represent it here as an opaque blob of data with an -// appropriate alignment requirement. +// in total size. -template -using Aapcs64ShortVectorCandidate = - alignas(sizeof(T) * count) uint8_t [sizeof(T) * count]; - -template -using Aapcs64ShortVector = Aapcs64ShortVectorCandidate::value || std::is_floating_point::value) && - (sizeof(T) * count == 8 || sizeof(T) * count == 16)>::type>; - -template +template struct IsAapcs64ShortVector : public std::false_type {}; template -struct IsAapcs64ShortVector> : public std::true_type +struct IsAapcs64ShortVector::value || std::is_floating_point::value) && + (sizeof(E) * N == 8 || sizeof(E) * N == 16)>::type> : + public std::true_type {}; /* @@ -114,38 +107,31 @@ struct IsAapcs64Composite -using Aapcs64HomogeneousAggregate = T[count]; - // An Homogeneous Floating-Point Aggregate (HFA) is an Homogeneous Aggregate // with a Fundemental Data Type that is a Floating-Point type and at most four // uniquely addressable members. -template -using Aapcs64Hfa = Aapcs64HomogeneousAggregate::value && - count <= 4>::type>; - template struct IsAapcs64Hfa : public std::false_type {}; template -struct IsAapcs64Hfa> : public std::true_type {}; +struct IsAapcs64Hfa::value && + N <= 4>::type> : public std::true_type +{}; // An Homogeneous Short-Vector Aggregate (HVA) is an Homogeneous Aggregate with // a Fundamental Data Type that is a Short-Vector type and at most four // uniquely addressable members. -template -using Aapcs64Hva = Aapcs64HomogeneousAggregate::value && - count <= 4>::type>; - template struct IsAapcs64Hva : public std::false_type {}; template -struct IsAapcs64Hva> : public std::true_type {}; +struct IsAapcs64Hva::value && + N <= 4>::type> : public std::true_type +{}; // A shorthand to test if a type is an HVA or an HFA. template @@ -153,7 +139,7 @@ struct IsAapcs64Hxa : public std::false_type {}; template struct IsAapcs64Hxa::value && IsAapcs64Hva::value>::type> : + IsAapcs64Hfa::value || IsAapcs64Hva::value>::type> : public std::true_type {}; -- 2.30.2