Before we were relying on the any extend of the s1 to s32, but for AAPCS we need to zero-extend it to at least s8.
Fixes PR36719
Differential D47425
[AArch64][GlobalISel] Zero-extend s1 values when returning. aemerson on May 27 2018, 9:14 AM. Authored by
Details Before we were relying on the any extend of the s1 to s32, but for AAPCS we need to zero-extend it to at least s8. Fixes PR36719
Diff Detail
Event TimelineComment Actions I got my branches mixed up, this patch is missing test updates. Will upload a new one soon.
Comment Actions If possible, GlobalISel's handling of booleans should match SelectionDAG's handling:
The third rule is arguably weird, but it avoids scattering special cases for i1 across legalization. I don't see any compelling reason for GlobalISel to diverge. The ABI rule for booleans on AArch64 is a little strange. The value must be passed/returned as if it were converted to unsigned char, but it doesn't need to be zero-extended beyond 8 bits. (See examples at https://bugs.llvm.org/show_bug.cgi?id=36719 .) This should be handled somewhere in the ABI code, not legalization. Comment Actions I'll re-do this patch to unconditionally zero-extend for returns and also fix up the G_STORE legalisation to always zero-extend too. Given we don't have any target hooks that give us the information we need, let's go with just matching SelectionDAG behaviour? As for the zeroext attributes, from what I can tell we've had the distinction between Darwin and non-Darwin with this since the beginning of the AArch64 target, which was contributed by @t.p.northover. I'd rather not be messing with that unless I have to. Comment Actions Yes, Apple ABI is different (documented at https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html). Comment Actions New patch now only zero-extends for stores, removing the use of getBooleanContents. We already have test coverage for the store zero-extension. The return issue is fixed in AArch64CallLowering instead. Comment Actions Please take a look at the small nitpick, otherwise LGTM. Thanks!
|