-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
unsigned mod3(unsigned n) {
return n % 3;
}
The emitted code for ARM64 with -O3 is:
mod3:
mov w1, 43691
movkw1, 0x, lsl 16
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
#include
void f();
auto const p1 = &f;
auto const p2 = std::bit_cast(&f);
bool a() {
return
ty: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider this C++ code compiled with -O3:
double g(double x) {
return std::sqrt(x);
}
Usually this does call t
: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
char f128(__uint128_t m, __uint128_t n) {
#if !defined(USE_BUILTIN_ADD_OVERFLOW)
m += n
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104539
--- Comment #1 from Cassio Neri ---
Sorry, the last snippet above should be
template
inline
int f() {
return 0;
}
IRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
template
//inline
int f() {
return 0;
}
: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
#include
inline bool f(uint32_t m, int n) {
return (m >> n) != 0;
}
bool g(int n) {
return f(1 << 24, n);
}
g can be optimised to &qu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101436
--- Comment #3 from Cassio Neri ---
Because of the typeid check the unsafe static_cast never happens and I think
the compiler should not be warning about a problem that doesn't exist. Besides,
there's no array involved in this code. I appreciate
ty: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
This bogus warning was reported at least twice recently: #98266 and #101374.
Below is a new case that
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider this implementation of is_leap_year:
bool is_leap_year_1(short year) {
return year % 100 == 0 ? year
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88797
--- Comment #13 from Cassio Neri ---
FWIW: This seems to have been fixed since 10.1. As we can see in [1], on
version 10.1, test_f has no unnecessary branches, as opposed to version 9.3.
[1] https://godbolt.org/z/h87Efbanb
As far as I'm concern
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93634
--- Comment #1 from Cassio Neri ---
FYI, this is what clang trunk generates:
imull $-1431655765, %edi, %eax # imm = 0xAAAB
addl $1431655764, %eax # imm = 0x5554
rorl %eax
cmpl $715827882, %eax # imm = 0x2AAA
setb %al
retq
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
bool f(unsigned n) { return n % 6 == 4; }
at -O3 the code generated for x86_64 is
mov%edi,%eax
mov$0xaaab,%edx
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider two vectors a and rv. In the situation below a = std::move(rv)
copy-assigns elements of rv into a, violating
[container.requirements.general]/4, Table
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91158
--- Comment #7 from Cassio Neri ---
(In reply to Jakub Jelinek from comment #4)
Got it! Thank you, Mark and Jonathan. Please, feel free to close the ticket.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91158
--- Comment #3 from Cassio Neri ---
Forget my use case and comments on dead code elimination. That was a
digression. (My bad.) In general, I don't expect `if` and `if constexpr` to
behave the same but I do in this particular case. (I might be wro
D
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
constexpr bool f0(int n) {
if (__builtin_constant_p(n))
return tr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12849
--- Comment #7 from Cassio Neri ---
Thanks for implementing the modular inverse algorithm in gcc. However, the
implementation has an issue. In some cases, for no obvious reason, the compiler
falls back to the old algorithm. For instance,
boo
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90447
--- Comment #1 from Cassio Neri ---
Forgot to mention this discussion on SO:
https://stackoverflow.com/questions/56101507/is-there-anything-special-about-1-0x-regarding-adc
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
The following are three attempts to get gcc to generate adc instructions from
C++:
#include
unsigned constexpr X = 0
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
struct base {
int i;
void f(){}
};
template
struct derived : base {
void g1() {
return (this->
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88797
--- Comment #5 from Cassio Neri ---
There's a (fragile) workaround:
void use(unsigned);
#define VERSION 0
bool f(unsigned x, unsigned y) {
#if VERSION == 0
return x < + (y <= );
#else
bool b = y <= ;
return x < + b;
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88797
--- Comment #4 from Cassio Neri ---
Comment on attachment 45408
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45408
Running example
The magic numbers 4, 6, 7, 0x24924924u and 0xb6db6db7u were chosen in an
attempt to maximize the probabili
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88797
--- Comment #3 from Cassio Neri ---
The attached file is running example that shows that performance is damaged.
The code runs faster when test_f calls g instead of f where g is
bool g(unsigned x, unsigned y) {
if (x >= y) return false;
r
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88797
--- Comment #2 from Cassio Neri ---
Created attachment 45408
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45408&action=edit
Running example
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
Consider:
void use(unsigned);
bool f(unsigned x, unsigned y) {
return x < + (y <
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12849
Cassio Neri changed:
What|Removed |Added
CC||cassio.neri at gmail dot com
--- Comment
-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Target Milestone: ---
The loop below is not eliminated:
int main() {
for (unsigned i = 0; i < (1u << 31); ++i) {
}
return 0;
}
Compiled with -O3:
main:
xor eax
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
Consider:
class foo {
~foo() {}
};
int main() {
new foo; // OK
new foo(); // OK
new foo{}; // error: 'foo::~foo()'
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cassio.neri at gmail dot com
The code below crashes gcc 4.8.1 (coincidentaly, it also crashes clang 3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56693
Bug #: 56693
Summary: Fail to ignore const qualification on top of a
function type.
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFI
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55101
Bug #: 55101
Summary: Invalid implicit conversion in initialization when
source type is a template argument type
Classification: Unclassified
Product: gcc
Version: 4.8.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54722
Bug #: 54722
Summary: std::is_nothrow_default_constructible::value
depends on whether destructor throws or not.
Classification: Unclassified
Product: gcc
Version: unknow
33 matches
Mail list logo