[RISCV] Add target DAG combine for bitcast fabs/fneg on RV32FD
authorAlex Bradbury <asb@lowrisc.org>
Fri, 25 Jan 2019 21:55:48 +0000 (21:55 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Fri, 25 Jan 2019 21:55:48 +0000 (21:55 +0000)
commit0092df0669635b38f2eff107ff1eb21850588d13
tree3e960e05b5655927c56fa4c54dabc2c24727f479
parent519f42d914cce404febe6e619c8213588cb68730
[RISCV] Add target DAG combine for bitcast fabs/fneg on RV32FD

DAGCombiner::visitBITCAST will perform:
 fold (bitconvert (fneg x)) -> (xor (bitconvert x), signbit)
 fold (bitconvert (fabs x)) -> (and (bitconvert x), (not signbit))

As shown in double-bitmanip-dagcombines.ll, this can be advantageous. But
RV32FD doesn't use bitcast directly (as i64 isn't a legal type), and instead
uses RISCVISD::SplitF64. This patch adds an equivalent DAG combine for
SplitF64.

llvm-svn: 352247
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/double-arith.ll
llvm/test/CodeGen/RISCV/double-bitmanip-dagcombines.ll
llvm/test/CodeGen/RISCV/double-intrinsics.ll