public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/102971] New: GCC cannot understand >>32 pattern @ 2021-10-27 20:29 unlvsur at live dot com 2021-10-27 20:30 ` [Bug tree-optimization/102971] " unlvsur at live dot com ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: unlvsur at live dot com @ 2021-10-27 20:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102971 Bug ID: 102971 Summary: GCC cannot understand >>32 pattern Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: unlvsur at live dot com Target Milestone: --- https://godbolt.org/z/eeG8fnY1z I want to seperate a uint_least64_t to 2x uint_least32_t or merge 2x uint_least32_t to uint_least64_t. GCC just cannot understand the pattern at all here. The assembly it generates is very bad for things like this. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/102971] GCC cannot understand >>32 pattern 2021-10-27 20:29 [Bug tree-optimization/102971] New: GCC cannot understand >>32 pattern unlvsur at live dot com @ 2021-10-27 20:30 ` unlvsur at live dot com 2021-10-27 21:03 ` pinskia at gcc dot gnu.org 2021-10-28 8:19 ` [Bug target/102971] " rguenth at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: unlvsur at live dot com @ 2021-10-27 20:30 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102971 --- Comment #1 from cqwrteur <unlvsur at live dot com> --- Here is clang https://godbolt.org/z/7YjW1Ezrx ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/102971] GCC cannot understand >>32 pattern 2021-10-27 20:29 [Bug tree-optimization/102971] New: GCC cannot understand >>32 pattern unlvsur at live dot com 2021-10-27 20:30 ` [Bug tree-optimization/102971] " unlvsur at live dot com @ 2021-10-27 21:03 ` pinskia at gcc dot gnu.org 2021-10-28 8:19 ` [Bug target/102971] " rguenth at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-10-27 21:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102971 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- #include <cstdint> std::uint64_t umul_naive(std::uint64_t a,std::uint64_t b,std::uint64_t& high) noexcept { std::uint32_t a0(static_cast<std::uint32_t>(a)); std::uint32_t a1(static_cast<std::uint32_t>(a>>32)); std::uint32_t b0(static_cast<std::uint32_t>(b)); std::uint32_t b1(static_cast<std::uint32_t>(b>>32)); std::uint64_t c00(static_cast<std::uint64_t>(a0)*b0); std::uint64_t c01(static_cast<std::uint64_t>(a0)*b1); std::uint64_t c10(static_cast<std::uint64_t>(a1)*b0); std::uint64_t c11(static_cast<std::uint64_t>(a1)*b1); std::uint64_t d0{static_cast<std::uint32_t>(c00)}; std::uint64_t c00_high{c00>>32}; std::uint64_t c01_low{static_cast<std::uint32_t>(c01)}; std::uint64_t c01_high{c01>>32}; std::uint64_t c10_low{static_cast<std::uint32_t>(c10)}; std::uint64_t c10_high{c10>>32}; std::uint64_t d1{c00_high+c01_low+c10_low}; std::uint64_t d2{(d1>>32)+c10_high+c01_high}; std::uint64_t d3{(d2>>32)+c11}; high=d2|(d3<<32); return d0|(d1<<32); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/102971] GCC cannot understand >>32 pattern 2021-10-27 20:29 [Bug tree-optimization/102971] New: GCC cannot understand >>32 pattern unlvsur at live dot com 2021-10-27 20:30 ` [Bug tree-optimization/102971] " unlvsur at live dot com 2021-10-27 21:03 ` pinskia at gcc dot gnu.org @ 2021-10-28 8:19 ` rguenth at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: rguenth at gcc dot gnu.org @ 2021-10-28 8:19 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102971 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Component|middle-end |target Target|i?86 |i?86-*-* Status|UNCONFIRMED |NEW Last reconfirmed| |2021-10-28 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. With -mno-stv the assembly looks much better so something is wrong there with costing when deciding to do 64bit math in SSE regs as opposed to GPR pairs. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-28 8:19 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-27 20:29 [Bug tree-optimization/102971] New: GCC cannot understand >>32 pattern unlvsur at live dot com 2021-10-27 20:30 ` [Bug tree-optimization/102971] " unlvsur at live dot com 2021-10-27 21:03 ` pinskia at gcc dot gnu.org 2021-10-28 8:19 ` [Bug target/102971] " 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).