public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion
@ 2021-10-13 21:08 gabravier at gmail dot com
2021-10-13 21:25 ` [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return) pinskia at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: gabravier at gmail dot com @ 2021-10-13 21:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Bug ID: 102737
Summary: [x86] Failure to optimize out bad register usage
involving int->double conversion
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
double foo(int s, double a)
{
return s + a;
}
With -O3, GCC outputs this on AMD64:
foo(int, double):
movapd xmm1, xmm0
pxor xmm0, xmm0
cvtsi2sd xmm0, edi
addsd xmm0, xmm1
ret
LLVM outputs this:
foo(int, double):
cvtsi2sd xmm1, edi
addsd xmm0, xmm1
ret
The movapd in GCC's version can be optimized out.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return)
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
@ 2021-10-13 21:25 ` pinskia at gcc dot gnu.org
2021-10-13 21:27 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-13 21:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |9.5
Known to fail| |10.1.0, 9.1.0
Severity|normal |enhancement
Known to work| |5.1.0, 8.1.0, 8.5.0
Summary|[x86] Failure to optimize |[9/10/11/12 Regression]
|out bad register usage |extra mov with int->double
|involving int->double |conversion and addition
|conversion |(incoming arguments and
| |return)
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 8.5.0 (and before) would do:
pxor %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
addsd %xmm1, %xmm0
ret
So this is a regression.
Even with AVX, gcc has an extra move even if inputs don't have to be tied to
the output:
vmovsd %xmm0, %xmm0, %xmm1
vxorps %xmm0, %xmm0, %xmm0
vcvtsi2sdl %edi, %xmm0, %xmm0
vaddsd %xmm1, %xmm0, %xmm0
ret
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return)
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
2021-10-13 21:25 ` [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return) pinskia at gcc dot gnu.org
@ 2021-10-13 21:27 ` pinskia at gcc dot gnu.org
2022-01-19 8:55 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-13 21:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-10-13
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Severity|enhancement |minor
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I think this might not be an important regression either because I suspect
it has to do with function arguments so this would be a micro-benchmark really
rather than hitting real code.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return)
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
2021-10-13 21:25 ` [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return) pinskia at gcc dot gnu.org
2021-10-13 21:27 ` pinskia at gcc dot gnu.org
@ 2022-01-19 8:55 ` rguenth at gcc dot gnu.org
2022-05-27 9:46 ` [Bug target/102737] [10/11/12/13 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-19 8:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/102737] [10/11/12/13 Regression] extra mov with int->double conversion and addition (incoming arguments and return)
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
` (2 preceding siblings ...)
2022-01-19 8:55 ` rguenth at gcc dot gnu.org
@ 2022-05-27 9:46 ` rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug target/102737] [11/12/13/14 " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/102737] [10/11/12/13 Regression] extra mov with int->double conversion and addition (incoming arguments and return)
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
` (3 preceding siblings ...)
2022-05-27 9:46 ` [Bug target/102737] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug target/102737] [11/12/13/14 " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/102737] [11/12/13/14 Regression] extra mov with int->double conversion and addition (incoming arguments and return)
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
` (4 preceding siblings ...)
2022-06-28 10:46 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:41 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102737
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-07 10:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 21:08 [Bug target/102737] New: [x86] Failure to optimize out bad register usage involving int->double conversion gabravier at gmail dot com
2021-10-13 21:25 ` [Bug target/102737] [9/10/11/12 Regression] extra mov with int->double conversion and addition (incoming arguments and return) pinskia at gcc dot gnu.org
2021-10-13 21:27 ` pinskia at gcc dot gnu.org
2022-01-19 8:55 ` rguenth at gcc dot gnu.org
2022-05-27 9:46 ` [Bug target/102737] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug target/102737] [11/12/13/14 " rguenth at gcc dot gnu.org
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).