1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/lib/Transforms/InstCombine
Sanjay Patel a657e27486 [InstCombine] canonicalize a scalar-select-of-vectors to vector select
This pattern may arise more frequently with an enhancement to SLP vectorization suggested in PR42755:
https://bugs.llvm.org/show_bug.cgi?id=42755
...but we should handle this pattern to make things easier for the backend either way.

For all in-tree targets that I looked at, codegen for typical vector sizes looks better when we change
to a vector select, so this is safe to do without a cost model (in other words, as a target-independent
canonicalization).

For example, if the condition of the select is a scalar, we end up with something like this on x86:

	vpcmpgtd	%xmm0, %xmm1, %xmm0
	vpextrb	$12, %xmm0, %eax
	testb	$1, %al
	jne	LBB0_2
  ## %bb.1:
	vmovaps	%xmm3, %xmm2
  LBB0_2:
	vmovaps	%xmm2, %xmm0

Rather than the splat-condition variant:

	vpcmpgtd	%xmm0, %xmm1, %xmm0
	vpshufd	$255, %xmm0, %xmm0      ## xmm0 = xmm0[3,3,3,3]
	vblendvps	%xmm0, %xmm2, %xmm3, %xmm0

Differential Revision: https://reviews.llvm.org/D66095

llvm-svn: 369140
2019-08-16 18:51:30 +00:00
..
CMakeLists.txt [InstCombine] Optimize atomicrmw <op>, 0 into load atomic when possible 2019-02-07 21:27:23 +00:00
InstCombineAddSub.cpp [InstCombine][NFC] Rename IsFreeToInvert() -> isFreeToInvert() for consistency 2019-08-13 12:49:16 +00:00
InstCombineAndOrXor.cpp [InstCombine][NFC] Rename IsFreeToInvert() -> isFreeToInvert() for consistency 2019-08-13 12:49:16 +00:00
InstCombineAtomicRMW.cpp [InstCombine] Extend saturating idempotent atomicrmw transform to FP 2019-03-01 19:50:36 +00:00
InstCombineCalls.cpp OpaquePtr: add Type parameter to Loads analysis API. 2019-07-09 11:35:35 +00:00
InstCombineCasts.cpp Revert "[InstCombine] try to narrow a truncated load" 2019-07-25 15:37:57 +00:00
InstCombineCompares.cpp [InstCombine] Shift amount reassociation in bittest: trunc-of-shl (PR42399) 2019-08-16 15:10:41 +00:00
InstCombineInternal.h [InstCombine] Refactor getFlippedStrictnessPredicateAndConstant() out of canonicalizeCmpWithConstant(), NFCI 2019-08-14 09:57:20 +00:00
InstCombineLoadStoreAlloca.cpp [Transforms] move copying of load metadata to helper function; NFC 2019-07-24 22:11:11 +00:00
InstCombineMulDivRem.cpp [InstCombine] x /c fabs(x) -> copysign(1.0, x) 2019-08-12 13:43:35 +00:00
InstCombinePHI.cpp [InstCombine] SliceUpIllegalIntegerPHI - bail on out of range shifts 2019-06-24 13:13:36 +00:00
InstCombineSelect.cpp [InstCombine] canonicalize a scalar-select-of-vectors to vector select 2019-08-16 18:51:30 +00:00
InstCombineShifts.cpp [InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern 2019-08-07 09:41:50 +00:00
InstCombineSimplifyDemanded.cpp [IntrinsicEmitter] Extend argument overloading with forward references. 2019-06-13 08:19:33 +00:00
InstCombineTables.td InstCombine/AMDGPU: Add dimension-aware image intrinsics to SimplifyDemanded 2018-06-21 13:37:31 +00:00
InstCombineVectorOps.cpp [InstCombine] fold insertelement into splat of same scalar 2019-07-08 19:48:52 +00:00
InstructionCombining.cpp [InstCombine] Propagate fast math flags through selects 2019-08-07 15:16:28 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00