diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-04-14 07:13:24 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-04-14 07:13:24 +0000 |
commit | 0f26b0aeb4a91418d4c273bb25ab22f3b416a960 (patch) | |
tree | f4a1cfadf86bfb6a4a6aa20c9df02cea75ebfbef /llvm/lib/Analysis/TargetTransformInfo.cpp | |
parent | d871531687b062862234a3346b50f1824e27ed3b (diff) | |
download | llvm-0f26b0aeb4a91418d4c273bb25ab22f3b416a960.zip llvm-0f26b0aeb4a91418d4c273bb25ab22f3b416a960.tar.gz llvm-0f26b0aeb4a91418d4c273bb25ab22f3b416a960.tar.bz2 |
[CodeGen] Teach LLVM how to lower @llvm.{min,max}num to {MIN,MAX}NAN
The behavior of {MIN,MAX}NAN differs from that of {MIN,MAX}NUM when only
one of the inputs is NaN: -NUM will return the non-NaN argument while
-NAN would return NaN.
It is desirable to lower to @llvm.{min,max}num to -NAN if they don't
have a native instruction for -NUM. Notably, ARMv7 NEON's vmin has the
-NAN semantics.
N.B. Of course, it is only safe to do this if the intrinsic call is
marked nnan.
llvm-svn: 266279
Diffstat (limited to 'llvm/lib/Analysis/TargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/TargetTransformInfo.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index b64d413..48e441b 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -315,15 +315,17 @@ int TargetTransformInfo::getInterleavedMemoryOpCost( } int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, - ArrayRef<Type *> Tys) const { - int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Tys); + ArrayRef<Type *> Tys, + FastMathFlags FMF) const { + int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Tys, FMF); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, - ArrayRef<Value *> Args) const { - int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Args); + ArrayRef<Value *> Args, + FastMathFlags FMF) const { + int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Args, FMF); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } |