https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94589
Victor Khimenko changed:
What|Removed |Added
CC||khim at google dot com
--- Comment #2
: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: khim at google dot com
Target Milestone: ---
The following code works with all other compilers: https://godbolt.org/z/Mv3xsn
template
class TagType;
int foo();
constexpr auto
-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: khim at google dot com
Target Milestone: ---
Simple long addition program.
struct pair {
uint64_t low;
uint64_t hi;
};
pair add(pair& a, pair& b) {
pair s;
s.low = a.low + b.low;
s.hi = a.hi + b.hi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80491
--- Comment #1 from Victor Khimenko ---
Actually even clang's version is not optimal ("addq 8(%rdi), %rdx" then "adcq
$0, %rdx" could be replaced with "adcq 8(%rdi), %rdx"). But at least both calng
and old version of gcc are smart enough to rem
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80491
--- Comment #2 from Victor Khimenko ---
An interesting observation: -O1 actually produces perfect code:
$ gcc -S -O1 test.cc -o-
.file "test.cc"
.text
.p2align 4,,15
.globl _Z3addR4pairS0_
.type _Z3addR4pa
ormal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: khim at google dot com
Target Milestone: ---
The following program is an illustration (https://godbolt.org/z/PYW34ccvP):
#include
GNU_PURE1 extern size_t foo(size_t);
tem