On Mon, Sep 27, 2010 at 11:58 AM, Sandeep Patel <[email protected]> wrote: > On Fri, Sep 24, 2010 at 1:52 AM, Daniel Dunbar <[email protected]> wrote: >> On Thu, Sep 23, 2010 at 3:42 PM, Eli Friedman <[email protected]> wrote: >>> On Wed, Sep 22, 2010 at 6:54 PM, Daniel Dunbar <[email protected]> wrote: >>>> Author: ddunbar >>>> Date: Wed Sep 22 20:54:28 2010 >>>> New Revision: 114618 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=114618&view=rev >>>> Log: >>>> IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given >>>> ABI. >>>> - Therefore, we can lower out the NEON wrapper structs and pass the >>>> vectors >>>> directly. This makes a huge difference in the cleanliness of the IR after >>>> optimization. >>>> - I will trust, but verify, via future ABITest testing (for APCS-GNU, at >>>> least). >>>> >>>> Added: >>>> cfe/trunk/test/CodeGen/arm-vector-arguments.c >>>> Modified: >>>> cfe/trunk/lib/CodeGen/TargetInfo.cpp >>>> >>>> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=114618&r1=114617&r2=114618&view=diff >>>> ============================================================================== >>>> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) >>>> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Sep 22 20:54:28 2010 >>>> @@ -2272,6 +2272,17 @@ >>>> if (isRecordWithNonTrivialDestructorOrCopyConstructor(Ty)) >>>> return ABIArgInfo::getIndirect(0, /*ByVal=*/false); >>>> >>>> + // NEON vectors are implemented as (theoretically) opaque structures >>>> wrapping >>>> + // the underlying vector type. We trust the backend to pass the >>>> underlying >>>> + // vectors appropriately, so we can unwrap the structs which generally >>>> will >>>> + // lead to much cleaner IR. >>>> + if (const Type *SeltTy = isSingleElementStruct(Ty, getContext())) { >>>> + if (SeltTy->isVectorType()) >>>> + return ABIArgInfo::getDirect(CGT.ConvertType(QualType(SeltTy, 0))); >>>> + } >>> >>> Err, don't you actually need to check that the target supports NEON >>> and that the vectors in question are actually NEON vectors? >> >> I don't think so, I believe they both should be passed the same way in >> both ABIs, but this gives cleaner IR. This assumes the backend honors >> the ABI correctly, of course. >> >> I don't know too much about the AAPCS ABI, however, so I could be wrong. > > This is going to be wrong on AAPCS-VFP where there are specific rules > for how structures containing vectors are to be passed in vector > registers or memory. > > Doing all the AAPCS-VFP rules in Clang is on my long list of stuff I'd > eventually like to get to, so if somebody else is motivated, please > jump in first if you have the cycles.
I can't remember if I have made this offer publicly before, but as a general rule if someone donates to me a fast machine which otherwise has Clang support, I will implement the ABI for it. You can't have it back though. :) - Daniel > deep > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
