[SystemZ] Improve use of conditional instructions
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 28 Nov 2016 13:34:08 +0000 (13:34 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 28 Nov 2016 13:34:08 +0000 (13:34 +0000)
commit524f276c744e15e17e2384f03933390d1957b2dc
tree2825ca78c72e71fe14eba2d4fba22746a8ae8363
parent79724fc0ae09671b2e75e6b1345c1e3fe6e49d1d
[SystemZ] Improve use of conditional instructions

This patch moves formation of LOC-type instructions from (late)
IfConversion to the early if-conversion pass, and in some cases
additionally creates them directly from select instructions
during DAG instruction selection.

To make early if-conversion work, the patch implements the
canInsertSelect / insertSelect callbacks.  It also implements
the commuteInstructionImpl and FoldImmediate callbacks to
enable generation of the full range of LOC instructions.

Finally, the patch adds support for all instructions of the
load-store-on-condition-2 facility, which allows using LOC
instructions also for high registers.

Due to the use of the GRX32 register class to enable high registers,
we now also have to handle the cases where there are still no single
hardware instructions (conditional move from a low register to a high
register or vice versa).  These are converted back to a branch sequence
after register allocation.  Since the expandRAPseudos callback is not
allowed to create new basic blocks, this requires a simple new pass,
modelled after the ARM/AArch64 ExpandPseudos pass.

Overall, this patch causes significantly more LOC-type instructions
to be used, and results in a measurable performance improvement.

llvm-svn: 288028
26 files changed:
llvm/lib/Target/SystemZ/CMakeLists.txt
llvm/lib/Target/SystemZ/SystemZ.h
llvm/lib/Target/SystemZ/SystemZExpandPseudo.cpp [new file with mode: 0644]
llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/lib/Target/SystemZ/SystemZInstrFormats.td
llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
llvm/lib/Target/SystemZ/SystemZInstrInfo.h
llvm/lib/Target/SystemZ/SystemZInstrInfo.td
llvm/lib/Target/SystemZ/SystemZScheduleZ13.td
llvm/lib/Target/SystemZ/SystemZScheduleZ196.td
llvm/lib/Target/SystemZ/SystemZScheduleZEC12.td
llvm/lib/Target/SystemZ/SystemZSubtarget.h
llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
llvm/test/CodeGen/SystemZ/cond-li.ll [deleted file]
llvm/test/CodeGen/SystemZ/cond-load-01.ll
llvm/test/CodeGen/SystemZ/cond-load-03.ll [new file with mode: 0644]
llvm/test/CodeGen/SystemZ/cond-move-01.ll
llvm/test/CodeGen/SystemZ/cond-move-02.ll [new file with mode: 0644]
llvm/test/CodeGen/SystemZ/cond-move-03.ll [new file with mode: 0644]
llvm/test/CodeGen/SystemZ/cond-store-07.ll
llvm/test/CodeGen/SystemZ/cond-store-09.ll [new file with mode: 0644]
llvm/test/MC/Disassembler/SystemZ/insns-z13.txt
llvm/test/MC/SystemZ/insn-bad-z13.s
llvm/test/MC/SystemZ/insn-good-z13.s