[clang] 54186d3 - [clang] add __has_extension(gnu_asm_goto_with_outputs_full)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 16 18:04:09 PST 2023


Author: Nick Desaulniers
Date: 2023-02-16T17:58:35-08:00
New Revision: 54186d33c3a0d4834d2e5f95640b63677f5b5142

URL: https://github.com/llvm/llvm-project/commit/54186d33c3a0d4834d2e5f95640b63677f5b5142
DIFF: https://github.com/llvm/llvm-project/commit/54186d33c3a0d4834d2e5f95640b63677f5b5142.diff

LOG: [clang] add __has_extension(gnu_asm_goto_with_outputs_full)

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

Added: 
    

Modified: 
    clang/docs/LanguageExtensions.rst
    clang/include/clang/Basic/Features.def
    clang/test/Parser/asm-goto.c

Removed: 
    


################################################################################
diff  --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 0e3aec0584126..2d1b8af40bbb6 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -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 
diff erence 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 @@ 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
 ====================
 

diff  --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def
index 0581c61dcba3b..56f0b04c6a467 100644
--- a/clang/include/clang/Basic/Features.def
+++ b/clang/include/clang/Basic/Features.def
@@ -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)

diff  --git a/clang/test/Parser/asm-goto.c b/clang/test/Parser/asm-goto.c
index f9ad6c5ee9a40..c4cb967907bf2 100644
--- 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;
 


        


More information about the cfe-commits mailing list