public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] i386: Require TARGET_64BIT for any_mul_highpart peephole
@ 2021-12-23 22:21 H.J. Lu
  2021-12-24  8:17 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2021-12-23 22:21 UTC (permalink / raw)
  To: gcc-patches

Restore i686 bootstrap by requiring TARGET_64BIT for any_mul_highpart
peephole.

	PR bootstrap/103785
	* config/i386/i386.md: Require TARGET_64BIT for any_mul_highpart
	peephole.
---
 gcc/config/i386/i386.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 284b9507466..9d6786c5c2e 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8588,7 +8588,8 @@
 		   (any_mul_highpart:SWI48 (match_dup 2) (match_dup 0)))
 	      (clobber (match_dup 2))
 	      (clobber (reg:CC FLAGS_REG))])]
-  "REGNO (operands[0]) != REGNO (operands[2])
+  "TARGET_64BIT
+   && REGNO (operands[0]) != REGNO (operands[2])
    && REGNO (operands[0]) != REGNO (operands[3])
    && (REGNO (operands[0]) == REGNO (operands[4])
        || peep2_reg_dead_p (3, operands[0]))"
-- 
2.33.1


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

* Re: [PATCH] i386: Require TARGET_64BIT for any_mul_highpart peephole
  2021-12-23 22:21 [PATCH] i386: Require TARGET_64BIT for any_mul_highpart peephole H.J. Lu
@ 2021-12-24  8:17 ` Uros Bizjak
  2021-12-24 21:25   ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2021-12-24  8:17 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches

On Thu, Dec 23, 2021 at 11:21 PM H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Restore i686 bootstrap by requiring TARGET_64BIT for any_mul_highpart
> peephole.
>
>         PR bootstrap/103785
>         * config/i386/i386.md: Require TARGET_64BIT for any_mul_highpart
>         peephole.

I don't think this is correct. The patch uses SWI48, where DImode is
enabled only for TARGET_64BIT. The patch disables SImode peephole only
for 32bit targets, so if there is something wrong with the peephole,
it still remains buggy for 64bit targets. Either we remove problematic
peepholes to restore bootstrap or get a testcase and analyze the
problem to figure out the correct fix.

Uros.

> ---
>  gcc/config/i386/i386.md | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> index 284b9507466..9d6786c5c2e 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -8588,7 +8588,8 @@
>                    (any_mul_highpart:SWI48 (match_dup 2) (match_dup 0)))
>               (clobber (match_dup 2))
>               (clobber (reg:CC FLAGS_REG))])]
> -  "REGNO (operands[0]) != REGNO (operands[2])
> +  "TARGET_64BIT
> +   && REGNO (operands[0]) != REGNO (operands[2])
>     && REGNO (operands[0]) != REGNO (operands[3])
>     && (REGNO (operands[0]) == REGNO (operands[4])
>         || peep2_reg_dead_p (3, operands[0]))"
> --
> 2.33.1
>

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

* Re: [PATCH] i386: Require TARGET_64BIT for any_mul_highpart peephole
  2021-12-24  8:17 ` Uros Bizjak
@ 2021-12-24 21:25   ` H.J. Lu
  0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2021-12-24 21:25 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On Fri, Dec 24, 2021 at 12:17 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Thu, Dec 23, 2021 at 11:21 PM H.J. Lu via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > Restore i686 bootstrap by requiring TARGET_64BIT for any_mul_highpart
> > peephole.
> >
> >         PR bootstrap/103785
> >         * config/i386/i386.md: Require TARGET_64BIT for any_mul_highpart
> >         peephole.
>
> I don't think this is correct. The patch uses SWI48, where DImode is
> enabled only for TARGET_64BIT. The patch disables SImode peephole only
> for 32bit targets, so if there is something wrong with the peephole,
> it still remains buggy for 64bit targets. Either we remove problematic
> peepholes to restore bootstrap or get a testcase and analyze the
> problem to figure out the correct fix.
>

I couldn't create a small testcase in C.   The problem is in

(set (reg:SI 1 dx [92])
     (const_int 714200473 [0x2a91d599]))
(set (reg:SI 0 ax [105])
     (reg:SI 0 ax [orig:89 k ] [89]))
(parallel [
  (set (reg:SI 1 dx [91])
       (smul_highpart:SI (reg:SI 0 ax [105]) (reg:SI 1 dx [92])))
       (clobber (reg:SI 0 ax [105]))
       (clobber (reg:CC 17 flags))
])

The v2 patch is posted at

https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587356.html

-- 
H.J.

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

end of thread, other threads:[~2021-12-24 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23 22:21 [PATCH] i386: Require TARGET_64BIT for any_mul_highpart peephole H.J. Lu
2021-12-24  8:17 ` Uros Bizjak
2021-12-24 21:25   ` H.J. Lu

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