diff mbox

[RS6000] Fix PR66033, nop pattern

Message ID 20150506122223.GF6140@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra May 6, 2015, 12:22 p.m. UTC
Using a plain [(const_int 0)] for a nop pattern apparently no longer
survives optimization.  rtl_dce deletes these nops.  This patch uses
an unspec so that explicitly inserted nops are kept.
Fixing that revealed a number of patterns and splitters that
accidentally inserted [(const_int 0)] insns into rtl.

Bootstrapped and regression tested powerpc64-linux and
powerpc64le-linux.  OK for mainline?

	PR target/66033
	* config/rs6000/rs6000.md (nop): Use an unspec pattern.
	(UNSPEC_NOP): Define.
	(reload_vsx_from_gpr<mode>): Add missing DONE.
	(reload_gpr_from_vsx<mode>): Likewise.
	* config/rs6000/vsx.md (vsx_mul_v2di): Likewise.
	(vsx_div_v2di, vsx_udiv_v2di): Likewise.

Comments

David Edelsohn May 6, 2015, 12:53 p.m. UTC | #1
On Wed, May 6, 2015 at 8:22 AM, Alan Modra <amodra@gmail.com> wrote:
> Using a plain [(const_int 0)] for a nop pattern apparently no longer
> survives optimization.  rtl_dce deletes these nops.  This patch uses
> an unspec so that explicitly inserted nops are kept.
> Fixing that revealed a number of patterns and splitters that
> accidentally inserted [(const_int 0)] insns into rtl.
>
> Bootstrapped and regression tested powerpc64-linux and
> powerpc64le-linux.  OK for mainline?
>
>         PR target/66033
>         * config/rs6000/rs6000.md (nop): Use an unspec pattern.
>         (UNSPEC_NOP): Define.
>         (reload_vsx_from_gpr<mode>): Add missing DONE.
>         (reload_gpr_from_vsx<mode>): Likewise.
>         * config/rs6000/vsx.md (vsx_mul_v2di): Likewise.
>         (vsx_div_v2di, vsx_udiv_v2di): Likewise.

Okay.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	(revision 222842)
+++ gcc/config/rs6000/rs6000.md	(working copy)
@@ -121,6 +121,7 @@ 
    UNSPEC_LFIWAX
    UNSPEC_LFIWZX
    UNSPEC_FCTIWUZ
+   UNSPEC_NOP
    UNSPEC_GRP_END_NOP
    UNSPEC_P8V_FMRGOW
    UNSPEC_P8V_MTVSRWZ
@@ -8796,6 +8797,7 @@ 
   emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
   emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
   emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
+  DONE;
 }
   [(set_attr "length" "12")
    (set_attr "type" "three")])
@@ -8872,6 +8874,7 @@ 
   emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
   emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
   emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
+  DONE;
 }
   [(set_attr "length" "12")
    (set_attr "type" "three")])
@@ -12888,7 +12891,7 @@ 
   [(set_attr "type" "jmpreg")])
 
 (define_insn "nop"
-  [(const_int 0)]
+  [(unspec [(const_int 0)] UNSPEC_NOP)]
   ""
   "nop")
 
Index: gcc/config/rs6000/vsx.md
===================================================================
--- gcc/config/rs6000/vsx.md	(revision 222842)
+++ gcc/config/rs6000/vsx.md	(working copy)
@@ -780,6 +780,7 @@ 
   emit_insn (gen_vsx_extract_v2di (op4, op2, GEN_INT (1)));
   emit_insn (gen_muldi3 (op3, op3, op4));
   emit_insn (gen_vsx_concat_v2di (op0, op5, op3));
+  DONE;
 }"
   [(set_attr "type" "mul")])
 
@@ -817,6 +818,7 @@ 
   emit_insn (gen_vsx_extract_v2di (op4, op2, GEN_INT (1)));
   emit_insn (gen_divdi3 (op3, op3, op4));
   emit_insn (gen_vsx_concat_v2di (op0, op5, op3));
+  DONE;
 }"
   [(set_attr "type" "div")])
 
@@ -844,6 +846,7 @@ 
   emit_insn (gen_vsx_extract_v2di (op4, op2, GEN_INT (1)));
   emit_insn (gen_udivdi3 (op3, op3, op4));
   emit_insn (gen_vsx_concat_v2di (op0, op5, op3));
+  DONE;
 }"
   [(set_attr "type" "div")])