When unsafe math is used, we can use commutative FMAX and FMIN. In some cases
authorNadav Rotem <nrotem@apple.com>
Sun, 19 Aug 2012 13:06:16 +0000 (13:06 +0000)
committerNadav Rotem <nrotem@apple.com>
Sun, 19 Aug 2012 13:06:16 +0000 (13:06 +0000)
commitd60cb11afd709b9f84c58d8335cbc08ad912b236
tree8308b69511649b732cda459b7aa7d3dc0e9f2314
parent51bfb0fe50405bfbb14abf8ceb6ea8d0f67d7057
When unsafe math is used, we can use commutative FMAX and FMIN. In some cases
this allows for better code generation.

Added a new DAGCombine transformation to convert FMAX and FMIN to FMANC and
FMINC, which are commutative.

For example:

  movaps  %xmm0, %xmm1
  movsd LC(%rip), %xmm0
  minsd %xmm1, %xmm0

becomes:

  minsd LC(%rip), %xmm0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162187 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86InstrFragmentsSIMD.td
lib/Target/X86/X86InstrSSE.td
test/CodeGen/X86/sse-minmax.ll