public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Fix a mistake in cstore_si_as_di (PR68865, PR68879)
@ 2015-12-14  7:04 Segher Boessenkool
  2015-12-14  7:28 ` Segher Boessenkool
  2015-12-14 13:27 ` David Edelsohn
  0 siblings, 2 replies; 3+ messages in thread
From: Segher Boessenkool @ 2015-12-14  7:04 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool

convert_move does not know how to zero-extend a constant integer to the
target mode -- simply because it does not know the target mode.  As a
result, 32-bit SImode with the high bit set would be effectively sign-
extended instead of zero-extended.

This patch fixes it.  Is this okay for trunk?  (bootstrap+regtest in
progress, on powerpc64-linux).


Segher


2015-12-14  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/68865
	PR target/68879
	* rs6000.md (cstore_si_as_di): Force all operands into registers.

---
 gcc/config/rs6000/rs6000.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index e2dca1b..f962f04 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10618,6 +10618,8 @@ (define_expand "cstore_si_as_di"
   int uns_flag = unsigned_comparison_operator (operands[1], VOIDmode) ? 1 : 0;
   enum rtx_code cond_code = signed_condition (GET_CODE (operands[1]));
 
+  operands[2] = force_reg (SImode, operands[2]);
+  operands[3] = force_reg (SImode, operands[3]);
   rtx op1 = gen_reg_rtx (DImode);
   rtx op2 = gen_reg_rtx (DImode);
   convert_move (op1, operands[2], uns_flag);
-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rs6000: Fix a mistake in cstore_si_as_di (PR68865, PR68879)
  2015-12-14  7:04 [PATCH] rs6000: Fix a mistake in cstore_si_as_di (PR68865, PR68879) Segher Boessenkool
@ 2015-12-14  7:28 ` Segher Boessenkool
  2015-12-14 13:27 ` David Edelsohn
  1 sibling, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2015-12-14  7:28 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc

On Mon, Dec 14, 2015 at 07:04:06AM +0000, Segher Boessenkool wrote:
> convert_move does not know how to zero-extend a constant integer to the
> target mode -- simply because it does not know the target mode.

That last "target" should be "source", of course.


Segher

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rs6000: Fix a mistake in cstore_si_as_di (PR68865, PR68879)
  2015-12-14  7:04 [PATCH] rs6000: Fix a mistake in cstore_si_as_di (PR68865, PR68879) Segher Boessenkool
  2015-12-14  7:28 ` Segher Boessenkool
@ 2015-12-14 13:27 ` David Edelsohn
  1 sibling, 0 replies; 3+ messages in thread
From: David Edelsohn @ 2015-12-14 13:27 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches

On Mon, Dec 14, 2015 at 2:04 AM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> convert_move does not know how to zero-extend a constant integer to the
> target mode -- simply because it does not know the target mode.  As a
> result, 32-bit SImode with the high bit set would be effectively sign-
> extended instead of zero-extended.
>
> This patch fixes it.  Is this okay for trunk?  (bootstrap+regtest in
> progress, on powerpc64-linux).
>
>
> Segher
>
>
> 2015-12-14  Segher Boessenkool  <segher@kernel.crashing.org>
>
>         PR target/68865
>         PR target/68879
>         * rs6000.md (cstore_si_as_di): Force all operands into registers.

Okay.

Thanks, David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-14 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14  7:04 [PATCH] rs6000: Fix a mistake in cstore_si_as_di (PR68865, PR68879) Segher Boessenkool
2015-12-14  7:28 ` Segher Boessenkool
2015-12-14 13:27 ` David Edelsohn

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).