Skip to content

Commit

Permalink
[clang] add __has_extension(gnu_asm_goto_with_outputs_full)
Browse files Browse the repository at this point in the history
Also move the line about __has_extension(gnu_asm_goto_with_outputs) so
that it is more generally about asm goto, not the paragraph on symbolic
references.

Reviewed By: efriedma, void

Differential Revision: https://reviews.llvm.org/D143205
  • Loading branch information
nickdesaulniers committed Feb 17, 2023
1 parent af66563 commit 54186d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clang/docs/LanguageExtensions.rst
Expand Up @@ -1591,6 +1591,12 @@ ASM Goto with Output Constraints
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.
Expand Down Expand Up @@ -1618,8 +1624,6 @@ references can be used instead of numeric references.
return -1;
}

Query for this feature with ``__has_extension(gnu_asm_goto_with_outputs)``.

Objective-C Features
====================

Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/Features.def
Expand Up @@ -268,6 +268,7 @@ EXTENSION(pragma_clang_attribute_external_declaration, true)
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)
Expand Down
3 changes: 3 additions & 0 deletions clang/test/Parser/asm-goto.c
Expand Up @@ -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;

Expand Down

0 comments on commit 54186d3

Please sign in to comment.