Skip to content

Commit 328c3e3

Browse files
koachangithub-actions[bot]
authored andcommitted
Automerge: [SPARC][clang] Add condition code register names for inline asm (#168498)
This follows the list of names used by GCC.
2 parents 7969ce4 + 52ed0f2 commit 328c3e3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

clang/lib/Basic/Targets/Sparc.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ using namespace clang;
1919
using namespace clang::targets;
2020

2121
const char *const SparcTargetInfo::GCCRegNames[] = {
22+
// clang-format off
2223
// Integer registers
2324
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
2425
"r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21",
@@ -30,6 +31,10 @@ const char *const SparcTargetInfo::GCCRegNames[] = {
3031
"f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "f32",
3132
"f34", "f36", "f38", "f40", "f42", "f44", "f46", "f48", "f50", "f52", "f54",
3233
"f56", "f58", "f60", "f62",
34+
35+
// Condition code registers
36+
"icc", "fcc0", "fcc1", "fcc2", "fcc3",
37+
// clang-format on
3338
};
3439

3540
ArrayRef<const char *> SparcTargetInfo::getGCCRegNames() const {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
2+
3+
// CHECK-LABEL: @icc
4+
// CHECK: call void asm sideeffect "nop", "~{icc}"()
5+
void icc() {
6+
__asm__ __volatile__("nop" ::: "icc");
7+
}
8+
9+
// CHECK-LABEL: @fcc
10+
// CHECK: call void asm sideeffect "nop", "~{fcc0},~{fcc1},~{fcc2},~{fcc3}"()
11+
void fcc() {
12+
__asm__ __volatile__("nop" ::: "fcc0", "fcc1", "fcc2", "fcc3");
13+
}

0 commit comments

Comments
 (0)