public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg
@ 2004-12-15 12:15 uros at kss-loka dot si
2004-12-15 14:13 ` [Bug target/19009] " bangerth at dealii dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: uros at kss-loka dot si @ 2004-12-15 12:15 UTC (permalink / raw)
To: gcc-bugs
This is something I noticed in the build of povray-3.50c, with '-march=pentium4
-mfpmath=387'. Loading of 0.0 into the FP register is quite strange:
8051efb: 66 0f ef c9 pxor %xmm1,%xmm1 <- clear SSE reg
8051eff: f2 0f 11 4c 24 38 movsd %xmm1,0x38(%esp,1) <- move it to stack
8051f05: 89 de mov %ebx,%esi
8051f07: 31 c9 xor %ecx,%ecx
8051f09: dd 03 fldl (%ebx)
8051f0b: d8 cd fmul %st(5),%st
8051f0d: dd 43 08 fldl 0x8(%ebx)
8051f10: d8 cd fmul %st(5),%st
8051f12: de c1 faddp %st,%st(1)
8051f14: dd 43 10 fldl 0x10(%ebx)
8051f17: d8 cc fmul %st(4),%st
8051f19: de c1 faddp %st,%st(1)
8051f1b: d8 c2 fadd %st(2),%st
8051f1d: f2 0f 11 0c 24 movsd %xmm1,(%esp,1) <- move it to stack
8051f22: dd 04 24 fldl (%esp,1) <- load it to FP reg
...
8051f39: dd 44 24 38 fldl 0x38(%esp,1) <- load it to FP reg
8051f3d: df f1 fcomip %st(1),%st
...
This could be implemented by fldz...
Another example of constant loading via XMM reg:
...
805552b: f2 0f 10 05 e0 63 16 movsd 0x81663e0,%xmm0 <- load consant
8055532: 08
8055533: f2 0f 11 44 24 20 movsd %xmm0,0x20(%esp,1) <- move to stack
8055539: dd 44 24 20 fldl 0x20(%esp,1)
805553d: df f1 fcomip %st(1),%st
...
--
Summary: Loading of FP constants into FP reg via SSE reg
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uros at kss-loka dot si
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: pentium4-pc-linux-gnu
GCC host triplet: pentium4-pc-linux-gnu
GCC target triplet: pentium4-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
@ 2004-12-15 14:13 ` bangerth at dealii dot org
2004-12-16 6:28 ` uros at kss-loka dot si
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-12-15 14:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-12-15 14:13 -------
Uros, do you have a testcase?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
2004-12-15 14:13 ` [Bug target/19009] " bangerth at dealii dot org
@ 2004-12-16 6:28 ` uros at kss-loka dot si
2004-12-16 13:50 ` uros at kss-loka dot si
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: uros at kss-loka dot si @ 2004-12-16 6:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uros at kss-loka dot si 2004-12-16 06:28 -------
(In reply to comment #1)
I'm trying to make a testcase out of PovRay sources that trigger this behaviour.
I think that "*movdf_nointeger" is somehow confused and chooses SSE register to
load constant. After that, reload moves SSE reg to FP reg via stack. Perhaps
ix86_preferred_reload_class () needs some fine-tuning regarding to -mfpmath
parameter?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
2004-12-15 14:13 ` [Bug target/19009] " bangerth at dealii dot org
2004-12-16 6:28 ` uros at kss-loka dot si
@ 2004-12-16 13:50 ` uros at kss-loka dot si
2004-12-16 14:36 ` uros at kss-loka dot si
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: uros at kss-loka dot si @ 2004-12-16 13:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uros at kss-loka dot si 2004-12-16 13:50 -------
-finline-functions is needed to trigger the bug with -O2.
The attached testcase should be compiled with '-O2 -march=pentium4 -mfpmath=387
-ffast-math -D__NO_MATH_INLINES -finline-functions' to get:
...
pxor %xmm0, %xmm0
movsd %xmm0, -16(%ebp)
fldl -16(%ebp)
fcomip %st(1), %st
je .L23
fld %st(0)
...
and:
grep xmm zero.s
pxor %xmm0, %xmm0
movsd %xmm0, -16(%ebp)
movsd %xmm0, -16(%ebp)
movsd %xmm0, -16(%ebp)
movsd %xmm0, -16(%ebp)
movsd %xmm0, 8(%edx)
movsd %xmm0, (%edx)
where movsds are followed by:
fldl -16(%ebp)
BTW: "#include <math.h> can be removed from testcase to avoid
-D__NO_MATH_INLINES. Ther result will be the same.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (2 preceding siblings ...)
2004-12-16 13:50 ` uros at kss-loka dot si
@ 2004-12-16 14:36 ` uros at kss-loka dot si
2004-12-27 1:00 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: uros at kss-loka dot si @ 2004-12-16 14:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uros at kss-loka dot si 2004-12-16 14:35 -------
Another candidate for TARGET_SSE_MATH cleanup...
(insn 21 20 22 0 (set (reg:CCFP 17 flags)
(compare:CCFP (reg/v:DF 60 [ mod ])
(reg:DF 70))) 24 {*cmpfp_i_sse} (nil)
(nil))
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|0000-00-00 00:00:00 |2004-12-16 14:35:51
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (3 preceding siblings ...)
2004-12-16 14:36 ` uros at kss-loka dot si
@ 2004-12-27 1:00 ` pinskia at gcc dot gnu dot org
2005-01-07 11:29 ` uros at kss-loka dot si
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-27 1:00 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|WAITING |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|2004-12-16 14:35:51 |2004-12-27 01:00:43
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (4 preceding siblings ...)
2004-12-27 1:00 ` pinskia at gcc dot gnu dot org
@ 2005-01-07 11:29 ` uros at kss-loka dot si
2005-01-12 2:49 ` rth at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: uros at kss-loka dot si @ 2005-01-07 11:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uros at kss-loka dot si 2005-01-07 11:29 -------
This bugreport shows similar problem for x87 code as PR 19252 shoes for SSE
code. The cause of both probems is described in
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00394.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (5 preceding siblings ...)
2005-01-07 11:29 ` uros at kss-loka dot si
@ 2005-01-12 2:49 ` rth at gcc dot gnu dot org
2005-01-14 0:55 ` rth at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-01-12 2:49 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2004-12-27 01:00:43 |2005-01-12 02:49:20
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (6 preceding siblings ...)
2005-01-12 2:49 ` rth at gcc dot gnu dot org
@ 2005-01-14 0:55 ` rth at gcc dot gnu dot org
2005-01-14 0:56 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-01-14 0:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2005-01-14 00:55 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (7 preceding siblings ...)
2005-01-14 0:55 ` rth at gcc dot gnu dot org
@ 2005-01-14 0:56 ` pinskia at gcc dot gnu dot org
2005-01-14 13:08 ` uros at kss-loka dot si
2005-01-14 13:16 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 0:56 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (8 preceding siblings ...)
2005-01-14 0:56 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 13:08 ` uros at kss-loka dot si
2005-01-14 13:16 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: uros at kss-loka dot si @ 2005-01-14 13:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uros at kss-loka dot si 2005-01-14 13:08 -------
It looks that the problem with FP compares forcing constant into wrong register
part of this bug is solved. However, register allocator can still be confused
when a variable is initialized to constant value:
grep fldz povray_dump.sse | wc -l
117
grep fld1 povray_dump.sse | wc -l
141
grep pxor povray_dump.387 | wc -l
20
I'll try to provide a small testcase. The testcase (zero.c) attached to this
bugreport is fixed, but anyway I suggest that we reopen this bug.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19009] Loading of FP constants into FP reg via SSE reg
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
` (9 preceding siblings ...)
2005-01-14 13:08 ` uros at kss-loka dot si
@ 2005-01-14 13:16 ` pinskia at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 13:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-14 13:16 -------
(In reply to comment #8)
> It looks that the problem with FP compares forcing constant into wrong register
> part of this bug is solved. However, register allocator can still be confused
> when a variable is initialized to constant value:
Can you open a new one with the full testcase, since this is the register allocator being dumb which is
usual in GCC.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19009
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-01-14 13:16 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15 12:15 [Bug target/19009] New: Loading of FP constants into FP reg via SSE reg uros at kss-loka dot si
2004-12-15 14:13 ` [Bug target/19009] " bangerth at dealii dot org
2004-12-16 6:28 ` uros at kss-loka dot si
2004-12-16 13:50 ` uros at kss-loka dot si
2004-12-16 14:36 ` uros at kss-loka dot si
2004-12-27 1:00 ` pinskia at gcc dot gnu dot org
2005-01-07 11:29 ` uros at kss-loka dot si
2005-01-12 2:49 ` rth at gcc dot gnu dot org
2005-01-14 0:55 ` rth at gcc dot gnu dot org
2005-01-14 0:56 ` pinskia at gcc dot gnu dot org
2005-01-14 13:08 ` uros at kss-loka dot si
2005-01-14 13:16 ` pinskia at gcc dot gnu dot 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).