summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-05-16 13:43:25 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-05-16 13:43:25 +0000
commit0d9dcd7bf01fad7b85840a0d1e265b6362e9763d (patch)
tree5823b8131b45e70ad9463846fe53496c686f7290 /clang/lib/CodeGen/CGBuiltin.cpp
parentaf8cda15decac903e884015e49a043c4d58e0910 (diff)
downloadbcm5719-llvm-0d9dcd7bf01fad7b85840a0d1e265b6362e9763d.tar.gz
bcm5719-llvm-0d9dcd7bf01fad7b85840a0d1e265b6362e9763d.zip
[clang] Handle lround/llround builtins
As for other floating-point rounding builtins that can be optimized when build with -fno-math-errno, this patch adds support for lround and llround. It currently only optimize for AArch64 backend. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D61392 llvm-svn: 360896
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 048103275d5..8e707204319 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1721,6 +1721,27 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
case Builtin::BI__builtin_truncl:
return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::trunc));
+ case Builtin::BIlround:
+ case Builtin::BIlroundf:
+ case Builtin::BIlroundl:
+ case Builtin::BI__builtin_lround:
+ case Builtin::BI__builtin_lroundf:
+ case Builtin::BI__builtin_lroundl: {
+ llvm::Type *ResultType = ConvertType(E->getType());
+ int Width = ResultType->getPrimitiveSizeInBits();
+ return RValue::get(emitUnaryBuiltin(*this, E,
+ Width == 32 ? Intrinsic::lround_i32
+ : Intrinsic::lround_i64));
+ }
+
+ case Builtin::BIllround:
+ case Builtin::BIllroundf:
+ case Builtin::BIllroundl:
+ case Builtin::BI__builtin_llround:
+ case Builtin::BI__builtin_llroundf:
+ case Builtin::BI__builtin_llroundl:
+ return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::llround));
+
default:
break;
}
OpenPOWER on IntegriCloud