public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/44532] New: x86-64 unnecessary parameter extension
@ 2010-06-14 7:22 astrange at ithinksw dot com
2010-06-14 8:02 ` [Bug target/44532] " jakub at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: astrange at ithinksw dot com @ 2010-06-14 7:22 UTC (permalink / raw)
To: gcc-bugs
Source:
int f1(short a, int b)
{
return a * b;
}
int f2(unsigned short a, int b)
{
return a * b;
}
> gcc -O3 -fomit-frame-pointer -S paramext.c
_f1:
LFB0:
movl %esi, %eax
movswl %di, %edi <-
imull %edi, %eax
ret
...
_f2:
LFB1:
movl %esi, %eax
movzwl %di, %edi <-
imull %edi, %eax
ret
AFAIK integer parameters should already be extended to int, so those
instructions are redundant. llvm doesn't generate them.
--
Summary: x86-64 unnecessary parameter extension
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: astrange at ithinksw dot com
GCC host triplet: x86_64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44532
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/44532] x86-64 unnecessary parameter extension
2010-06-14 7:22 [Bug target/44532] New: x86-64 unnecessary parameter extension astrange at ithinksw dot com
@ 2010-06-14 8:02 ` jakub at gcc dot gnu dot org
2010-06-14 11:30 ` rguenth at gcc dot gnu dot org
2010-06-15 0:57 ` hjl dot tools at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-06-14 8:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2010-06-14 08:01 -------
tempreg = convert_to_mode (data->nominal_mode, tempreg, unsignedp);
if (GET_CODE (tempreg) == SUBREG
&& GET_MODE (tempreg) == data->nominal_mode
&& REG_P (SUBREG_REG (tempreg))
&& data->nominal_mode == data->passed_mode
&& GET_MODE (SUBREG_REG (tempreg)) == GET_MODE (data->entry_parm)
&& GET_MODE_SIZE (GET_MODE (tempreg))
< GET_MODE_SIZE (GET_MODE (data->entry_parm)))
{
/* The argument is already sign/zero extended, so note it
into the subreg. */
SUBREG_PROMOTED_VAR_P (tempreg) = 1;
SUBREG_PROMOTED_UNSIGNED_SET (tempreg, unsignedp);
}
For x86_64 and short/char, all the conditions above are true except that
nominal_mode (HImode) != passed_mode (SImode).
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44532
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/44532] x86-64 unnecessary parameter extension
2010-06-14 7:22 [Bug target/44532] New: x86-64 unnecessary parameter extension astrange at ithinksw dot com
2010-06-14 8:02 ` [Bug target/44532] " jakub at gcc dot gnu dot org
@ 2010-06-14 11:30 ` rguenth at gcc dot gnu dot org
2010-06-15 0:57 ` hjl dot tools at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-14 11:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2010-06-14 11:30 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC target triplet| |x86-64-*-*, i?86-*-*
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2010-06-14 11:30:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44532
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/44532] x86-64 unnecessary parameter extension
2010-06-14 7:22 [Bug target/44532] New: x86-64 unnecessary parameter extension astrange at ithinksw dot com
2010-06-14 8:02 ` [Bug target/44532] " jakub at gcc dot gnu dot org
2010-06-14 11:30 ` rguenth at gcc dot gnu dot org
@ 2010-06-15 0:57 ` hjl dot tools at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-15 0:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from hjl dot tools at gmail dot com 2010-06-15 00:57 -------
We should consider:
1. The x86-64 psABI doesn't say how char/short should be extended
as function parameters.
2. Gcc may not touch upper bits, PR 42324.
3. Gcc never depends on the upper bits which are properly extended
in function parameters.
4. Icc may not touch the upper bits in function parameters on stack.
5. For a function without proper prototype, caller may not properly
extend function parameters.
I think the current way is safer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44532
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-15 0:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-14 7:22 [Bug target/44532] New: x86-64 unnecessary parameter extension astrange at ithinksw dot com
2010-06-14 8:02 ` [Bug target/44532] " jakub at gcc dot gnu dot org
2010-06-14 11:30 ` rguenth at gcc dot gnu dot org
2010-06-15 0:57 ` hjl dot tools at gmail dot com
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).