public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: Eric Botcazou <botcazou@adacore.com>
Cc: Richard Biener <rguenther@suse.de>,
	Kito Cheng <kito.cheng@sifive.com>,
	 GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR target/96759 - Handle global variable assignment from misaligned structure/PARALLEL return values.
Date: Thu, 10 Sep 2020 18:05:28 +0800	[thread overview]
Message-ID: <CA+yXCZA6eABijCur8__O6X8Q9w5V37ZYzguyf8a7RVSiAvPX3g@mail.gmail.com> (raw)
In-Reply-To: <CA+yXCZDfnNf=UaUFpKihJngGCeF7Nq+CnO2A+rDo2wsUY57wvg@mail.gmail.com>

Optimized version of the v2 patch, get rid of assign_stack_temp.

diff --git a/gcc/expr.c b/gcc/expr.c
index 1a15f24b3979..5f744a6c1b8d 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5168,7 +5168,16 @@ expand_assignment (tree to, tree from, bool nontemporal)
      rtx reg, mem;

      reg = expand_expr (from, NULL_RTX, VOIDmode, EXPAND_NORMAL);
-      reg = force_not_mem (reg);
+
+      if (GET_CODE (reg) == PARALLEL)
+       {
+         rtx temp = gen_reg_rtx (mode);
+         emit_group_store (temp, reg, TREE_TYPE (from),
+                          int_size_in_bytes (TREE_TYPE (from)));
+         reg = temp;
+       }
+
+      reg = force_not_mem (mode, reg);
      mem = expand_expr (to, NULL_RTX, VOIDmode, EXPAND_WRITE);
      if (TREE_CODE (to) == MEM_REF && REF_REVERSE_STORAGE_ORDER (to))
       reg = flip_storage_order (mode, reg);

      reply	other threads:[~2020-09-10 10:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10  3:44 Kito Cheng
2020-09-10  7:03 ` Richard Biener
2020-09-10  8:18   ` Kito Cheng
2020-09-10  9:09     ` Richard Biener
2020-09-10  9:39       ` Eric Botcazou
2020-09-10 10:04         ` Kito Cheng
2020-09-10 10:05           ` Kito Cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+yXCZA6eABijCur8__O6X8Q9w5V37ZYzguyf8a7RVSiAvPX3g@mail.gmail.com \
    --to=kito.cheng@gmail.com \
    --cc=botcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@sifive.com \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).