aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Lin <tclin914@gmail.com>2019-12-10 19:06:28 +0800
committerJim Lin <tclin914@gmail.com>2019-12-10 19:15:11 +0800
commit9c3966379813c198129c57aa3ebecd68d6af1ebd (patch)
tree9c83148684f4e24b08c41462ad2fde86c0d3fbf2
parent0e894edee18f74ae66598f2121d8bfb909f6288e (diff)
downloadllvm-9c3966379813c198129c57aa3ebecd68d6af1ebd.zip
llvm-9c3966379813c198129c57aa3ebecd68d6af1ebd.tar.gz
llvm-9c3966379813c198129c57aa3ebecd68d6af1ebd.tar.bz2
Only Remove implicit conversion for the target that support fp16
Remove implicit conversion that promotes half to double for the target that support fp16. If the target doesn't support fp16, fp16 will be converted to fp16 intrinsic.
-rw-r--r--clang/lib/Sema/SemaChecking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 2be9eff..aff63ae 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5822,7 +5822,8 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
"promotion from float to either float, double, or long double is "
"the only expected cast here");
IgnoreCast = true;
- } else if (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half)) {
+ } else if (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half) &&
+ !Context.getTargetInfo().useFP16ConversionIntrinsics()) {
assert(
(Cast->getType()->isSpecificBuiltinType(BuiltinType::Double) ||
Cast->getType()->isSpecificBuiltinType(BuiltinType::Float) ||