]> git.ipfire.org Git - thirdparty/gcc.git/commit
Improve ix86 VEC_MERGE costs
authorJan Hubicka <hubicka@ucw.cz>
Fri, 2 May 2025 22:26:29 +0000 (00:26 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Sat, 3 May 2025 08:34:09 +0000 (10:34 +0200)
commit20d184e3f84d859e7e9f44a8d91772a02b658872
tree5181d6ae8374f93c67ac380f6b2acb51541b8deb
parent4beae371c435df8d77a7f806f1a40b3d1c50e76f
Improve ix86 VEC_MERGE costs

ix86_rtx_costs VEC_MERGE by special casing AVX512 mask operations and otherwise
returning cost->sse_op completely ignoring costs of the operands.  Since
VEC_MERGE is also used to represent scalar variant of SSE/AVX operation, this
means that many instructions (such as SSE converisions) are often costed as
sse_op instead of their real cost.

This patch adds pattern matching for the VEC_MERGE pattern which also forced me
to add special cases for masked versions and vcmp otherwise combine is confused
by the default cost compred to the cost of recognized version of the
instruction.

Since now the important cases should be handled, I also added recursion to the
remaining cases so substituting constants and memory is adequately costed.

gcc/ChangeLog:

* config/i386/i386.cc (unspec_pcmp_p): New function.
(ix86_rtx_costs): Cost VEC_MERGE more realistically.
gcc/config/i386/i386.cc