diff options
author | Joey Gouly <joey.gouly@arm.com> | 2013-08-23 12:01:13 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@arm.com> | 2013-08-23 12:01:13 +0000 |
commit | e3dd684aadcaba6993e0d91734cc4cc62ff4de87 (patch) | |
tree | 25a5ac9388aa8de9ac73aabe2bc32d18b756fcb8 /llvm/lib/Target/ARM/ARMISelLowering.cpp | |
parent | f438cb761945d49111ed96fc3a25cc8e5da722a0 (diff) | |
download | bcm5719-llvm-e3dd684aadcaba6993e0d91734cc4cc62ff4de87.tar.gz bcm5719-llvm-e3dd684aadcaba6993e0d91734cc4cc62ff4de87.zip |
[ARMv8] Add CodeGen for VMAXNM/VMINNM.
llvm-svn: 189103
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 7021941076f..74353c1788a 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -1069,6 +1069,8 @@ const char *ARMTargetLowering::getTargetNodeName(unsigned Opcode) const { case ARMISD::BUILD_VECTOR: return "ARMISD::BUILD_VECTOR"; case ARMISD::FMAX: return "ARMISD::FMAX"; case ARMISD::FMIN: return "ARMISD::FMIN"; + case ARMISD::VMAXNM: return "ARMISD::VMAX"; + case ARMISD::VMINNM: return "ARMISD::VMIN"; case ARMISD::BFI: return "ARMISD::BFI"; case ARMISD::VORRIMM: return "ARMISD::VORRIMM"; case ARMISD::VBICIMM: return "ARMISD::VBICIMM"; @@ -3276,6 +3278,20 @@ SDValue ARMTargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const { // Try to generate VSEL on ARMv8. if (getSubtarget()->hasV8FP() && (TrueVal.getValueType() == MVT::f32 || TrueVal.getValueType() == MVT::f64)) { + // We can select VMAXNM/VMINNM from a compare followed by a select with the + // same operands, as follows: + // c = fcmp [ogt, olt, ugt, ult] a, b + // select c, a, b + // We only do this in unsafe-fp-math, because signed zeros and NaNs are + // handled differently than the original code sequence. + if (getTargetMachine().Options.UnsafeFPMath && LHS == TrueVal && + RHS == FalseVal) { + if (CC == ISD::SETOGT || CC == ISD::SETUGT) + return DAG.getNode(ARMISD::VMAXNM, dl, VT, TrueVal, FalseVal); + if (CC == ISD::SETOLT || CC == ISD::SETULT) + return DAG.getNode(ARMISD::VMINNM, dl, VT, TrueVal, FalseVal); + } + bool swpCmpOps = false; bool swpVselOps = false; checkVSELConstraints(CC, CondCode, swpCmpOps, swpVselOps); |