public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/8883: Alpha: regalloc too eager to use FP regs on EV6
@ 2002-12-09 14:46 Falk Hueffner
  0 siblings, 0 replies; only message in thread
From: Falk Hueffner @ 2002-12-09 14:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8883
>Category:       optimization
>Synopsis:       Alpha: regalloc too eager to use FP regs on EV6
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 09 14:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Falk Hueffner
>Release:        3.3 20021102 (experimental)
>Organization:
>Environment:
System: Linux juist 2.4.20-rc1 #1 Sun Nov 10 15:01:35 CET 2002 alpha unknown unknown GNU/Linux
Architecture: alpha

	
host: alphaev68-unknown-linux-gnu
build: alphaev68-unknown-linux-gnu
target: alphaev68-unknown-linux-gnu
configured with: ../configure --disable-nls --enable-languages=c++
>Description:
% cat med.c
typedef unsigned long uint64_t;
uint64_t median(uint64_t a, uint64_t b, uint64_t c) {
    return (a < b != b >= c) ? b : ((a < c != c > b) ? c : a);
}

% gcc -c -mcpu=ev6 -O3 med.c && objdump -d med.o
0000000000000000 <median>:
   0:   a4 03 12 42     cmpult  a0,a2,t3
   4:   a1 03 32 42     cmpult  a1,a2,t0
   8:   a3 07 51 42     cmpule  a2,a1,t2
   c:   a6 07 30 42     cmpule  a1,a0,t5
  10:   05 08 81 44     xor     t3,t0,t4
  14:   02 08 c3 44     xor     t5,t2,t1
  18:   92 04 b0 44     cmoveq  t4,a0,a2
  1c:   8a 04 5f 52     itoft   a2,$f10
  20:   01 00 40 f4     bne     t1,28 <median+0x28>
  24:   8a 04 3f 52     itoft   a1,$f10
  28:   00 0e 5f 71     ftoit   $f10,v0
  2c:   01 80 fa 6b     ret

itoft has a latency of 4, and ftoi a latency of 3, so they should
really only be used if it cannot be avoided. (Also, the branch can be
replaced with a cmov, but that's probably more difficult to fix.)

This problem does not occur with -mcpu=ev5, or with -fnew-ra.

	
>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-09 22:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-09 14:46 optimization/8883: Alpha: regalloc too eager to use FP regs on EV6 Falk Hueffner

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