[clang] b8979c6 - [PPC][InlineASM] Mark the 'a' constraint as unsupported (#96109)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 05:33:28 PDT 2024


Author: Kamau Bridgeman
Date: 2024-06-24T08:33:25-04:00
New Revision: b8979c6b13e9d4cb5051dd6f8ca772a20b14b428

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

LOG: [PPC][InlineASM] Mark the 'a' constraint as unsupported (#96109)

'a' is an input/output constraint for restraining assembly variables
to an indexed or indirect address operand. It previously was marked
as supported but would throw an assertion for unknown constraint type
in the back-end when this test case was compiled. This change marks it
as unsupported until we can add full support for address operands
constraining to the compiler code generation.

Added: 
    clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c

Modified: 
    clang/lib/Basic/Targets/PPC.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index fc23c30c68523..e4d6a02386da5 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -305,9 +305,11 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
               // asm statements)
       Info.setAllowsMemory();
       break;
-    case 'R': // AIX TOC entry
     case 'a': // Address operand that is an indexed or indirect from a
               // register (`p' is preferable for asm statements)
+              // TODO: Add full support for this constraint
+      return false;
+    case 'R': // AIX TOC entry
     case 'S': // Constant suitable as a 64-bit mask operand
     case 'T': // Constant suitable as a 32-bit mask operand
     case 'U': // System V Release 4 small data area reference

diff  --git a/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c b/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c
new file mode 100644
index 0000000000000..eb443eee40e55
--- /dev/null
+++ b/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64-ibm-aix-xcoff -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc-ibm-aix-xcoff -verify %s
+// This test case exist to test marking the 'a' inline assembly constraint as
+// unsupported because powerpc previously marked it as supported.
+int foo(int arg){
+  asm goto ("bc 12,2,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); //expected-error {{invalid input constraint 'a' in asm}}
+  return 0;
+TEST_LABEL: return arg + 1;
+}


        


More information about the cfe-commits mailing list