This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Withdrawing my last synth_mult patch


Hi,

I'd like to withdraw the following patch:

  [patch] expmed.c: Speed up synth_mult further.
  http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01384.html

because I see a small diffrence in code generation on alpha.

Consider

int
m34 (int a)
{
  return a * 34;
}

Without my patch, I get

  sll $16,5,$1     ; $1 = $16 << 5
  addq $16,$16,$0  ; $0 = $16 << 1
  addl $0,$1,$0    ; $0 = $0 + $1

In other words, we are doing (a * 32) + (a * 2)

With my patch, I get

  sll $16,4,$0     ; $0 = $16 << 4
  addq $0,$16,$0   ; $0 = $0 + $16
  addl $0,$0,$0    ; $0 = $0 + $0

In other words, we are doing ((a * 16) + a) * 2

It turns out that both have the same cost, but they do not have the
same latency.  Roger Sayle's latency code prefers the former sequence.

We could still use my method to compute the cost of a synthesized
multiplication, see if it beats the cost of a multiplication
instruction, and terminate some searches more quickly, but I doubt
that's worth the trouble.

Kazu Hirata


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]