This is an archive of the discontinued LLVM Phabricator instance.

arm_acle: Implement data processing intrinsics
ClosedPublic

Authored by kongyi on Aug 20 2014, 6:55 AM.

Details

Summary

ACLE 2.0 section 9.2 defines the following "miscellaneous data processing intrinsics": __clz, __cls, __ror, __rev, __rev16, __revsh and __rbit.

__clz has already been implemented in the arm_acle.h header file. The rest are not supported yet. This patch completes ACLE data processing intrinsics.

Diff Detail

Event Timeline

kongyi updated this revision to Diff 12699.Aug 20 2014, 6:55 AM
kongyi retitled this revision from to arm_acle: Implement data processing intrinsics.
kongyi updated this object.
kongyi added reviewers: rengolin, t.p.northover.
kongyi added a subscriber: Unknown Object (MLST).
t.p.northover edited edge metadata.Aug 20 2014, 7:11 AM

Hi Yi,

Thanks for working on this. I spotted a couple of issues (but I'm going away for a week tomorrow, so you may want to dig up another reviewer too):

lib/Headers/arm_acle.h
114

This is undefined behaviour when y >= 32 or == 0.

155

This seems to be off-by-1 from what I'd expect. It certainly returns an incorrect value for t == 0 (according to ACLE).

rengolin edited edge metadata.Aug 20 2014, 7:44 AM

Some more comments.

cheers,
--renato

lib/Headers/arm_acle.h
114

ACLE says: "y can take any value", so we need some safeguards on all these shift functions.

In this case, something like:

if (y >= 32) y %= 32;
if (y == 0) return x;
return (x >> y) | (x << 32 - y);

If that's the intended, but not explicit, semantics.

201

You could keep the order and put rbitll after rbitl.

test/CodeGen/arm_acle.c
172

Doesn't this call CLZ as well?

kongyi updated this revision to Diff 12986.Aug 27 2014, 6:29 AM
kongyi edited edge metadata.

Addressed Renato's and Tim's comments.

ROR implementation now conforms ACLE specification. CLS intrinsics are removed for now.

rengolin accepted this revision.Aug 27 2014, 7:15 AM
rengolin edited edge metadata.

Thanks Yi, LGTM.

--renato

This revision is now accepted and ready to land.Aug 27 2014, 7:15 AM
kongyi closed this revision.Aug 28 2014, 2:53 AM