Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / LoongArch / inline-asm-gcc-regs.c
blobe1015f6fc01d58f436e89b81c53f54f37a3e71d8
1 // RUN: %clang_cc1 -triple loongarch32 -emit-llvm -O2 %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple loongarch64 -emit-llvm -O2 %s -o - | FileCheck %s
4 /// Check GCC register names and alias can be used in register variable definition.
6 // CHECK-LABEL: @test_r0
7 // CHECK: call void asm sideeffect "", "{$r0}"(i32 undef)
8 void test_r0() {
9 register int a asm ("$r0");
10 register int b asm ("r0");
11 asm ("" :: "r" (a));
12 asm ("" :: "r" (b));
15 // CHECK-LABEL: @test_r12
16 // CHECK: call void asm sideeffect "", "{$r12}"(i32 undef)
17 void test_r12() {
18 register int a asm ("$r12");
19 register int b asm ("r12");
20 asm ("" :: "r" (a));
21 asm ("" :: "r" (b));
24 // CHECK-LABEL: @test_r31
25 // CHECK: call void asm sideeffect "", "{$r31}"(i32 undef)
26 void test_r31() {
27 register int a asm ("$r31");
28 register int b asm ("r31");
29 asm ("" :: "r" (a));
30 asm ("" :: "r" (b));
33 // CHECK-LABEL: @test_zero
34 // CHECK: call void asm sideeffect "", "{$r0}"(i32 undef)
35 void test_zero() {
36 register int a asm ("$zero");
37 register int b asm ("zero");
38 asm ("" :: "r" (a));
39 asm ("" :: "r" (b));
42 // CHECK-LABEL: @test_a0
43 // CHECK: call void asm sideeffect "", "{$r4}"(i32 undef)
44 void test_a0() {
45 register int a asm ("$a0");
46 register int b asm ("a0");
47 asm ("" :: "r" (a));
48 asm ("" :: "r" (b));
51 // CHECK-LABEL: @test_t1
52 // CHECK: call void asm sideeffect "", "{$r13}"(i32 undef)
53 void test_t1() {
54 register int a asm ("$t1");
55 register int b asm ("t1");
56 asm ("" :: "r" (a));
57 asm ("" :: "r" (b));
60 // CHECK-LABEL: @test_fp
61 // CHECK: call void asm sideeffect "", "{$r22}"(i32 undef)
62 void test_fp() {
63 register int a asm ("$fp");
64 register int b asm ("fp");
65 asm ("" :: "r" (a));
66 asm ("" :: "r" (b));
69 // CHECK-LABEL: @test_s2
70 // CHECK: call void asm sideeffect "", "{$r25}"(i32 undef)
71 void test_s2() {
72 register int a asm ("$s2");
73 register int b asm ("s2");
74 asm ("" :: "r" (a));
75 asm ("" :: "r" (b));
78 // CHECK-LABEL: @test_f0
79 // CHECK: call void asm sideeffect "", "{$f0}"(float undef)
80 void test_f0() {
81 register float a asm ("$f0");
82 asm ("" :: "f" (a));
85 // CHECK-LABEL: @test_f14
86 // CHECK: call void asm sideeffect "", "{$f14}"(float undef)
87 void test_f14() {
88 register float a asm ("$f14");
89 asm ("" :: "f" (a));
92 // CHECK-LABEL: @test_f31
93 // CHECK: call void asm sideeffect "", "{$f31}"(float undef)
94 void test_f31() {
95 register float a asm ("$f31");
96 asm ("" :: "f" (a));
99 // CHECK-LABEL: @test_fa0
100 // CHECK: call void asm sideeffect "", "{$f0}"(float undef)
101 void test_fa0() {
102 register float a asm ("$fa0");
103 asm ("" :: "f" (a));
106 // CHECK-LABEL: @test_ft1
107 // CHECK: call void asm sideeffect "", "{$f9}"(float undef)
108 void test_ft1() {
109 register float a asm ("$ft1");
110 asm ("" :: "f" (a));
113 // CHECK-LABEL: @test_fs2
114 // CHECK: call void asm sideeffect "", "{$f26}"(float undef)
115 void test_fs2() {
116 register float a asm ("$fs2");
117 asm ("" :: "f" (a));
120 // CHECK-LABEL: @test_fcc
121 // CHECK: call void asm sideeffect "", "~{$fcc0}"()
122 // CHECK: call void asm sideeffect "", "~{$fcc7}"()
123 void test_fcc() {
124 asm ("" ::: "$fcc0");
125 asm ("" ::: "$fcc7");