[PATCH][GCC] arm: Fix MVE scalar shift intrinsics code-gen.
authorSrinath Parvathaneni <srinath.parvathaneni@arm.com>
Tue, 16 Jun 2020 14:55:55 +0000 (15:55 +0100)
committerSrinath Parvathaneni <srinath.parvathaneni@arm.com>
Tue, 16 Jun 2020 14:56:16 +0000 (15:56 +0100)
commit6af598703f919b56f628c496843cdfe6f0cb8276
tree56ff889c05c1b7c3dbec65dfec9ac0f238e9c784
parent1160ec9a141faf1c4c0496c7412c8febeb623962
[PATCH][GCC] arm: Fix MVE scalar shift intrinsics code-gen.

This patch modifies the MVE scalar shift RTL patterns. The current patterns
have wrong constraints and predicates due to which the values returned from
MVE scalar shift instructions are overwritten in the code-gen.

example:
$ cat x.c
int32_t  foo(int64_t acc, int shift)
{
  return sqrshrl_sat48 (acc, shift);
}

Code-gen before applying this patch:
$ arm-none-eabi-gcc -march=armv8.1-m.main+mve -mfloat-abi=hard -O2 -S
$  cat x.s
foo:
   push    {r4, r5}
   sqrshrl r0, r1, #48, r2   ----> (a)
   mov     r0, r4  ----> (b)
   pop     {r4, r5}
   bx      lr

Code-gen after applying this patch:
foo:
   sqrshrl r0, r1, #48, r2
   bx      lr

In the current compiler the return value (r0) from sqrshrl (a) is getting
overwritten by the mov statement (b).
This patch fixes above issue.

2020-06-12  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

gcc/
* config/arm/mve.md (mve_uqrshll_sat<supf>_di): Correct the predicate
and constraint of all the operands.
(mve_sqrshrl_sat<supf>_di): Likewise.
(mve_uqrshl_si): Likewise.
(mve_sqrshr_si): Likewise.
(mve_uqshll_di): Likewise.
(mve_urshrl_di): Likewise.
(mve_uqshl_si): Likewise.
(mve_urshr_si): Likewise.
(mve_sqshl_si): Likewise.
(mve_srshr_si): Likewise.
(mve_srshrl_di): Likewise.
(mve_sqshll_di): Likewise.
* config/arm/predicates.md (arm_low_register_operand): Define.

gcc/testsuite/
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts1.c: New test.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts2.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts3.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts4.c: Likewise.
gcc/config/arm/mve.md
gcc/config/arm/predicates.md
gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_scalar_shifts1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_scalar_shifts2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_scalar_shifts3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_scalar_shifts4.c [new file with mode: 0644]