[Bug tree-optimization/117000] Inefficient code for 32-byte struct comparison (ptest missing)

2024-10-10 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117000 --- Comment #6 from Paweł Bylica --- Thanks for fixing this. Is there a way to get similar effect in GCC 14?

[Bug rtl-optimization/117000] New: Inefficient code for 32-byte struct comparison (ptest missing)

2024-10-07 Thread chfast at gmail dot com via Gcc-bugs
Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- I was investigating why in GCC 13.3 the functions test1 and test2 produce different x86 assembly. They only differ by the

[Bug rtl-optimization/114452] Functions invoked through compile-time table of function pointers not inlined

2024-04-11 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114452 --- Comment #7 from Paweł Bylica --- (In reply to Martin Jambor from comment #6) > (In reply to Paweł Bylica from comment #5) > > (In reply to Martin Jambor from comment #4) > > > In this testcase all (well, both) functions referenced from the a

[Bug rtl-optimization/114452] Functions invoked through compile-time table of function pointers not inlined

2024-04-11 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114452 --- Comment #5 from Paweł Bylica --- (In reply to Martin Jambor from comment #4) > In this testcase all (well, both) functions referenced from the array > are semantically equivalent which is recognized by ICF but making it > be able to pass thi

[Bug rtl-optimization/114452] Functions invoked through compile-time table of function pointers not inlined

2024-03-25 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114452 --- Comment #2 from Paweł Bylica --- I don't think this is related to lambdas. The following is also not optimized: using F = int (*)(int) noexcept; inline int impl(int x) noexcept { return x; } void test(int z[2]) noexcept { static cons

[Bug rtl-optimization/114452] New: Functions invoked through compile-time table of function pointers not inlined

2024-03-25 Thread chfast at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- In the following example there is a compile-time table of pointers to simple functions. When the table is used in

[Bug target/113764] New: [X86] Generates lzcnt when bsr is sufficient

2024-02-05 Thread chfast at gmail dot com via Gcc-bugs
: target Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- When lzcnt instructions is enabled (-mlzcnt) the compiler generates lzcnt for __builtin_clz() in the context where the bsr instruction is sufficient and better. unsigned bsr

[Bug middle-end/79173] add-with-carry and subtract-with-borrow support (x86_64 and others)

2023-06-05 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173 --- Comment #15 from Paweł Bylica --- For what it's worth, clang's __builtin_addc is implemented in frontend only as a pair of __builtin_add_overflow. The commit from 11 year ago does not explain why they were added. https://github.com/llvm/llvm-

[Bug tree-optimization/110020] [13/14 Regression] SHA2 misscompilation at -O3

2023-05-29 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110020 --- Comment #2 from Paweł Bylica --- Yes, you are right. Sorry for taking your time.

[Bug tree-optimization/110020] New: [13/14 Regression] SHA2 misscompilation at -O3

