diff options
author | Kewen Lin <linkw@linux.ibm.com> | 2024-07-08 00:14:59 -0500 |
---|---|---|
committer | Kewen Lin <linkw@gcc.gnu.org> | 2024-07-08 00:14:59 -0500 |
commit | f379596e0ba99df249d6e8b3f2e66edfcea916fe (patch) | |
tree | 6c0b6ed81566f0f0f0c9be59077e472357b732a1 /gcc/doc | |
parent | f90ca62566c1d20da585d95ced99f6a1903fc2cc (diff) | |
download | gcc-f379596e0ba99df249d6e8b3f2e66edfcea916fe.zip gcc-f379596e0ba99df249d6e8b3f2e66edfcea916fe.tar.gz gcc-f379596e0ba99df249d6e8b3f2e66edfcea916fe.tar.bz2 |
isel: Fold more in gimple_expand_vec_cond_expr with andc and iorc [PR115659]
As PR115659 shows, assuming c = x CMP y, there are some
folding chances for patterns r = c ? 0/z : z/-1:
- for r = c ? 0 : z, it can be folded into r = ~c & z.
- for r = c ? z : -1, it can be folded into r = ~c | z.
But BIT_AND/BIT_IOR applied on one BIT_NOT operand is a
compound operation, it's arguable to consider it beats
vector selection. So this patch is to introduce new
optabs andc, iorc and its corresponding internal functions
BIT_{ANDC,IORC}, and if targets defines such optabs for
vector modes, it means targets support these hardware
insns and should be not worse than vector selection.
PR tree-optimization/115659
gcc/ChangeLog:
* doc/md.texi: Document andcm3 and iorcm3.
* gimple-isel.cc (gimple_expand_vec_cond_expr): Add more foldings for
patterns x CMP y ? 0 : z and x CMP y ? z : -1.
* internal-fn.def (BIT_ANDC): New internal function.
(BIT_IORC): Likewise.
* optabs.def (andc, iorc): New optab.
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/md.texi | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 4fd7da0..7f4335e 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5543,6 +5543,16 @@ means of constraints requiring operands 1 and 0 to be the same location. @itemx @samp{and@var{m}3}, @samp{ior@var{m}3}, @samp{xor@var{m}3} Similar, for other arithmetic operations. +@cindex @code{andc@var{m}3} instruction pattern +@item @samp{andc@var{m}3} +Like @code{and@var{m}3}, but it uses bitwise-complement of operand 2 +rather than operand 2 itself. + +@cindex @code{iorc@var{m}3} instruction pattern +@item @samp{iorc@var{m}3} +Like @code{ior@var{m}3}, but it uses bitwise-complement of operand 2 +rather than operand 2 itself. + @cindex @code{addv@var{m}4} instruction pattern @item @samp{addv@var{m}4} Like @code{add@var{m}3} but takes a @code{code_label} as operand 3 and |