Skip to content
Snippets Groups Projects
Commit 567d06bb authored by Yan Simonaytes's avatar Yan Simonaytes Committed by Alexander Monakov
Browse files

i386: eliminate redundant operands of VPTERNLOG

As mentioned in PR 110202, GCC may be presented with input where control
word of the VPTERNLOG intrinsic implies that some of its operands do not
affect the result.  In that case, we can eliminate redundant operands
of the instruction by substituting any other operand in their place.
This removes false dependencies.

For instance, instead of (252 = 0xfc = _MM_TERNLOG_A | _MM_TERNLOG_B)

	vpternlogq	$252, %zmm2, %zmm1, %zmm0

emit

	vpternlogq	$252, %zmm0, %zmm1, %zmm0

When VPTERNLOG is invariant w.r.t first and second operands, and the
third operand is memory, load memory into the output operand first, i.e.
instead of (85 = 0x55 = ~_MM_TERNLOG_C)

	vpternlogq	$85, (%rdi), %zmm1, %zmm0

emit

	vmovdqa64	(%rdi), %zmm0
	vpternlogq	$85, %zmm0, %zmm0, %zmm0

gcc/ChangeLog:

	PR target/110202
	* config/i386/i386-protos.h
	(vpternlog_redundant_operand_mask): Declare.
	(substitute_vpternlog_operands): Declare.
	* config/i386/i386.cc
	(vpternlog_redundant_operand_mask): New helper.
	(substitute_vpternlog_operands): New function.  Use them...
	* config/i386/sse.md: ... here in new VPTERNLOG define_splits.

gcc/testsuite/ChangeLog:

	PR target/110202
	* gcc.target/i386/invariant-ternlog-1.c: New test.
	* gcc.target/i386/invariant-ternlog-2.c: New test.
parent c572f09a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment