]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/117000 - elide .REDUC_IOR with compare against zero
authorRichard Biener <rguenther@suse.de>
Tue, 8 Oct 2024 07:01:01 +0000 (09:01 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 9 Oct 2024 07:52:44 +0000 (09:52 +0200)
commit5977b746db3925aaba37722f5312419d5f2968a5
treedd8cecdc5d6c6413becc5c1363a9f34e99f1bf88
parentfd883919b2644c16a6bb00ba39bcba98cc26979d
tree-optimization/117000 - elide .REDUC_IOR with compare against zero

The following adds a pattern to elide a .REDUC_IOR operation when
the result is compared against zero with a cbranch.  I've resorted
to using can_compare_p since that's what RTL expansion eventually
checks - while GIMPLE allowed whole vector equality compares for long
I'll notice vector lowering won't lower unsupported ones and RTL
expansion doesn't seem to try using [u]cmp<vector-mode> optabs
(and neither x86 nor aarch64 implements those).  There's cstore
but no target implements that for vector modes either.

PR tree-optimization/117000
* match.pd (.REDUC_IOR !=/== 0): New pattern.
* gimple-match-head.cc: Include memmodel.h and optabs.h.
* generic-match-head.cc: Likewise.

* gcc.target/i386/pr117000.c: New testcase.
gcc/generic-match-head.cc
gcc/gimple-match-head.cc
gcc/match.pd
gcc/testsuite/gcc.target/i386/pr117000.c [new file with mode: 0644]