llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Kai Luo (bzEq) <details> <summary>Changes</summary> `ca` is not accepted in clobber list of inline assembly right now. Make `ca` aliased to `xer`, so it can be accepted in clobber list. Fixes #<!-- -->77549. --- Full diff: https://github.com/llvm/llvm-project/pull/77557.diff 2 Files Affected: - (modified) clang/lib/Basic/Targets/PPC.cpp (+4-1) - (added) clang/test/CodeGen/ppc-register-names.c (+14) ``````````diff diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 045c273f03c7a0..abf685f8883971 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -782,6 +782,9 @@ ArrayRef<const char *> PPCTargetInfo::getGCCRegNames() const { const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = { // While some of these aliases do map to different registers // they still share the same register name. + // Strictly speaking, "ca" is a subregister of "xer". However + // currently we don't model other bit fields of "xer", so treat + // "ca" aliasing to "xer". {{"0"}, "r0"}, {{"1", "sp"}, "r1"}, {{"2"}, "r2"}, {{"3"}, "r3"}, {{"4"}, "r4"}, {{"5"}, "r5"}, {{"6"}, "r6"}, {{"7"}, "r7"}, {{"8"}, "r8"}, @@ -803,7 +806,7 @@ const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = { {{"fr22"}, "f22"}, {{"fr23"}, "f23"}, {{"fr24"}, "f24"}, {{"fr25"}, "f25"}, {{"fr26"}, "f26"}, {{"fr27"}, "f27"}, {{"fr28"}, "f28"}, {{"fr29"}, "f29"}, {{"fr30"}, "f30"}, - {{"fr31"}, "f31"}, {{"cc"}, "cr0"}, + {{"fr31"}, "f31"}, {{"cc"}, "cr0"}, {{"ca"}, "xer"}, }; ArrayRef<TargetInfo::GCCRegAlias> PPCTargetInfo::getGCCRegAliases() const { diff --git a/clang/test/CodeGen/ppc-register-names.c b/clang/test/CodeGen/ppc-register-names.c new file mode 100644 index 00000000000000..209488c2e5f1ae --- /dev/null +++ b/clang/test/CodeGen/ppc-register-names.c @@ -0,0 +1,14 @@ +// REQUIRES: powerpc-registered-target +// RUN: %clang -target powerpc64le -c %s -mllvm -stop-after=finalize-isel -o - | \ +// RUN: FileCheck %s +// RUN: %clang -target powerpc64 -c %s -mllvm -stop-after=finalize-isel -o - | \ +// RUN: FileCheck %s + +void test_function(void) { + asm volatile("":::"ca"); + asm volatile("":::"xer"); + // CHECK: call void asm sideeffect "", "~{xer}"() + // CHECK: call void asm sideeffect "", "~{xer}"() + // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $xer + // CHECK: INLINEASM &"", {{.*}} implicit-def early-clobber $xer +} `````````` </details> https://github.com/llvm/llvm-project/pull/77557 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits