diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -1591,6 +1591,12 @@ Outputs may be used along any branches from the ``asm goto`` whether the branches are taken or not. +Query for this feature with ``__has_extension(gnu_asm_goto_with_outputs)``. + +Prior to clang-16, the output may only be used safely when the indirect +branches are not taken. Query for this difference with +``__has_extension(gnu_asm_goto_with_outputs_full)``. + When using tied-outputs (i.e. outputs that are inputs and outputs, not just outputs) with the `+r` constraint, there is a hidden input that's created before the label, so numeric references to operands must account for that. @@ -1618,8 +1624,6 @@ return -1; } -Query for this feature with ``__has_extension(gnu_asm_goto_with_outputs)``. - Objective-C Features ==================== diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def --- a/clang/include/clang/Basic/Features.def +++ b/clang/include/clang/Basic/Features.def @@ -268,6 +268,7 @@ EXTENSION(statement_attributes_with_gnu_syntax, true) EXTENSION(gnu_asm, LangOpts.GNUAsm) EXTENSION(gnu_asm_goto_with_outputs, LangOpts.GNUAsm) +EXTENSION(gnu_asm_goto_with_outputs_full, LangOpts.GNUAsm) EXTENSION(matrix_types, LangOpts.MatrixTypes) EXTENSION(matrix_types_scalar_division, true) EXTENSION(cxx_attributes_on_using_declarations, LangOpts.CPlusPlus11) diff --git a/clang/test/Parser/asm-goto.c b/clang/test/Parser/asm-goto.c --- a/clang/test/Parser/asm-goto.c +++ b/clang/test/Parser/asm-goto.c @@ -7,6 +7,9 @@ #if !__has_extension(gnu_asm_goto_with_outputs) #error Extension 'gnu_asm_goto_with_outputs' should be available by default #endif +#if !__has_extension(gnu_asm_goto_with_outputs_full) +#error Extension 'gnu_asm_goto_with_outputs_full' should be available by default +#endif int a, b, c, d, e, f, g, h, i, j, k, l;