public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: gcc-gnats@gcc.gnu.org
Subject: optimization/8883: Alpha: regalloc too eager to use FP regs on EV6
Date: Mon, 09 Dec 2002 14:46:00 -0000	[thread overview]
Message-ID: <E18LWai-0004uk-00@juist> (raw)


>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:


                 reply	other threads:[~2002-12-09 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18LWai-0004uk-00@juist \
    --to=falk.hueffner@student.uni-tuebingen.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).