From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 065D538346B5; Tue, 10 May 2022 08:24:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 065D538346B5 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10689] rs6000: Use rs6000_emit_move in movmisalign expander [PR104681] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 1a8b7fb748f95646f314d5dd7a5af48542c3e925 X-Git-Newrev: cc7bc8b2ba5adc89e99bc7923cd3e822b7d465cf Message-Id: <20220510082444.065D538346B5@sourceware.org> Date: Tue, 10 May 2022 08:24:44 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 08:24:44 -0000 https://gcc.gnu.org/g:cc7bc8b2ba5adc89e99bc7923cd3e822b7d465cf commit r10-10689-gcc7bc8b2ba5adc89e99bc7923cd3e822b7d465cf Author: Jakub Jelinek Date: Fri Feb 25 18:58:48 2022 +0100 rs6000: Use rs6000_emit_move in movmisalign expander [PR104681] The following testcase ICEs, because for some strange reason it decides to use movmisaligntf during expansion where the destination is MEM and source is CONST_DOUBLE. For normal mov expanders the rs6000 backend uses rs6000_emit_move to ensure that if one operand is a MEM, the other is a REG and a few other things, but for movmisalign nothing enforced this. The middle-end documents that movmisalign shouldn't fail, so we can't force that through predicates or condition on the expander. 2022-02-25 Jakub Jelinek PR target/104681 * config/rs6000/vector.md (movmisalign): Use rs6000_emit_move. * g++.dg/opt/pr104681.C: New test. (cherry picked from commit 3885a122f817a1b6dca4a84ba9e020d5ab2060af) Diff: --- gcc/config/rs6000/vector.md | 5 ++++- gcc/testsuite/g++.dg/opt/pr104681.C | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md index 662521e74fe..62c60956f4d 100644 --- a/gcc/config/rs6000/vector.md +++ b/gcc/config/rs6000/vector.md @@ -1394,7 +1394,10 @@ [(set (match_operand:VEC_N 0 "nonimmediate_operand") (match_operand:VEC_N 1 "any_operand"))] "VECTOR_MEM_VSX_P (mode) && TARGET_ALLOW_MOVMISALIGN" - "") +{ + rs6000_emit_move (operands[0], operands[1], mode); + DONE; +}) ;; Vector shift right in bits. Currently supported ony for shift ;; amounts that can be expressed as byte shifts (divisible by 8). diff --git a/gcc/testsuite/g++.dg/opt/pr104681.C b/gcc/testsuite/g++.dg/opt/pr104681.C new file mode 100644 index 00000000000..ea54940e7a3 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr104681.C @@ -0,0 +1,19 @@ +// PR target/104681 +// { dg-do compile } +// { dg-options "-O2" } + +void bar (); +struct A { + A (bool) : a(7.0L), b(0) {} + long double a; + long b; +}; +struct B { + void foo () { c = bar; } + A c; +}; +struct C { + void baz (); + B d; +}; +void C::baz () { d.foo (); }