]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
x86: Define __APX_INLINE_ASM_USE_GPR32__
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 9 Apr 2024 01:57:49 +0000 (18:57 -0700)
committerH.J. Lu <(no_default)>
Tue, 9 Apr 2024 02:42:36 +0000 (19:42 -0700)
Define __APX_INLINE_ASM_USE_GPR32__ for -mapx-inline-asm-use-gpr32.
When __APX_INLINE_ASM_USE_GPR32__ is defined, inline asm statements
should contain only instructions compatible with r16-r31.

gcc/

PR target/114587
* config/i386/i386-c.cc (ix86_target_macros_internal): Define
__APX_INLINE_ASM_USE_GPR32__ for -mapx-inline-asm-use-gpr32.

gcc/testsuite/

PR target/114587
* gcc.target/i386/apx-3.c: Likewise.

gcc/config/i386/i386-c.cc
gcc/testsuite/gcc.target/i386/apx-3.c [new file with mode: 0644]

index 226d277676cafd797dcfaea12e361d6be65074fc..07f4936ba9101b84ba0737178e6a48ddcbab532d 100644 (file)
@@ -751,6 +751,8 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
     def_or_undef (parse_in, "__AVX10_1_512__");
   if (isa_flag2 & OPTION_MASK_ISA2_APX_F)
     def_or_undef (parse_in, "__APX_F__");
+  if (ix86_apx_inline_asm_use_gpr32)
+    def_or_undef (parse_in, "__APX_INLINE_ASM_USE_GPR32__");
   if (TARGET_IAMCU)
     {
       def_or_undef (parse_in, "__iamcu");
diff --git a/gcc/testsuite/gcc.target/i386/apx-3.c b/gcc/testsuite/gcc.target/i386/apx-3.c
new file mode 100644 (file)
index 0000000..1ba4ac0
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mapx-inline-asm-use-gpr32" } */
+
+#ifndef __APX_INLINE_ASM_USE_GPR32__
+# error __APX_INLINE_ASM_USE_GPR32__ not defined
+#endif