2023-05-29 Thread chfast at gmail dot com via Gcc-bugs
: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- This is a test case reduced from a C implementation of SHA256. void test(unsigned h[8]) { for (unsigned i = 0; i < 2; i++) { unsigned w

[Bug rtl-optimization/109845] New: Addition overflow/carry flag unnecessarily put in a temporary register

2023-05-13 Thread chfast at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- When we have an addition and an overflow check and the overflow flag is combined with some other condition the codegen

[Bug rtl-optimization/49054] useless cmp+jmp generated for switch when "default:" is unreachable

2023-05-13 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49054 Paweł Bylica changed: What|Removed |Added CC||chfast at gmail dot com --- Comment #7

[Bug middle-end/109844] New: Unnecessary basic block with single jmp instruction

2023-05-13 Thread chfast at gmail dot com via Gcc-bugs
Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- The code void err(void); void merge_bb(int y) { if (y) return err(); } is merge_bb: testedi, edi jne .L4 ret .L4

[Bug target/105354] __builtin_shuffle for alignr generates suboptimal code unless SSSE3 is enabled

2023-05-11 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105354 Paweł Bylica changed: What|Removed |Added CC||chfast at gmail dot com --- Comment #6

[Bug middle-end/104151] [10/11/12/13/14 Regression] x86: excessive code generated for 128-bit byteswap

2023-05-11 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104151 Paweł Bylica changed: What|Removed |Added CC||chfast at gmail dot com --- Comment #18

[Bug rtl-optimization/109771] New: Unnecessary pblendw for vectorized or

2023-05-08 Thread chfast at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- I have an example of vectorization of 4x64-bit struct (representation of 256-bit integer). The implementation just uses for loop of count 4. This is vectorized in

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2023-05-07 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #32 from Paweł Bylica --- For what it's worth, the original code is compiled the same as in Clang since GCC 10. https://godbolt.org/z/vxorYW815

[Bug tree-optimization/109667] New: [12/13/14 Regression] Unnecessary temporary storage used for 32-byte struct

2023-04-28 Thread chfast at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- Reduced reproducer: struct i256 { long v[4]; }; void assign(struct i256 *v, long z) { struct i256 r

[Bug tree-optimization/106786] [12/13 Regression] SRA regression causes extra instructions sometimes

2022-11-29 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106786 --- Comment #4 from Paweł Bylica --- Any update on this? I've identified some other similar cases where this hurting the performance.

[Bug tree-optimization/107837] New: Missed optimization: Using memcpy to load a struct unnecessary uses stack space

2022-11-23 Thread chfast at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- I have a simple struct with array uint64_t[4]. When using memcpy() load it from a storage of bytes and then

[Bug c++/96868] C++20 designated initializer erroneous warnings

2022-10-29 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96868 --- Comment #6 from Paweł Bylica --- The workaround is MyObj obj = {}; which at least suggests some inconsistency in the compiler internals. For me this warning should be disabled in C++ when designated initializers are used and all other fie

[Bug c++/107434] New: Wrong -Wmissing-field-initializers for C++ designated initializers

2022-10-27 Thread chfast at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- If a struct S has a field c of type C having user constructor the "missing-field-initializers" is reported for this field e

[Bug tree-optimization/106786] New: Regression in cmp+sbb

2022-08-31 Thread chfast at gmail dot com via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- I noticed a regression when using the builtin for sbb instruction (__builtin_ia32_sbb_u64). typedef unsigned long long u64; struct R { u64 value; bool carry; }; inline R subc

[Bug rtl-optimization/96475] direct threaded interpreter with computed gotos generates suboptimal dispatch loop

2022-08-22 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96475 Paweł Bylica changed: What|Removed |Added CC||chfast at gmail dot com --- Comment #25

[Bug c++/105481] New: ICE: unexpected expression of kind template_parm_index

2022-05-04 Thread chfast at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- I get intx_reduced.cpp: In substitution of ‘template uint f(const T&) [with unsigned int N = N; T = uint; = ]’: intx_reduced.cpp:18:31: required from

[Bug target/100119] New: [x86] Conversion unsigned int -> double produces -0 (-m32 -msse2 -mfpmath=sse)

2021-04-16 Thread chfast at gmail dot com via Gcc-bugs
MED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- When building for 32-bit x86 but with SSE2 floating-point enabled: -m32 -msse2 -mfpmath=sse the conversion f

[Bug target/99620] Subtract with borrow (SBB) missed optimization

2021-03-17 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99620 --- Comment #4 from Paweł Bylica --- Can you give me introduction where and how to fix it? I have a longer list of similar issues, so maybe it's good time to learn how to fix them myself. FYI, clang is unifying both cases by changing `k = l > a.

[Bug rtl-optimization/99620] New: Subtract with borrow (SBB) missed optimization

2021-03-16 Thread chfast at gmail dot com via Gcc-bugs
: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- Hi. For the 128-bit precision subtraction: SUB + SBB the optimization depends on the how the carry bit condition is specified in the code. In the first case below

[Bug c++/97145] Sanitizer pointer-subtract breaks constexpr functions subtracting pointers

2021-02-23 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97145 Paweł Bylica changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|---

[Bug middle-end/51839] GCC not generating adc instruction for canonical multi-precision add sequence

2021-02-17 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51839 Paweł Bylica changed: What|Removed |Added CC||chfast at gmail dot com --- Comment #1

[Bug libstdc++/97659] Invalid pointer subtraction in vector::insert() (reported by pointer-subtract AddressSanitizer)

2020-11-01 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97659 --- Comment #4 from Paweł Bylica --- I'd like to explain some things here (to my best knowledge): 1. The "pointer-subtract" checks is ASan extension, not enabled by default. When running with this check enabled in my application I have not detec

[Bug libstdc++/97659] Invalid pointer subtraction in vector::insert() (reported by pointer-subtract AddressSanitizer)

2020-10-31 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97659 --- Comment #2 from Paweł Bylica --- Created attachment 49482 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49482&action=edit Minimal test case source code It turned out the problem is related to vector's internal instrumentation _GLIBCXX

[Bug libstdc++/97659] New: Invalid pointer subtraction in vector::insert() (reported by pointer-subtract AddressSanitizer)

2020-10-31 Thread chfast at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- When vector::insert(iterator pos, InputIt first, InputIt last) is used the AddressSanitizer additional

[Bug libstdc++/97415] New: Invalid pointer comparison in stringbuf::str() (reported by pointer-compare AddressSanitizer)

2020-10-14 Thread chfast at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- When my application is instrumented with -fsanitize=address,pointer-compare and running under

[Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs

2020-10-14 Thread chfast at gmail dot com via Gcc-bugs
Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc

[Bug c++/97145] New: Sanitizer pointer-subtract breaks constexpr functions subtracting pointers

2020-09-21 Thread chfast at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- Having a constexpr function that subtracts two pointers does not work in constexpr context when building with -fsanitize=address

[Bug target/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-28 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #16 from Paweł Bylica --- I have checked the glibc implementation of floorf(). Source here: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/ieee754/flt-32/s_floorf.c;h=da6c6dfa8ae86129e74d2e4391fac3a3c2ec;hb=HEAD - It ha

[Bug target/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-28 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #15 from Paweł Bylica --- (In reply to Marc Glisse from comment #14) > (In reply to Marc Glisse from comment #13) > > if (HONOR_SIGNED_ZEROS (mode)) > > x2 = copysign (x2, x); > > Hmm, I misread the comment, sorry.

[Bug target/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-28 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #8 from Paweł Bylica --- Did you consider fixing the __builtin_floor() implementation?

[Bug c/96804] Arguments are swapped in floating-point addition

2020-08-26 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96804 --- Comment #3 from Paweł Bylica --- Yes, you are right, that is not violation of IEEE 754 (I assumed wrongly previously, sorry). However, it still maybe undesired to get different binary results depending on optimization enabled/disabled.

[Bug c/96804] Arguments are swapped in floating-point addition

2020-08-26 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96804 --- Comment #1 from Paweł Bylica --- Created attachment 49133 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49133&action=edit Assembly output

[Bug c/96804] New: Arguments are swapped in floating-point addition

2020-08-26 Thread chfast at gmail dot com
: c Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- Created attachment 49132 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49132&action=edit C source code In the following function, when compiling without optimi

[Bug c/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-26 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #4 from Paweł Bylica --- I missed some information: This affects both double and float variants: __builtin_floor() and __builtin_floorf(). This affects also usage of floor() C standard library function as the function call usually r

[Bug c/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-26 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #3 from Paweł Bylica --- Created attachment 49128 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49128&action=edit Compiler invocation log

[Bug c/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-26 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #1 from Paweł Bylica --- Created attachment 49126 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49126&action=edit Test source code

[Bug c/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-26 Thread chfast at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793 --- Comment #2 from Paweł Bylica --- Created attachment 49127 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49127&action=edit Assembly output

[Bug c/96793] New: __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD

2020-08-26 Thread chfast at gmail dot com
: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- Created attachment 49125 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49125&action=edit Preprocessed test code