llvm-6502/lib
Ahmed Bougacha 4d962b05ca [X86] Improve mul w/ overflow codegen, to MUL8+SETO.
Currently, @llvm.smul.with.overflow.i8 expands to 9 instructions, where
3 are really needed.

This adds X86ISD::UMUL8/SMUL8 SD nodes, and custom lowers them to
MUL8/IMUL8 + SETO.

i8 is a special case because there is no two/three operand variants of
(I)MUL8, so the first operand and return value need to go in AL/AX.

Also, we can't write patterns for these instructions: TableGen refuses
patterns where output operands don't match SDNode results. In this case,
instructions where the output operand is an implicitly defined register.

A related special case (and FIXME) exists for MUL8 (X86InstrArith.td):

  // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
  // This probably ought to be moved to a def : Pat<> if the
  // syntax can be accepted.
  [(set AL, (mul AL, GR8:$src)), (implicit EFLAGS)]

Ideally, these go away with UMUL8, but we still need to improve TableGen
support of implicit operands in patterns.

Before this change:
  movsbl  %sil, %eax
  movsbl  %dil, %ecx
  imull   %eax, %ecx
  movb    %cl, %al
  sarb    $7, %al
  movzbl  %al, %eax
  movzbl  %ch, %esi
  cmpl    %eax, %esi
  setne   %al

After:
  movb    %dil, %al
  imulb   %sil
  seto    %al

Also, remove a made-redundant testcase for PR19858, and enable more FastISel
ALU-overflow tests for SelectionDAG too.

Differential Revision: http://reviews.llvm.org/D5809


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220516 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 21:55:31 +00:00
..
Analysis [InstSimplify] Support constant folding to vector of pointers 2014-10-22 12:18:48 +00:00
AsmParser
Bitcode clang-format two code snippets to make the next patch easy to read. 2014-10-23 15:20:05 +00:00
CodeGen DebugInfo: Remove DwarfDebug::addCurrentFnArgument declaration now that it's moved to DwarfFile. 2014-10-23 21:53:17 +00:00
DebugInfo [dwarfdump] Dump DW_AT_ranges values inline in the debug_info dump. 2014-10-23 04:08:34 +00:00
ExecutionEngine [MCJIT] Make repeat calls to MCJIT::getPointerToFunction for declarations safe. 2014-10-22 23:18:42 +00:00
IR Revert "Don't count inreg params when mangling fastcall functions" 2014-10-23 17:50:42 +00:00
IRReader
LineEditor
Linker
LTO
MC Attempt to fix the build after r220439 2014-10-22 22:46:05 +00:00
Object Update llvm-objdump’s Mach-O symbolizer code for Objective-C references. 2014-10-23 19:37:31 +00:00
Option
ProfileData
Support Modernize doxygen comments in Support/Dwarf.h 2014-10-23 04:08:38 +00:00
TableGen
Target [X86] Improve mul w/ overflow codegen, to MUL8+SETO. 2014-10-23 21:55:31 +00:00
Transforms Handle sqrt() shrinking in SimplifyLibCalls like any other call 2014-10-23 21:52:45 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile