Index: clang/include/clang/Basic/Builtins.def =================================================================== --- clang/include/clang/Basic/Builtins.def +++ clang/include/clang/Basic/Builtins.def @@ -245,6 +245,11 @@ BUILTIN(__builtin_exp2f16, "hh" , "Fne") BUILTIN(__builtin_exp2l, "LdLd", "Fne") BUILTIN(__builtin_exp2f128, "LLdLLd" , "Fne") +BUILTIN(__builtin_exp10 , "dd" , "Fne") +BUILTIN(__builtin_exp10f, "ff" , "Fne") +BUILTIN(__builtin_exp10f16, "hh" , "Fne") +BUILTIN(__builtin_exp10l, "LdLd", "Fne") +BUILTIN(__builtin_exp10f128, "LLdLLd" , "Fne") BUILTIN(__builtin_expm1 , "dd", "Fne") BUILTIN(__builtin_expm1f, "ff", "Fne") BUILTIN(__builtin_expm1l, "LdLd", "Fne") Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -2341,7 +2341,16 @@ return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(*this, E, Intrinsic::exp2, Intrinsic::experimental_constrained_exp2)); - + case Builtin::BI__builtin_exp10: + case Builtin::BI__builtin_exp10f: + case Builtin::BI__builtin_exp10f16: + case Builtin::BI__builtin_exp10l: + case Builtin::BI__builtin_exp10f128: { + // TODO: strictfp support + if (Builder.getIsFPConstrained()) + break; + return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::exp10)); + } case Builtin::BIfabs: case Builtin::BIfabsf: case Builtin::BIfabsl: Index: clang/test/CodeGen/constrained-math-builtins.c =================================================================== --- clang/test/CodeGen/constrained-math-builtins.c +++ clang/test/CodeGen/constrained-math-builtins.c @@ -64,6 +64,13 @@ // CHECK: call x86_fp80 @llvm.experimental.constrained.exp2.f80(x86_fp80 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict") // CHECK: call fp128 @llvm.experimental.constrained.exp2.f128(fp128 %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict") + __builtin_exp10(f); __builtin_exp10f(f); __builtin_exp10l(f); __builtin_exp10f128(f); + +// CHECK: call double @exp10(double noundef %{{.*}}) +// CHECK: call float @exp10f(float noundef %{{.*}}) +// CHECK: call x86_fp80 @exp10l(x86_fp80 noundef %{{.*}}) +// CHECK: call fp128 @exp10f128(fp128 noundef %{{.*}}) + __builtin_floor(f); __builtin_floorf(f); __builtin_floorl(f); __builtin_floorf128(f); // CHECK: call double @llvm.experimental.constrained.floor.f64(double %{{.*}}, metadata !"fpexcept.strict") @@ -223,6 +230,11 @@ // CHECK: declare x86_fp80 @llvm.experimental.constrained.exp2.f80(x86_fp80, metadata, metadata) // CHECK: declare fp128 @llvm.experimental.constrained.exp2.f128(fp128, metadata, metadata) +// CHECK: declare double @exp10(double noundef) +// CHECK: declare float @exp10f(float noundef) +// CHECK: declare x86_fp80 @exp10l(x86_fp80 noundef) +// CHECK: declare fp128 @exp10f128(fp128 noundef) + // CHECK: declare double @llvm.experimental.constrained.floor.f64(double, metadata) // CHECK: declare float @llvm.experimental.constrained.floor.f32(float, metadata) // CHECK: declare x86_fp80 @llvm.experimental.constrained.floor.f80(x86_fp80, metadata) Index: clang/test/CodeGen/math-builtins.c =================================================================== --- clang/test/CodeGen/math-builtins.c +++ clang/test/CodeGen/math-builtins.c @@ -318,6 +318,17 @@ // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80 noundef) [[NOT_READNONE]] // HAS_ERRNO: declare fp128 @exp2f128(fp128 noundef) [[NOT_READNONE]] +__builtin_exp10(f); __builtin_exp10f(f); __builtin_exp10l(f); __builtin_exp10f128(f); + +// NO__ERRNO: declare double @llvm.exp10.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare float @llvm.exp10.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare x86_fp80 @llvm.exp10.f80(x86_fp80) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare fp128 @llvm.exp10.f128(fp128) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare double @exp10(double noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare float @exp10f(float noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare x86_fp80 @exp10l(x86_fp80 noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare fp128 @exp10f128(fp128 noundef) [[NOT_READNONE]] + __builtin_expm1(f); __builtin_expm1f(f); __builtin_expm1l(f); __builtin_expm1f128(f); // NO__ERRNO: declare double @expm1(double noundef) [[READNONE]] Index: clang/test/CodeGenOpenCL/builtins-f16.cl =================================================================== --- clang/test/CodeGenOpenCL/builtins-f16.cl +++ clang/test/CodeGenOpenCL/builtins-f16.cl @@ -24,6 +24,9 @@ // CHECK: call half @llvm.exp2.f16(half %h0) res = __builtin_exp2f16(h0); + // CHECK: call half @llvm.exp10.f16(half %h0) + res = __builtin_exp10f16(h0); + // CHECK: call half @llvm.floor.f16(half %h0) res = __builtin_floorf16(h0);