[Bug middle-end/78115] New: Missed optimization for "int modulo 2^31"

2016-10-26 Thread tkoeppe at google dot com
nt: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: tkoeppe at google dot com Target Milestone: --- Consider the operation of mapping an int to the unique modular representative in [0, 2^31). Readable code: #include int mod31(int num) { if (num < 0) {

[Bug middle-end/66881] New: Possibly inefficient std::atomic codegen on x86 for simple arithmetic

2015-07-15 Thread tkoeppe at google dot com
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: tkoeppe at google dot com Target Milestone: --- Consider these two simple versions of addition: #include std::atomic x; int y; void f(int a) { x.store(x.load

[Bug middle-end/66713] atomic compare_exchange_strong creates spurious store for x86-64 at -O3

2015-07-01 Thread tkoeppe at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66713 --- Comment #3 from Thomas Köppe --- Note: The code in question, and the hand-written assembly, are taken from the ZMQ library: https://github.com/zeromq/libzmq/blob/master/src/atomic_ptr.hpp I added the C++11 atomic support recenlty.

[Bug tree-optimization/66713] New: atomic compare_excahnge_strong create spurious store for x86-64 at -O3

2015-06-30 Thread tkoeppe at google dot com
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tkoeppe at google dot com Target Milestone: --- The code here: https://goo.gl/CiV4pl compares a hand-written CAS with the C++11 atomic one. On Clang, the code comes

[Bug tree-optimization/62006] Bad code generation with -O3 (possibly due to -ftree-partial-pre)

2014-08-04 Thread tkoeppe at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62006 --- Comment #11 from Thomas Köppe --- Created attachment 33240 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33240&action=edit Further fixing: Uses uintptr_ts for the difference On Jonathan's suggestion I changed the distance computation

[Bug tree-optimization/62006] Bad code generation with -O3 (possibly due to -ftree-partial-pre)

2014-08-04 Thread tkoeppe at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62006 --- Comment #9 from Thomas Köppe --- Argh, yes, I compiled the wrong file... indeed, the arena version works with GCC 4.8.2 for me, too, and in Clang as well. So... not an issue, I suppose? The desired real application will be for containers al

[Bug tree-optimization/62006] Bad code generation with -O3 (possibly due to -ftree-partial-pre)

2014-08-04 Thread tkoeppe at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62006 --- Comment #6 from Thomas Köppe --- Created attachment 33236 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33236&action=edit Fixed demo that doesn't have UB on account of invalid pointer arithmetic Here's a (very lazily) fixed version of

[Bug tree-optimization/62006] Bad code generation with -O3 (possibly due to -ftree-partial-pre)

2014-08-04 Thread tkoeppe at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62006 --- Comment #4 from Thomas Köppe --- Ah, you're right, this offset pointer computation as it stands is undefined behaviour. The intended use is to use those pointers only within a preallocated arena, so that the pointers would indeed live in a co

[Bug c++/62006] New: Bad code generation with -O3 (possibly due to -ftree-partial-pre)

2014-08-04 Thread tkoeppe at google dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tkoeppe at google dot com Created attachment 33231 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33231&action=edit Demonstrates bad code generation with -O3 I was writi