Add support for the rev16 and revsh instructions.

Registered by Ramana Radhakrishnan

We could support the rev16 and revsh instructions and this was originally split out from https://bugs.launchpad.net/gcc-linaro/+bug/641171

Blueprint information

Status:
Complete
Approver:
Michael Hope
Priority:
Medium
Drafter:
Michael Hope
Direction:
Approved
Assignee:
Christophe Lyon
Definition:
Approved
Series goal:
Accepted for 4.7
Implementation:
Implemented
Milestone target:
milestone icon 4.7-2013.01
Started by
Christophe Lyon
Completed by
Matthew Gretton-Dann

Whiteboard

The Power backend supports bswap16 in 4.7. This was made generic in 4.8 by 74bdbe96e400ab62151c5e9bad64093fe02fa938 by ebotcazou. A stalled implementation is at http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00962.html

Implement in 4.8. Check __builtin_bswap16 itself. Check that GCC converts a (x << 8) | (x >> 8) into a rev16 and/or revsh. Add detection and support in libav. Benchmark to show that the builtin version is no slower than the inline assembly version.

Find another library that makes heavy use and show the difference. michaelh thought lz4, but the format is little endian and doesn't need swapping.

Backport to Linaro 4.7 if practical. Perhaps add something like __GCC_HAVE_SYNC_COMPARE_AND_SWAP for runtime detection?

Meta:
Headline: TBD
Acceptance: TBD

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.