[clang] e44600f - [X86][CFE] Support EGPR in GCCRegNames. (#91323)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 8 00:07:21 PDT 2024
Author: Freddy Ye
Date: 2024-05-08T15:07:18+08:00
New Revision: e44600f3ab58b0e93a2a80f18e17181c2bc007a4
URL: https://github.com/llvm/llvm-project/commit/e44600f3ab58b0e93a2a80f18e17181c2bc007a4
DIFF: https://github.com/llvm/llvm-project/commit/e44600f3ab58b0e93a2a80f18e17181c2bc007a4.diff
LOG: [X86][CFE] Support EGPR in GCCRegNames. (#91323)
Added:
clang/test/CodeGen/X86/inline-asm-gcc-regs.c
Modified:
clang/lib/Basic/Targets/X86.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index bf1767c87fe1c..67e2126cf766b 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -64,6 +64,8 @@ static const char *const GCCRegNames[] = {
"dr0", "dr1", "dr2", "dr3", "dr6", "dr7",
"bnd0", "bnd1", "bnd2", "bnd3",
"tmm0", "tmm1", "tmm2", "tmm3", "tmm4", "tmm5", "tmm6", "tmm7",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
};
const TargetInfo::AddlRegName AddlRegNames[] = {
@@ -83,8 +85,23 @@ const TargetInfo::AddlRegName AddlRegNames[] = {
{{"r13d", "r13w", "r13b"}, 43},
{{"r14d", "r14w", "r14b"}, 44},
{{"r15d", "r15w", "r15b"}, 45},
+ {{"r16d", "r16w", "r16b"}, 165},
+ {{"r17d", "r17w", "r17b"}, 166},
+ {{"r18d", "r18w", "r18b"}, 167},
+ {{"r19d", "r19w", "r19b"}, 168},
+ {{"r20d", "r20w", "r20b"}, 169},
+ {{"r21d", "r21w", "r21b"}, 170},
+ {{"r22d", "r22w", "r22b"}, 171},
+ {{"r23d", "r23w", "r23b"}, 172},
+ {{"r24d", "r24w", "r24b"}, 173},
+ {{"r25d", "r25w", "r25b"}, 174},
+ {{"r26d", "r26w", "r26b"}, 175},
+ {{"r27d", "r27w", "r27b"}, 176},
+ {{"r28d", "r28w", "r28b"}, 177},
+ {{"r29d", "r29w", "r29b"}, 178},
+ {{"r30d", "r30w", "r30b"}, 179},
+ {{"r31d", "r31w", "r31b"}, 180},
};
-
} // namespace targets
} // namespace clang
diff --git a/clang/test/CodeGen/X86/inline-asm-gcc-regs.c b/clang/test/CodeGen/X86/inline-asm-gcc-regs.c
new file mode 100644
index 0000000000000..17adbdc20a406
--- /dev/null
+++ b/clang/test/CodeGen/X86/inline-asm-gcc-regs.c
@@ -0,0 +1,121 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -O2 %s -o - | FileCheck %s
+
+// CHECK-LABEL: @test_r15
+// CHECK: call void asm sideeffect "", "{r15},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r15() {
+ register int a asm ("r15");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r16
+// CHECK: call void asm sideeffect "", "{r16},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r16() {
+ register int a asm ("r16");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r17
+// CHECK: call void asm sideeffect "", "{r17},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r17() {
+ register int a asm ("r17");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r18
+// CHECK: call void asm sideeffect "", "{r18},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r18() {
+ register int a asm ("r18");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r19
+// CHECK: call void asm sideeffect "", "{r19},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r19() {
+ register int a asm ("r19");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r20
+// CHECK: call void asm sideeffect "", "{r20},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r20() {
+ register int a asm ("r20");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r21
+// CHECK: call void asm sideeffect "", "{r21},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r21() {
+ register int a asm ("r21");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r22
+// CHECK: call void asm sideeffect "", "{r22},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r22() {
+ register int a asm ("r22");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r23
+// CHECK: call void asm sideeffect "", "{r23},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r23() {
+ register int a asm ("r23");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r24
+// CHECK: call void asm sideeffect "", "{r24},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r24() {
+ register int a asm ("r24");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r25
+// CHECK: call void asm sideeffect "", "{r25},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r25() {
+ register int a asm ("r25");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r26
+// CHECK: call void asm sideeffect "", "{r26},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r26() {
+ register int a asm ("r26");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r27
+// CHECK: call void asm sideeffect "", "{r27},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r27() {
+ register int a asm ("r27");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r28
+// CHECK: call void asm sideeffect "", "{r28},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r28() {
+ register int a asm ("r28");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r29
+// CHECK: call void asm sideeffect "", "{r29},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r29() {
+ register int a asm ("r29");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r30
+// CHECK: call void asm sideeffect "", "{r30},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r30() {
+ register int a asm ("r30");
+ asm ("" :: "r" (a));
+}
+
+// CHECK-LABEL: @test_r31
+// CHECK: call void asm sideeffect "", "{r31},~{dirflag},~{fpsr},~{flags}"(i32 undef)
+void test_r31() {
+ register int a asm ("r31");
+ asm ("" :: "r" (a));
+}
+
More information about the cfe-commits
mailing list