[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call...
authorSanjay Patel <spatel@rotateright.com>
Thu, 8 Oct 2015 17:09:31 +0000 (17:09 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 8 Oct 2015 17:09:31 +0000 (17:09 +0000)
commit0317b8efaff0addbf14d66583f37483c65e3f7f2
tree15c3a8e2d2d18fa250bab599158a757384670b99
parent1938c39ce4afd671ccf309f08233e2e3dfd8fcdc
[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call (PR24886)

This is a partial fix for PR24886:
https://llvm.org/bugs/show_bug.cgi?id=24886

Without this IR transform, the backend (x86 at least) was producing inefficient code.

This patch is making 2 assumptions:

    1. The canonical form of a fabs() operation is, in fact, the LLVM fabs() intrinsic.
    2. The high bit of an FP value is always the sign bit; as noted in the bug report, this isn't specified by the LangRef.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249702 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/and2.ll