gcc-patches@gcc.gnu.org
[Top] [All Lists]

Re: [PATCH] Fix PR37053: Move tweaks of commutative precedence to targe

Subject: Re: [PATCH] Fix PR37053: Move tweaks of commutative precedence to target hook
From: Maxim Kuvyrkov
Date: Mon, 29 Jun 2009 16:41:40 +0400
Maxim Kuvyrkov wrote:
Luis Machado wrote:

...

I gave it a try with Maxim's patch from ticket #37053 and it degraded
performance pretty badly (> 30%), and galgel degraded more than 75%.
Both 32-bit and 64-bit saw degradations.

The patch in PR37053 is the one adding target hook. This patch should not affect the generated code at all. If it does, can you please send the the difference in dumps? I understand that this patch does not seem to be a favorite here, but I'm curious where I've made a mistake.

The mistake is in rs6000_commutative_operand_precedence(); the precedence value should be decrement for everything but the pointers, current code does exactly the opposite.

The hook implementation should be:

static int
rs6000_commutative_operand_precedence (const_rtx op, int value)
{
  /* Prefer pointer objects over non pointer objects.
     For rationale see PR28690.  */
  if (GET_RTX_CLASS (GET_CODE (op)) == RTX_OBJ
      && ((REG_P (op) && REG_POINTER (op))
          || (MEM_P (op) && MEM_POINTER (op))))
    /* value = -1 */;
  else
    /* value = -2 */
    --value;

  return value;
}

--
Maxim

<Prev in Thread] Current Thread [Next in Thread>