Commit 9e3d9c9e authored by Matt Arsenault's avatar Matt Arsenault
Browse files

clang: Add __builtin_elementwise_sqrt

This will be used in the opencl builtin headers to provide direct
intrinsic access with proper !fpmath metadata.

https://reviews.llvm.org/D156737
parent 43f4e2be
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -643,6 +643,8 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in
 T __builtin_elementwise_bitreverse(T x)     return the integer represented after reversing the bits of x     integer types
 T __builtin_elementwise_exp(T x)            returns the base-e exponential, e^x, of the specified value      floating point types
 T __builtin_elementwise_exp2(T x)           returns the base-2 exponential, 2^x, of the specified value      floating point types

 T __builtin_elementwise_sqrt(T x)           return the square root of a floating-point number                floating point types
 T __builtin_elementwise_roundeven(T x)      round x to the nearest integer value in floating point format,   floating point types
                                             rounding halfway cases to even (that is, to the nearest value
                                             that is an even integer), regardless of the current rounding
+1 −0
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ Floating Point Support in Clang
- Add ``__builtin_set_flt_rounds`` builtin for X86, x86_64, Arm and AArch64 only.
- Add ``__builtin_elementwise_pow`` builtin for floating point types only.
- Add ``__builtin_elementwise_bitreverse`` builtin for integer types only.
- Add ``__builtin_elementwise_sqrt`` builtin for floating point types only.

AST Matchers
------------
+1 −0
Original line number Diff line number Diff line
@@ -694,6 +694,7 @@ BUILTIN(__builtin_elementwise_round, "v.", "nct")
BUILTIN(__builtin_elementwise_rint, "v.", "nct")
BUILTIN(__builtin_elementwise_nearbyint, "v.", "nct")
BUILTIN(__builtin_elementwise_sin, "v.", "nct")
BUILTIN(__builtin_elementwise_sqrt, "v.", "nct")
BUILTIN(__builtin_elementwise_trunc, "v.", "nct")
BUILTIN(__builtin_elementwise_canonicalize, "v.", "nct")
BUILTIN(__builtin_elementwise_copysign, "v.", "nct")
+2 −1
Original line number Diff line number Diff line
@@ -2530,7 +2530,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
    case Builtin::BI__builtin_sqrtf:
    case Builtin::BI__builtin_sqrtf16:
    case Builtin::BI__builtin_sqrtl:
    case Builtin::BI__builtin_sqrtf128: {
    case Builtin::BI__builtin_sqrtf128:
    case Builtin::BI__builtin_elementwise_sqrt: {
      llvm::Value *Call = emitUnaryMaybeConstrainedFPBuiltin(
          *this, E, Intrinsic::sqrt, Intrinsic::experimental_constrained_sqrt);
      SetSqrtFPAccuracy(Call);
+1 −0
Original line number Diff line number Diff line
@@ -2642,6 +2642,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
  case Builtin::BI__builtin_elementwise_rint:
  case Builtin::BI__builtin_elementwise_nearbyint:
  case Builtin::BI__builtin_elementwise_sin:
  case Builtin::BI__builtin_elementwise_sqrt:
  case Builtin::BI__builtin_elementwise_trunc:
  case Builtin::BI__builtin_elementwise_canonicalize: {
    if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
Loading