diff mbox

Fix -Wmaybe-uninitialized warning on sse.md (PR target/81151)

Message ID 20170621182727.GU2123@tucnak
State New
Headers show

Commit Message

Jakub Jelinek June 21, 2017, 6:27 p.m. UTC
Hi!

This expander has a gap in between the operands and match_dup indexes,
which results in genemit generating:
    operand2 = operands[2];
    (void) operand2;
where operands[2] has not been initialized.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2017-06-21  Jakub Jelinek  <jakub@redhat.com>

	PR target/81151
	* config/i386/sse.md (round<mode>2): Renumber match_dup and
	operands indexes to avoid gap between operands and match_dups.


	Jakub

Comments

Uros Bizjak June 21, 2017, 7:33 p.m. UTC | #1
On Wed, Jun 21, 2017 at 8:27 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> This expander has a gap in between the operands and match_dup indexes,
> which results in genemit generating:
>     operand2 = operands[2];
>     (void) operand2;
> where operands[2] has not been initialized.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2017-06-21  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/81151
>         * config/i386/sse.md (round<mode>2): Renumber match_dup and
>         operands indexes to avoid gap between operands and match_dups.

OK for mainline and release branches.

Thanks,
Uros.

> --- gcc/config/i386/sse.md.jj   2017-05-24 11:59:06.000000000 +0200
> +++ gcc/config/i386/sse.md      2017-06-21 14:10:02.768078833 +0200
> @@ -15638,13 +15638,13 @@ (define_insn "sse4_1_round<ssescalarmode
>     (set_attr "mode" "<MODE>")])
>
>  (define_expand "round<mode>2"
> -  [(set (match_dup 4)
> +  [(set (match_dup 3)
>         (plus:VF
>           (match_operand:VF 1 "register_operand")
> -         (match_dup 3)))
> +         (match_dup 2)))
>     (set (match_operand:VF 0 "register_operand")
>         (unspec:VF
> -         [(match_dup 4) (match_dup 5)]
> +         [(match_dup 3) (match_dup 4)]
>           UNSPEC_ROUND))]
>    "TARGET_ROUND && !flag_trapping_math"
>  {
> @@ -15664,11 +15664,11 @@ (define_expand "round<mode>2"
>    vec_half = ix86_build_const_vector (<MODE>mode, true, half);
>    vec_half = force_reg (<MODE>mode, vec_half);
>
> -  operands[3] = gen_reg_rtx (<MODE>mode);
> -  emit_insn (gen_copysign<mode>3 (operands[3], vec_half, operands[1]));
> +  operands[2] = gen_reg_rtx (<MODE>mode);
> +  emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
>
> -  operands[4] = gen_reg_rtx (<MODE>mode);
> -  operands[5] = GEN_INT (ROUND_TRUNC);
> +  operands[3] = gen_reg_rtx (<MODE>mode);
> +  operands[4] = GEN_INT (ROUND_TRUNC);
>  })
>
>  (define_expand "round<mode>2_sfix"
>
>         Jakub
diff mbox

Patch

--- gcc/config/i386/sse.md.jj	2017-05-24 11:59:06.000000000 +0200
+++ gcc/config/i386/sse.md	2017-06-21 14:10:02.768078833 +0200
@@ -15638,13 +15638,13 @@  (define_insn "sse4_1_round<ssescalarmode
    (set_attr "mode" "<MODE>")])
 
 (define_expand "round<mode>2"
-  [(set (match_dup 4)
+  [(set (match_dup 3)
 	(plus:VF
 	  (match_operand:VF 1 "register_operand")
-	  (match_dup 3)))
+	  (match_dup 2)))
    (set (match_operand:VF 0 "register_operand")
 	(unspec:VF
-	  [(match_dup 4) (match_dup 5)]
+	  [(match_dup 3) (match_dup 4)]
 	  UNSPEC_ROUND))]
   "TARGET_ROUND && !flag_trapping_math"
 {
@@ -15664,11 +15664,11 @@  (define_expand "round<mode>2"
   vec_half = ix86_build_const_vector (<MODE>mode, true, half);
   vec_half = force_reg (<MODE>mode, vec_half);
 
-  operands[3] = gen_reg_rtx (<MODE>mode);
-  emit_insn (gen_copysign<mode>3 (operands[3], vec_half, operands[1]));
+  operands[2] = gen_reg_rtx (<MODE>mode);
+  emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
 
-  operands[4] = gen_reg_rtx (<MODE>mode);
-  operands[5] = GEN_INT (ROUND_TRUNC);
+  operands[3] = gen_reg_rtx (<MODE>mode);
+  operands[4] = GEN_INT (ROUND_TRUNC);
 })
 
 (define_expand "round<mode>2_sfix"