On Mon, Dec 2, 2019 at 10:06 AM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Mon, Dec 02, 2019 at 08:28:27AM +0100, Uros Bizjak wrote:
> > > I'll have a look tomorrow.
> >
> > general_reg_operand should be used in the pattern.
>
> That indeed works, ok for trunk if it passes bootstrap/regtest?
>
> 2019-12-02  Uroš Bizjak  <ubiz...@gmail.com>
>             Jakub Jelinek  <ja...@redhat.com>
>
>         PR target/92744
>         * config/i386/i386.md (peephole2 for *swap<mode>): Use
>         general_reg_operand predicates instead of register_operand.
>
>         * g++.dg/dfp/pr92744.C: New test.

OK.

Thanks,
Uros.

> --- gcc/config/i386/i386.md.jj  2019-11-19 10:28:18.187668272 +0100
> +++ gcc/config/i386/i386.md     2019-12-02 09:55:04.989644441 +0100
> @@ -2788,10 +2788,10 @@ (define_insn "*swap<mode>"
>     (set_attr "bdver1_decode" "double")])
>
>  (define_peephole2
> -  [(set (match_operand:SWI 0 "register_operand")
> -       (match_operand:SWI 1 "register_operand"))
> +  [(set (match_operand:SWI 0 "general_reg_operand")
> +       (match_operand:SWI 1 "general_reg_operand"))
>     (set (match_dup 1)
> -       (match_operand:SWI 2 "register_operand"))
> +       (match_operand:SWI 2 "general_reg_operand"))
>     (set (match_dup 2) (match_dup 0))]
>    "peep2_reg_dead_p (3, operands[0])
>     && optimize_insn_for_size_p ()"
> --- gcc/testsuite/g++.dg/dfp/pr92744.C.jj       2019-12-02 10:01:04.133064486 
> +0100
> +++ gcc/testsuite/g++.dg/dfp/pr92744.C  2019-12-02 10:00:31.577571093 +0100
> @@ -0,0 +1,20 @@
> +// PR target/92744
> +// { dg-do compile }
> +// { dg-options "-Os -fno-tree-ccp" }
> +
> +typedef float T __attribute__((mode(SD)));
> +struct A { T a; };
> +void foo ();
> +
> +bool
> +operator!= (A x, A y)
> +{
> +  return x.a != y.a;
> +}
> +
> +void
> +bar (A x, A y)
> +{
> +  if (x != y)
> +    foo ();
> +}
>
>
>         Jakub
>

Reply via email to