On Tue, Dec 17, 2013 at 6:50 AM, Alan Modra <amo...@gmail.com> wrote:

> Bootstrapped and regression tested powerpc64-linux.  Output of
> pr53199.c inspected for sanity with -mcpu=power{6,7} -m{32,64} and
> {-mlra,}.  OK to apply?
>
> gcc/
>         * config/rs6000/rs6000.md (bswapdi2): Remove one scratch reg.
>         Modify Z->r bswapdi splitter to use dest in place of scratch.
>         In r->Z and Z->r bswapdi splitter rename word_high, word_low
>         to word1, word2 and rearrange logic to suit.
>         (bswapdi2_64bit): Remove early clobber on Z->r alternative.
>         (bswapdi2_ldbrx): Likewise.  Remove '??' on r->r.
>         (bswapdi2_32bit): Remove early clobber on Z->r alternative.
>         Add one '?' on r->r.  Modify Z->r splitter to avoid need for
>         early clobber.
> gcc/testsuite/
>         * gcc.target/powerpc/pr53199.c: Add extra functions.

> @@ -2438,29 +2433,29 @@
>        addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
>      }
>
> +  word1 = change_address (src, SImode, addr1);
> +  word2 = change_address (src, SImode, addr2);
> +
>    if (BYTES_BIG_ENDIAN)
>      {
> -      word_high = change_address (src, SImode, addr1);
> -      word_low  = change_address (src, SImode, addr2);
> +      emit_insn (gen_bswapsi2 (op3_32, word2));
> +      emit_insn (gen_bswapsi2 (dest_32, word1));
>      }
>    else
>      {
> -      word_high = change_address (src, SImode, addr2);
> -      word_low  = change_address (src, SImode, addr1);
> +      emit_insn (gen_bswapsi2 (op3_32, word1));
> +      emit_insn (gen_bswapsi2 (dest_32, word2));
>      }
>
> -  emit_insn (gen_bswapsi2 (op3_32, word_low));
> -  emit_insn (gen_bswapsi2 (op4_32, word_high));
> -  emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
> -  emit_insn (gen_iordi3 (dest, dest, op4));
> +  emit_insn (gen_ashldi3 (op3, op3, GEN_INT (32)));
> +  emit_insn (gen_iordi3 (dest, dest, op3));
>  }")

Why change the code from swapping the words at the initial
change_address() to swapping the words in the call to gen_bswapsi2()?

- David

Reply via email to