InstCombine/AMDGPU: Add dimension-aware image intrinsics to SimplifyDemanded
Summary:
Use the expanded features of the TableGen generic tables to avoid manually
adding the combinatorially exploded set of intrinsics. The
getAMDGPUImageDimIntrinsic lookup function is early-out,
i.e. non-AMDGPU intrinsics will never look at the underlying table.
Use a generic approach for getting the new intrinsic overload to keep the
code simple, and make the image dmask handling more generic:
- handle non-sampler image loads
- handle the case where the set of demanded elements is not a prefix
There is some overlap between this code and an optimization that happens
in the backend during code generation. They currently complement each other:
- only the codegen optimization can generate vec3 loads
- only the InstCombine optimization can handle D16
The InstCombine optimization also likely covers more cases since the
codegen optimization is fairly ad-hoc. Ideally, we'll remove the optimization
in codegen once the infrastructure for vec3 is in place (which will probably
take a long time).
Modify the test cases to use dimension-aware intrinsics. This makes it
easier to see that the test coverage for the new intrinsics is equivalent,
and the old style intrinsics will be removed in a follow-up commit anyway.
Change-Id: I4b91ea661413d13004956fe4ef7d13d41b8ce3ad
Reviewers: arsenm, rampitec, majnemer
Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D48165
llvm-svn: 335230
2018-06-21 21:37:31 +08:00
|
|
|
set(LLVM_TARGET_DEFINITIONS InstCombineTables.td)
|
|
|
|
tablegen(LLVM InstCombineTables.inc -gen-searchable-tables)
|
|
|
|
add_public_tablegen_target(InstCombineTableGen)
|
|
|
|
|
2010-01-04 14:28:20 +08:00
|
|
|
add_llvm_library(LLVMInstCombine
|
|
|
|
InstructionCombining.cpp
|
2010-01-05 15:18:46 +08:00
|
|
|
InstCombineAddSub.cpp
|
2010-01-05 15:50:36 +08:00
|
|
|
InstCombineAndOrXor.cpp
|
2010-01-05 15:32:13 +08:00
|
|
|
InstCombineCalls.cpp
|
2010-01-04 15:53:58 +08:00
|
|
|
InstCombineCasts.cpp
|
2010-01-04 15:37:31 +08:00
|
|
|
InstCombineCompares.cpp
|
2010-01-05 13:57:49 +08:00
|
|
|
InstCombineLoadStoreAlloca.cpp
|
2010-01-05 14:09:35 +08:00
|
|
|
InstCombineMulDivRem.cpp
|
2010-01-05 13:31:55 +08:00
|
|
|
InstCombinePHI.cpp
|
2010-01-05 14:03:12 +08:00
|
|
|
InstCombineSelect.cpp
|
2013-04-06 05:20:12 +08:00
|
|
|
InstCombineShifts.cpp
|
2010-01-04 15:19:55 +08:00
|
|
|
InstCombineSimplifyDemanded.cpp
|
2010-01-05 13:36:20 +08:00
|
|
|
InstCombineVectorOps.cpp
|
2015-02-11 11:28:02 +08:00
|
|
|
|
|
|
|
ADDITIONAL_HEADER_DIRS
|
|
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms
|
|
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms/InstCombine
|
2012-06-24 21:32:01 +08:00
|
|
|
|
2016-11-17 12:36:50 +08:00
|
|
|
DEPENDS
|
|
|
|
intrinsics_gen
|
|
|
|
)
|