This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/8883: Alpha: regalloc too eager to use FP regs on EV6
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Mon, 09 Dec 2002 23:41:32 +0100
- Subject: optimization/8883: Alpha: regalloc too eager to use FP regs on EV6
>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: