]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Shortcut identity VEC_PERM expansion [PR94710]
authorJakub Jelinek <jakub@redhat.com>
Thu, 23 Apr 2020 19:57:50 +0000 (21:57 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 16 Sep 2020 17:17:19 +0000 (19:17 +0200)
This PR is about the rs6000 backend emitting wrong assembly
for whole vector shift by 0, and while I think it is desirable
to fix the backend, I don't see a point why the expander should
try to emit that, whole vector shift by 0 is identity, we can just
return the operand.

2020-04-23  Jakub Jelinek  <jakub@redhat.com>

PR target/94710
* optabs.c (expand_vec_perm_const): For shift_amt const0_rtx
just return v2.

(cherry picked from commit f51be2fb8653f81092f8158a0f0527275f86603b)

gcc/optabs.c

index 7d7efe0a4a27575c439e972ce31fc6944ef2d887..f469e8099392d92a7c2c8d69c8be1d1e44c97041 100644 (file)
@@ -5559,6 +5559,8 @@ expand_vec_perm_const (machine_mode mode, rtx v0, rtx v1,
       if (shift_amt)
        {
          struct expand_operand ops[3];
+         if (shift_amt == const0_rtx)
+           return v0;
          if (shift_code != CODE_FOR_nothing)
            {
              create_output_operand (&ops[0], target, mode);