diff mbox series

arc: Fix for new ifcvt behavior [PR104154]

Message ID bd94bd06-3855-5948-c726-92e2ca82de91@linux.ibm.com
State New
Headers show
Series arc: Fix for new ifcvt behavior [PR104154] | expand

Commit Message

Robin Dapp Feb. 21, 2022, 7:56 a.m. UTC
Hi,

I figured I'd just go ahead and post this patch as well since it seems
to have fixed the arc build problems.

It would be nice if someone could bootstrap/regtest if Jeff hasn't
already done so.  I was able to verify that the two testcases attached
to the PR build cleanly but not much more.  Thank you.

Regards
 Robin

--

        PR104154

gcc/ChangeLog:

        * config/arc/arc.cc (gen_compare_reg):  Return the CC-mode
        comparison ifcvt passed us.

---

From fa98a40abd55e3a10653f6a8c5b2414a2025103b Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp@linux.ibm.com>
Date: Mon, 7 Feb 2022 08:39:41 +0100
Subject: [PATCH] arc: Fix for new ifcvt behavior [PR104154]

ifcvt now passes a CC-mode "comparison" to backends.  This patch
simply returns from gen_compare_reg () in that case since nothing
needs to be prepared anymore.

	PR104154

gcc/ChangeLog:

	* config/arc/arc.cc (gen_compare_reg):  Return the CC-mode
	comparison ifcvt passed us.
---
 gcc/config/arc/arc.cc | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Claudiu Zissulescu Feb. 28, 2022, 12:44 p.m. UTC | #1
Hi Robin,

The patch looks good. Please go ahead and merge it, please let me know if
you cannot.

Thank you,
Claudiu

On Mon, Feb 21, 2022 at 9:57 AM Robin Dapp via Gcc-patches <
gcc-patches@gcc.gnu.org> wrote:

> Hi,
>
> I figured I'd just go ahead and post this patch as well since it seems
> to have fixed the arc build problems.
>
> It would be nice if someone could bootstrap/regtest if Jeff hasn't
> already done so.  I was able to verify that the two testcases attached
> to the PR build cleanly but not much more.  Thank you.
>
> Regards
>  Robin
>
> --
>
>         PR104154
>
> gcc/ChangeLog:
>
>         * config/arc/arc.cc (gen_compare_reg):  Return the CC-mode
>         comparison ifcvt passed us.
>
> ---
>
> From fa98a40abd55e3a10653f6a8c5b2414a2025103b Mon Sep 17 00:00:00 2001
> From: Robin Dapp <rdapp@linux.ibm.com>
> Date: Mon, 7 Feb 2022 08:39:41 +0100
> Subject: [PATCH] arc: Fix for new ifcvt behavior [PR104154]
>
> ifcvt now passes a CC-mode "comparison" to backends.  This patch
> simply returns from gen_compare_reg () in that case since nothing
> needs to be prepared anymore.
>
>         PR104154
>
> gcc/ChangeLog:
>
>         * config/arc/arc.cc (gen_compare_reg):  Return the CC-mode
>         comparison ifcvt passed us.
> ---
>  gcc/config/arc/arc.cc | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
> index 8cc173519ab..5e40ec2c04d 100644
> --- a/gcc/config/arc/arc.cc
> +++ b/gcc/config/arc/arc.cc
> @@ -2254,6 +2254,12 @@ gen_compare_reg (rtx comparison, machine_mode omode)
>
>
>    cmode = GET_MODE (x);
> +
> +  /* If ifcvt passed us a MODE_CC comparison we can
> +     just return it.  It should be in the proper form already.   */
> +  if (GET_MODE_CLASS (cmode) == MODE_CC)
> +    return comparison;
> +
>    if (cmode == VOIDmode)
>      cmode = GET_MODE (y);
>    gcc_assert (cmode == SImode || cmode == SFmode || cmode == DFmode);
> --
> 2.31.1
>
>
Robin Dapp March 1, 2022, 8:06 a.m. UTC | #2
Hi Claudiu,

> The patch looks good. Please go ahead and merge it, please let me know if
> you cannot.

I merged the patch leaving your check

  if (cmode != SImode && cmode != SFmode && cmode != DFmode)


    return NULL_RTX;

in place.  It is not strictly necessary anymore but I figured it also
kind of documents the preconditions of the code that follows.

Regards
 Robin
diff mbox series

Patch

diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
index 8cc173519ab..5e40ec2c04d 100644
--- a/gcc/config/arc/arc.cc
+++ b/gcc/config/arc/arc.cc
@@ -2254,6 +2254,12 @@  gen_compare_reg (rtx comparison, machine_mode omode)


   cmode = GET_MODE (x);
+
+  /* If ifcvt passed us a MODE_CC comparison we can
+     just return it.  It should be in the proper form already.   */
+  if (GET_MODE_CLASS (cmode) == MODE_CC)
+    return comparison;
+
   if (cmode == VOIDmode)
     cmode = GET_MODE (y);
   gcc_assert (cmode == SImode || cmode == SFmode || cmode == DFmode);