[PATCH 2/2][AArch64] Simplify+improve patterns for ushr(d?)_n_u64 intrinsic

Alan Lawrence alan.lawrence@arm.com
Mon Sep 8 16:25:00 GMT 2014


Similarly, the ushr_n_u64 and ushrd_n_u64 intrinsics, allow to perform an 
unsigned-shift-right of a 64-bit value by 64 places. This is not supported by 
the standard lshr pattern, which masks the shift amount with 63. However, a 
shift-by-64 always produces zero, so this patch moves in a constant 0 rather 
than outputting a shift instruction.

Cross-tested on aarch64-none-elf and aarch64_be-none-elf, with test coverage 
provided by gcc.target/aarch64/ushr64_1.c .

gcc/ChangeLog:

	* config/aarch64/aarch64-simd.md (aarch64_lshr_simddi): Handle shift
	by 64 by moving const0_rtx.
	(aarch64_ushr_simddi): Delete.

	* config/aarch64/aarch64.md (enum unspec): Delete UNSPEC_USHR64.

Alan Lawrence wrote:
> The sshr_n_64 intrinsics allow performing a signed shift right by 64 places. The 
> standard ashrdi3 pattern masks the sign amount with 63, so cannot be used. 
> However, such a shift fills the result by the sign bit, which is identical to 
> shifting right by 63. This patch just simplifies the code to shift by 63 
> instead, which allows to remove an UNSPEC and insn previously dedicated to this 
> case.
> 
> Cross-tested on aarch64-none-elf and aarch64_be-none-elf, with test coverage 
> provided by gcc.target/aarch64/sshr64_1.c .
> 
> gcc/ChangeLog:
> 
> 	* config/aarch64/aarch64.md (enum "unspec"): Remove UNSPEC_SSHR64.
> 
> 	* config/aarch64/aarch64-simd.md (aarch64_ashr_simddi): Change shift
> 	amount to 63 if was 64.
> 	(aarch64_sshr_simddi): Remove.
> 
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shift-unsigned.patch
Type: text/x-patch
Size: 2207 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140908/99cb7597/attachment.bin>


More information about the Gcc-patches mailing list