public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/24333] New: missed div optimizations?
@ 2005-10-12 15:39 pluto at agmk dot net
2005-10-12 15:42 ` [Bug tree-optimization/24333] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2005-10-12 15:39 UTC (permalink / raw)
To: gcc-bugs
unsigned foo(const unsigned x) { return (x / x); }
double bar(const double x) { return (x / x); }
$ gcc -Wall -O2 -mregparm=3 -fomit-frame-pointer tmp.c -S
foo: xorl %edx, %edx
divl %eax
ret
bar: fldl 4(%esp)
fdiv %st(0), %st
ret
I think optimizer should return 1 for both cases.
--
Summary: missed div optimizations?
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
GCC build triplet: i686-pld-linux
GCC host triplet: i686-pld-linux
GCC target triplet: i686-pld-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations?
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
@ 2005-10-12 15:42 ` pinskia at gcc dot gnu dot org
2005-10-12 15:57 ` pluto at agmk dot net
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-12 15:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-10-12 15:42 -------
(In reply to comment #0)
This one, we have to deal with x = 0, what should we do, trap or not to trap.
> unsigned foo(const unsigned x) { return (x / x); }
For the following one:
> double bar(const double x) { return (x / x); }
Only with -ffast-math.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations?
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
2005-10-12 15:42 ` [Bug tree-optimization/24333] " pinskia at gcc dot gnu dot org
@ 2005-10-12 15:57 ` pluto at agmk dot net
2005-10-12 16:04 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2005-10-12 15:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pluto at agmk dot net 2005-10-12 15:57 -------
basing on the http://en.wikipedia.org/wiki/L'hospital we get:
lim (x / x) = lim (x' / x') = lim (1 / 1) = 1
x->0 x->0 x->0
should we trap/check anything?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations?
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
2005-10-12 15:42 ` [Bug tree-optimization/24333] " pinskia at gcc dot gnu dot org
2005-10-12 15:57 ` pluto at agmk dot net
@ 2005-10-12 16:04 ` pinskia at gcc dot gnu dot org
2005-12-30 18:33 ` [Bug tree-optimization/24333] missed div optimizations pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-12 16:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2005-10-12 16:04 -------
(In reply to comment #2)
> basing on the http://en.wikipedia.org/wiki/L'hospital we get:
>
> lim (x / x) = lim (x' / x') = lim (1 / 1) = 1
> x->0 x->0 x->0
for float/float, we should get NANs with -ffast-math which assumes
-ffinite-math, for long/long and unsigned/unsigned, we have this thing called
undefinedness. BUT for java, 0/0 is defined to throw IIRC so we can only do
that for signed/signed and with -fno-wrapv.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
` (2 preceding siblings ...)
2005-10-12 16:04 ` pinskia at gcc dot gnu dot org
@ 2005-12-30 18:33 ` pinskia at gcc dot gnu dot org
2006-04-08 1:41 ` pinskia at gcc dot gnu dot org
2007-03-19 9:15 ` pluto at agmk dot net
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-30 18:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2005-12-30 18:33 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2005-12-30 18:33:47
date| |
Summary|missed div optimizations? |missed div optimizations
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
` (3 preceding siblings ...)
2005-12-30 18:33 ` [Bug tree-optimization/24333] missed div optimizations pinskia at gcc dot gnu dot org
@ 2006-04-08 1:41 ` pinskia at gcc dot gnu dot org
2007-03-19 9:15 ` pluto at agmk dot net
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-08 1:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-04-08 01:41 -------
x/x is done for fp now.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
` (4 preceding siblings ...)
2006-04-08 1:41 ` pinskia at gcc dot gnu dot org
@ 2007-03-19 9:15 ` pluto at agmk dot net
5 siblings, 0 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2007-03-19 9:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pluto at agmk dot net 2007-03-19 09:15 -------
`int f( int x ) { return x / x; }' still not optimized on 4.2/4.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations
[not found] <bug-24333-4@http.gcc.gnu.org/bugzilla/>
2011-06-22 21:57 ` pluto at agmk dot net
@ 2021-09-02 0:24 ` gabravier at gmail dot com
1 sibling, 0 replies; 9+ messages in thread
From: gabravier at gmail dot com @ 2021-09-02 0:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
Gabriel Ravier <gabravier at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gabravier at gmail dot com
--- Comment #8 from Gabriel Ravier <gabravier at gmail dot com> ---
Seems to be fixed since GCC 7
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/24333] missed div optimizations
[not found] <bug-24333-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-22 21:57 ` pluto at agmk dot net
2021-09-02 0:24 ` gabravier at gmail dot com
1 sibling, 0 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2011-06-22 21:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24333
--- Comment #7 from Pawel Sikora <pluto at agmk dot net> 2011-06-22 21:56:27 UTC ---
4.6 still affected:
f: movl %edi, %edx
movl %edi, %eax
sarl $31, %edx
idivl %edi
ret
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-09-02 0:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-12 15:39 [Bug tree-optimization/24333] New: missed div optimizations? pluto at agmk dot net
2005-10-12 15:42 ` [Bug tree-optimization/24333] " pinskia at gcc dot gnu dot org
2005-10-12 15:57 ` pluto at agmk dot net
2005-10-12 16:04 ` pinskia at gcc dot gnu dot org
2005-12-30 18:33 ` [Bug tree-optimization/24333] missed div optimizations pinskia at gcc dot gnu dot org
2006-04-08 1:41 ` pinskia at gcc dot gnu dot org
2007-03-19 9:15 ` pluto at agmk dot net
[not found] <bug-24333-4@http.gcc.gnu.org/bugzilla/>
2011-06-22 21:57 ` pluto at agmk dot net
2021-09-02 0:24 ` gabravier 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).