hfinkel added a comment.

In https://reviews.llvm.org/D39481#914174, @craig.topper wrote:

> There's an oddity with fma. The version without __builtin has 'e' already


Something that is potentially relevant: POSIX says that fma() can set errno 
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/fma.html), however, 
the glibc man page says that its fma() does not set errno 
(https://linux.die.net/man/3/fma).

> 
> 
>   LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES)
>   LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES)
>   LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES)
> 
> 
> But we don't check the const attribute in CGBuiltin.cpp before converting it 
> to an intrinsic
> 
>   case Builtin::BIfma:
>   case Builtin::BIfmaf:
>   case Builtin::BIfmal:
>   case Builtin::BI__builtin_fma:
>   case Builtin::BI__builtin_fmaf:
>   case Builtin::BI__builtin_fmal: {
>     // Rewrite fma to intrinsic.
>     Value *FirstArg = EmitScalarExpr(E->getArg(0));
>     llvm::Type *ArgType = FirstArg->getType();
>     Value *F = CGM.getIntrinsic(Intrinsic::fma, ArgType);
>     return RValue::get(
>         Builder.CreateCall(F, {FirstArg, EmitScalarExpr(E->getArg(1)),
>                                EmitScalarExpr(E->getArg(2))}));
>   }
>    




https://reviews.llvm.org/D39481



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to