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.
This commit is contained in:
Jim Lin 2019-12-10 19:06:28 +08:00
parent 0e894edee1
commit 9c39663798
1 changed files with 2 additions and 1 deletions

View File

@ -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) ||