public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/97529] New: Condition not constant folded
@ 2020-10-22 14:51 jmuizelaar at mozilla dot com
2021-07-23 3:38 ` [Bug tree-optimization/97529] " pinskia at gcc dot gnu.org
2023-02-10 22:30 ` [Bug tree-optimization/97529] (len / N) * N <= len is not optimized to 1 pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: jmuizelaar at mozilla dot com @ 2020-10-22 14:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97529
Bug ID: 97529
Summary: Condition not constant folded
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jmuizelaar at mozilla dot com
Target Milestone: ---
>From https://github.com/rust-lang/rust/issues/74938
GCC compiles:
#include <stddef.h>
const size_t N = 3;
int foo(size_t len) {
size_t newlen = (len / N) * N;
return newlen <= len;
}
to:
foo:
movabs rdx, -6148914691236517205
mov rax, rdi
mul rdx
mov rax, rdx
and rdx, -2
shr rax
add rdx, rax
xor eax, eax
cmp rdi, rdx
setnb al
ret
N:
.quad 3
clang:
foo: # @foo
mov eax, 1
ret
N:
.quad 3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/97529] Condition not constant folded 2020-10-22 14:51 [Bug tree-optimization/97529] New: Condition not constant folded jmuizelaar at mozilla dot com @ 2021-07-23 3:38 ` pinskia at gcc dot gnu.org 2023-02-10 22:30 ` [Bug tree-optimization/97529] (len / N) * N <= len is not optimized to 1 pinskia at gcc dot gnu.org 1 sibling, 0 replies; 3+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-07-23 3:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97529 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-07-23 CC| |pinskia at gcc dot gnu.org Status|UNCONFIRMED |NEW Severity|normal |enhancement Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/97529] (len / N) * N <= len is not optimized to 1 2020-10-22 14:51 [Bug tree-optimization/97529] New: Condition not constant folded jmuizelaar at mozilla dot com 2021-07-23 3:38 ` [Bug tree-optimization/97529] " pinskia at gcc dot gnu.org @ 2023-02-10 22:30 ` pinskia at gcc dot gnu.org 1 sibling, 0 replies; 3+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-10 22:30 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97529 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Dup of bug 96433. *** This bug has been marked as a duplicate of bug 96433 *** ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-10 22:30 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-10-22 14:51 [Bug tree-optimization/97529] New: Condition not constant folded jmuizelaar at mozilla dot com 2021-07-23 3:38 ` [Bug tree-optimization/97529] " pinskia at gcc dot gnu.org 2023-02-10 22:30 ` [Bug tree-optimization/97529] (len / N) * N <= len is not optimized to 1 pinskia 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).