llvm-project/llvm/lib/Target/Hexagon
Roman Lebedev 017e272c3a [Codegen] (X & (C l>>/<< Y)) ==/!= 0 --> ((X <</l>> Y) & C) ==/!= 0 fold
Summary:
This was originally reported in D62818.
https://rise4fun.com/Alive/oPH

InstCombine does the opposite fold, in hope that `C l>>/<< Y` expression
will be hoisted out of a loop if `Y` is invariant and `X` is not.
But as it is seen from the diffs here, if it didn't get hoisted,
the produced assembly is almost universally worse.

Much like with my recent "hoist add/sub by/from const" patches,
we should get almost universal win if we hoist constant,
there is almost always an "and/test by imm" instruction,
but "shift of imm" not so much, so we may avoid having to
materialize the immediate, and thus need one less register.
And since we now shift not by constant, but by something else,
the live-range of that something else may reduce.

Special care needs to be applied not to disturb x86 `BT` / hexagon `tstbit`
instruction pattern. And to not get into endless combine loop.

Reviewers: RKSimon, efriedma, t.p.northover, craig.topper, spatel, arsenm

Reviewed By: spatel

Subscribers: hiraditya, MaskRay, wuzish, xbolva00, nikic, nemanjai, jvesely, wdng, nhaehnle, javed.absar, tpr, kristof.beyls, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 366955
2019-07-24 22:57:22 +00:00
..
AsmParser Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
Disassembler Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
MCTargetDesc Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
TargetInfo Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
BitTracker.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BitTracker.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt [Hexagon] Remove support for V4 2018-10-19 17:31:11 +00:00
Hexagon.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Hexagon.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonAsmPrinter.cpp Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
HexagonAsmPrinter.h Include what you use in HexagonAsmPrinter.h 2019-06-03 11:41:18 +00:00
HexagonBitSimplify.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonBitTracker.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonBitTracker.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonBlockRanges.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonBlockRanges.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonBranchRelaxation.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonCFGOptimizer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonCallingConv.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonCommonGEP.cpp [Hexagon] Remove indeterministic traversal order 2019-04-16 16:05:07 +00:00
HexagonConstExtenders.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonConstPropagation.cpp Hexagon: Rename another copy of Register class 2019-06-24 16:16:19 +00:00
HexagonCopyToCombine.cpp CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
HexagonDepArch.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepArch.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepDecoders.inc [Hexagon] Rename textually included file from .h to .inc 2019-01-31 21:58:42 +00:00
HexagonDepIICHVX.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepIICScalar.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepITypes.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepITypes.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepInstrFormats.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepInstrInfo.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepMapAsm2Intrin.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepMappings.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepOperands.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonDepTimingClasses.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonEarlyIfConv.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonExpandCondsets.cpp [Hexagon, SystemZ] Be super conservative about atomics 2019-02-24 00:45:09 +00:00
HexagonFixupHwLoops.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonFrameLowering.cpp [IR] Refactor attribute methods in Function class (NFC) 2019-04-04 22:40:06 +00:00
HexagonFrameLowering.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonGenExtract.cpp [opaque pointer types] Pass function types to CallInst creation. 2019-02-01 20:43:25 +00:00
HexagonGenInsert.cpp Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC 2019-06-21 05:40:31 +00:00
HexagonGenMux.cpp CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
HexagonGenPredicate.cpp CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
HexagonHardwareLoops.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonHazardRecognizer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonHazardRecognizer.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonIICHVX.td [Hexagon] Avoid creating 5-instruction packets with vgather pseudos 2019-03-06 17:43:50 +00:00
HexagonIICScalar.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonISelDAGToDAG.cpp [Hexagon] Split vector pairs for ISD::SIGN_EXTEND and ISD::ZERO_EXTEND 2019-02-20 15:05:19 +00:00
HexagonISelDAGToDAG.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonISelDAGToDAGHVX.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonISelLowering.cpp [Codegen] (X & (C l>>/<< Y)) ==/!= 0 --> ((X <</l>> Y) & C) ==/!= 0 fold 2019-07-24 22:57:22 +00:00
HexagonISelLowering.h [Codegen] (X & (C l>>/<< Y)) ==/!= 0 --> ((X <</l>> Y) & C) ==/!= 0 fold 2019-07-24 22:57:22 +00:00
HexagonISelLoweringHVX.cpp [Hexagon] Split vector pairs for ISD::SIGN_EXTEND and ISD::ZERO_EXTEND 2019-02-20 15:05:19 +00:00
HexagonInstrFormats.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonInstrFormatsV5.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonInstrFormatsV60.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonInstrFormatsV65.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonInstrInfo.cpp [PowerPC] Enable MachinePipeliner for P9 with -ppc-enable-pipeliner 2019-06-11 17:40:39 +00:00
HexagonInstrInfo.h [PowerPC] Enable MachinePipeliner for P9 with -ppc-enable-pipeliner 2019-06-11 17:40:39 +00:00
HexagonIntrinsics.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonIntrinsicsV5.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonIntrinsicsV60.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonLoopIdiomRecognition.cpp [opaque pointer types] Pass function types to CallInst creation. 2019-02-01 20:43:25 +00:00
HexagonMCInstLower.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonMachineFunctionInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonMachineFunctionInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonMachineScheduler.cpp Implementation of asm-goto support in LLVM 2019-02-08 20:48:56 +00:00
HexagonMachineScheduler.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonMapAsm2IntrinV62.gen.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonMapAsm2IntrinV65.gen.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonNewValueJump.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonOperands.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonOptAddrMode.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonOptimizeSZextends.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonPatterns.td Change some dyn_cast to more apropriate isa. NFC 2019-04-05 16:16:23 +00:00
HexagonPatternsHVX.td [Hexagon] Remove 'T' from HasVNN predicates, NFC 2018-06-20 13:56:09 +00:00
HexagonPatternsV65.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonPeephole.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonPseudo.td [Hexagon] Use misaligned load instead of trap0(#0) for __builtin_trap 2019-02-21 19:42:39 +00:00
HexagonRDFOpt.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonRegisterInfo.cpp CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
HexagonRegisterInfo.h CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
HexagonRegisterInfo.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonSchedule.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonScheduleV5.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonScheduleV55.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonScheduleV60.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonScheduleV62.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonScheduleV65.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonScheduleV66.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonSelectionDAGInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonSelectionDAGInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonSplitConst32AndConst64.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonSplitDouble.cpp [Hexagon, SystemZ] Be super conservative about atomics 2019-02-24 00:45:09 +00:00
HexagonStoreWidening.cpp [Hexagon] Fix cppcheck reduce variable scope warnings. NFCI. 2019-05-08 11:02:46 +00:00
HexagonSubtarget.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonSubtarget.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonTargetMachine.cpp Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
HexagonTargetMachine.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonTargetObjectFile.cpp OpaquePtr: switch to GlobalValue::getValueType in a few places. NFC. 2019-07-11 13:13:02 +00:00
HexagonTargetObjectFile.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonTargetStreamer.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonTargetTransformInfo.cpp [Hexagon] assert getRegisterBitWidth returns non-zero value. NFCI. 2019-05-22 12:25:46 +00:00
HexagonTargetTransformInfo.h Revert "[System Model] [TTI] Update cache and prefetch TTI interfaces" 2019-07-10 18:25:58 +00:00
HexagonVExtract.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonVLIWPacketizer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonVLIWPacketizer.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HexagonVectorLoopCarriedReuse.cpp [Hexagon] Rework VLCR algorithm 2019-07-01 13:50:47 +00:00
HexagonVectorPrint.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +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
RDFCopy.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RDFCopy.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RDFDeadCode.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RDFDeadCode.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RDFGraph.cpp Hexagon RDF: Replace function template (plus explicit specializations) with non-template overloads 2019-03-11 23:10:33 +00:00
RDFGraph.h Hexagon RDF: Replace function template (plus explicit specializations) with non-template overloads 2019-03-11 23:10:33 +00:00
RDFLiveness.cpp Hexagon RDF: Replace function template (plus explicit specializations) with non-template overloads 2019-03-11 23:10:33 +00:00
RDFLiveness.h Hexagon RDF: Replace function template (plus explicit specializations) with non-template overloads 2019-03-11 23:10:33 +00:00
RDFRegisters.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RDFRegisters.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00