Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -839,13 +839,13 @@ of different sizes and signs is forbidden in binary and ternary builtins.
T __builtin_elementwise_copysign(T x, T y) return the magnitude of x with the sign of y. floating point types
T __builtin_elementwise_fmod(T x, T y) return the floating-point remainder of (x/y) whose sign floating point types
matches the sign of x.
T __builtin_elementwise_max(T x, T y) return x or y, whichever is larger integer and floating point types
For floating point types, follows semantics of maxNum
T __builtin_elementwise_max(T x, T y) return x or y, whichever is larger integer
For floating point types, follows semantics of maxNum floating point types (deprecated)
in IEEE 754-2008. See `LangRef
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
for the comparison.
T __builtin_elementwise_min(T x, T y) return x or y, whichever is smaller integer and floating point types
For floating point types, follows semantics of minNum
T __builtin_elementwise_min(T x, T y) return x or y, whichever is smaller integer
For floating point types, follows semantics of minNum floating point types (deprecated)
in IEEE 754-2008. See `LangRef
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
for the comparison.
Expand Down
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ Non-comprehensive list of changes in this release
extends bit-reversal support to all standard integers type, including
``_BitInt``

- Deprecated float types support from ``__builtin_elementwise_max`` and
``__builtin_elementwise_min``.

New Compiler Flags
------------------
- New option ``-fms-anonymous-structs`` / ``-fno-ms-anonymous-structs`` added
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticFrontendKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def warn_fe_backend_invalid_feature_flag : Warning<
def warn_fe_backend_readonly_feature_flag : Warning<
"feature flag '%0' is ignored since the feature is read only">,
InGroup<InvalidCommandLineArgument>;
def warn_deprecated_float_builtin : Warning<"builtin %0 is deprecated; use %1 instead">,
Comment thread
wzssyqa marked this conversation as resolved.
Outdated
InGroup<DeprecatedBuiltins>;

def err_incompatible_fp_eval_method_options : Error<
"option 'ffp-eval-method' cannot be used with option "
Expand Down
14 changes: 12 additions & 2 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4089,8 +4089,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Result = Builder.CreateBinaryIntrinsic(
Ty->isSignedIntegerType() ? Intrinsic::smax : Intrinsic::umax, Op0,
Op1, nullptr, "elt.max");
} else
} else {
DiagnosticsEngine &Diags = CGM.getDiags();
Diags.Report(E->getBeginLoc(), diag::warn_deprecated_float_builtin)
<< "__builtin_elementwise_max"
<< "__builtin_elementwise_maxnum/maximum/maximumnum";
Comment thread
wzssyqa marked this conversation as resolved.
Outdated
Result = Builder.CreateMaxNum(Op0, Op1, /*FMFSource=*/nullptr, "elt.max");
}
return RValue::get(Result);
}
case Builtin::BI__builtin_elementwise_min: {
Expand All @@ -4104,8 +4109,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Result = Builder.CreateBinaryIntrinsic(
Ty->isSignedIntegerType() ? Intrinsic::smin : Intrinsic::umin, Op0,
Op1, nullptr, "elt.min");
} else
} else {
DiagnosticsEngine &Diags = CGM.getDiags();
Diags.Report(E->getBeginLoc(), diag::warn_deprecated_float_builtin)
<< "__builtin_elementwise_min"
<< "__builtin_elementwise_minnum/minimum/minimumnum";
Result = Builder.CreateMinNum(Op0, Op1, /*FMFSource=*/nullptr, "elt.min");
}
return RValue::get(Result);
}

Expand Down
2 changes: 1 addition & 1 deletion libclc/clc/lib/generic/math/clc_fdim.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fdim(__CLC_GENTYPE x,
__CLC_GENTYPE y) {
return __clc_select(__builtin_elementwise_max(x - y, __CLC_FP_LIT(0.0)),
return __clc_select(__builtin_elementwise_maxnum(x - y, __CLC_FP_LIT(0.0)),
__CLC_GENTYPE_NAN,
__CLC_CONVERT_BIT_INTN(__clc_isnan(x) || __clc_isnan(y)));
}