This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/69908] recognizing idioms that check for a buffer of all-zeros could make *much* better code
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 09 Jul 2017 22:08:40 +0000
- Subject: [Bug tree-optimization/69908] recognizing idioms that check for a buffer of all-zeros could make *much* better code
- Auto-submitted: auto-generated
- References: <bug-69908-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69908
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Yuri Gribov from comment #5)
> Well, as we all know there are a lot of missing optimizations in GCC :) I
> think the real question is whether it's ever going to be fixed if there's no
> standard API for this code pattern which we can recognize as builtin.
>
> I believe the answer is "No". ATM GCC does not vectorize even the simplest
> memcpy equivalent code:
> // gcc tmp.c -O3 -mtune=native -ftree-vectorize -o- -S
> void memcpy_(char * __restrict a, char * __restrict b, unsigned n) {
> unsigned i;
> for (i = 0; i < n; ++i)
> a[i] = b[i];
> }
Please look again. ldist turns this into a call to memcpy. And if you disable
ldist, it does get vectorized.