]> granicus.if.org Git - clang/commit
[ARM,AArch64] Fix __rev16l and __rev16ll intrinsics
authorOliver Stannard <oliver.stannard@arm.com>
Mon, 16 Nov 2015 14:58:50 +0000 (14:58 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Mon, 16 Nov 2015 14:58:50 +0000 (14:58 +0000)
commitfc6a9e21d069a68e9f5ddf28a95c929dd7440063
tree5b16881ea0a682b424d987aa1622d07f54ef21a7
parent2bfb2cd98ee8a4832db6b0991bbec48add4c55ee
[ARM,AArch64] Fix __rev16l and __rev16ll intrinsics

These two intrinsics are defined in arm_acle.h.

__rev16l needs to rotate by 16 bits, bit it was actually rotating by 2 bits.
For AArch64, where long is 64 bits, this would still be wrong.

__rev16ll was incorrect, it reversed the bytes in each 32-bit word, rather than
each 16-bit halfword. The correct implementation is to apply __rev16 to the top
and bottom words of the 64-bit value.

For AArch32 targets, these get compiled down to the hardware rev16 instruction
at -O1 and above. For AArch64 targets, the 64-bit ones get compiled to two
32-bit rev16 instructions, because there is not currently a pattern for the
64-bit rev16 instruction.

Differential Revision: http://reviews.llvm.org/D14609

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253211 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Headers/arm_acle.h
test/CodeGen/arm_acle.c