This is an archive of the discontinued LLVM Phabricator instance.

[ARM, AArch64] Add Rotate Right (ROR) Intrinsic.
AbandonedPublic

Authored by mgrang on Jun 16 2016, 6:32 PM.

Details

Summary

Here is the LLVM part of this patch:
http://reviews.llvm.org/D21456

Diff Detail

Event Timeline

mgrang updated this revision to Diff 61058.Jun 16 2016, 6:32 PM
mgrang retitled this revision from to [ARM, AArch64] Add Rotate Right (ROR) Intrinsic..
mgrang updated this object.
mgrang added reviewers: t.p.northover, grosbach.
mgrang added a subscriber: apazos.
t.p.northover edited edge metadata.Jun 16 2016, 6:53 PM

I don't think this needs to be an intrinsic, certainly not at the Clang level. We usually try to model things as natural LLVM IR wherever possible. This means that that all front-ends can benefit, rather than just the people using special intrinsics; it also avoids adding yet more portability issues when people use the builtins.

In the case of ROR, there are issues getting perfect CodeGen in the face of larger-than-register rotates. But I don't think they're insurmountable in either the mid- or back-end.

Also: tests! You should almost always include tests in any patch, no matter how trivial it is.

Cheers.

Tim.

mgrang added a comment.EditedJun 17 2016, 11:46 AM

Thanks for your comments Tim.

I have already included two test cases with this patch. I guess I will add some tests with the LLVM part of this patch as well.

The use case for this intrinsic is a customer who makes calls to __builtin_arm_ror in their code base. Currently they compile with ARMCC, but LLVM does not have this intrinsic. So porting the code to build with LLVM becomes a hassle.

To facilitate customers to switch to LLVM we wanted to implement the following intrinsics:

ror: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359125001077.html
enable_irq: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359124996163.html
disable_irq: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359125001077.html
current_sp : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359124995149.html
current_pc : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359124994884.html
breakpoint : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/CJAHBCFH.html

Could you please let me know if this is something that the community would like to support? I can then implement each one of these (although we can work on the implementation details).

Thanks,
Mandeep

right, __ror is in arm_acle.h ...

Good to know there is such wrapper header file. :)

Thanks,

Weiming

Thanks Tim for pointing out that __ror is already implemented in arm_acle.h. My patches are no longer needed then.

I will work on implementing the other intrinsics I mentioned earlier.

Thanks,
Mandeep

mgrang abandoned this revision.Oct 21 2016, 10:41 AM