1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/lib
Sanjay Patel b6a12c439f [DAGCombiner] extend(ifpositive(X)) -> shift-right (not X)
This is almost the same as an existing IR canonicalization in instcombine, 
so I'm assuming this is a good early generic DAG combine too.

The motivation comes from reduced bit-hacking for select-of-constants in IR 
after rL331486. We want to restore that functionality in the DAG as noted in
the commit comments for that change and the llvm-dev discussion here:
http://lists.llvm.org/pipermail/llvm-dev/2018-July/124433.html

The PPC and AArch tests show that those targets are already doing something 
similar. x86 will be neutral in the minimal case and generally better when 
this pattern is extended with other ops as shown in the signbit-shift.ll tests.

Note the asymmetry: we don't include the (extend (ifneg X)) transform because 
it already exists in SimplifySelectCC(), and that is verified in the later 
unchanged tests in the signbit-shift.ll files. Without the 'not' op, the 
general transform to use a shift is always a win because that's a single 
instruction.

Alive proofs:
https://rise4fun.com/Alive/ysli

Name: if pos, get -1
  %c = icmp sgt i16 %x, -1
  %r = sext i1 %c to i16
  =>
  %n = xor i16 %x, -1
  %r = ashr i16 %n, 15

Name: if pos, get 1
  %c = icmp sgt i16 %x, -1
  %r = zext i1 %c to i16
  =>
  %n = xor i16 %x, -1
  %r = lshr i16 %n, 15

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

llvm-svn: 337130
2018-07-15 16:27:07 +00:00
..
Analysis [InstSimplify] fold minnum/maxnum with NaN arg 2018-07-15 14:52:16 +00:00
AsmParser [AsmParser] Fix inconsistent declaration parameter name 2018-07-12 02:03:53 +00:00
BinaryFormat [dwarfdump] Add pretty printer for accelerator table based on Atom. 2018-07-13 17:21:51 +00:00
Bitcode [BitcodeReader] Infer the correct runtime preemption for GlobalValue 2018-07-09 16:52:05 +00:00
CodeGen [DAGCombiner] extend(ifpositive(X)) -> shift-right (not X) 2018-07-15 16:27:07 +00:00
DebugInfo [dwarfdump] Add pretty printer for accelerator table based on Atom. 2018-07-13 17:21:51 +00:00
Demangle [demangler] Avoid alignment warning 2018-07-05 06:22:39 +00:00
ExecutionEngine Fix few typos in comments (write access test commit) 2018-07-12 06:41:41 +00:00
Fuzzer
FuzzMutate
IR [NFC] Silence Wparentheses warning in DomTreeUpdater, introduced by 336968 2018-07-13 14:41:15 +00:00
IRReader
LineEditor
Linker [LTO] Fix linking with an alias defined using another alias. 2018-07-13 21:58:55 +00:00
LTO Revert "[ThinLTO] Ensure we always select the same function copy to import" 2018-07-14 01:45:49 +00:00
MC [DWARF v5] Generate range list tables into the .debug_rnglists section. No support for split DWARF 2018-07-12 18:18:21 +00:00
Object [llvm-readobj] Add -hex-dump (-x) option 2018-07-11 10:00:29 +00:00
ObjectYAML [llvm-readobj] Add experimental support for SHT_RELR sections 2018-06-28 21:07:34 +00:00
Option
Passes [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
ProfileData [NFC] Change sample profile format enum name SPF_Raw_Binary to SPF_Binary. 2018-06-12 05:53:49 +00:00
Support [Support] Harded JSON against invalid UTF-8. 2018-07-10 11:51:26 +00:00
TableGen [TableGen] Add missing std::moves to fix build failure. 2018-07-11 08:57:56 +00:00
Target [llvm-mca][BtVer2] teach how to identify false dependencies on partially written 2018-07-15 11:01:38 +00:00
Testing
ToolDrivers Give llvm-lib rudimentary help output. 2018-07-14 02:29:44 +00:00
Transforms [NFC][InstCombine] foldICmpWithLowBitMaskedVal(): update comments. 2018-07-14 20:08:52 +00:00
WindowsManifest
XRay [XRay][compiler-rt] Add PID field to llvm-xray tool and add PID metadata record entry in FDR mode 2018-07-13 05:38:22 +00:00
CMakeLists.txt
LLVMBuild.txt