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)
9 register int a
asm ("$r0");
10 register int b
asm ("r0");
15 // CHECK-LABEL: @test_r12
16 // CHECK: call void asm sideeffect "", "{$r12}"(i32 undef)
18 register int a
asm ("$r12");
19 register int b
asm ("r12");
24 // CHECK-LABEL: @test_r31
25 // CHECK: call void asm sideeffect "", "{$r31}"(i32 undef)
27 register int a
asm ("$r31");
28 register int b
asm ("r31");
33 // CHECK-LABEL: @test_zero
34 // CHECK: call void asm sideeffect "", "{$r0}"(i32 undef)
36 register int a
asm ("$zero");
37 register int b
asm ("zero");
42 // CHECK-LABEL: @test_a0
43 // CHECK: call void asm sideeffect "", "{$r4}"(i32 undef)
45 register int a
asm ("$a0");
46 register int b
asm ("a0");
51 // CHECK-LABEL: @test_t1
52 // CHECK: call void asm sideeffect "", "{$r13}"(i32 undef)
54 register int a
asm ("$t1");
55 register int b
asm ("t1");
60 // CHECK-LABEL: @test_fp
61 // CHECK: call void asm sideeffect "", "{$r22}"(i32 undef)
63 register int a
asm ("$fp");
64 register int b
asm ("fp");
69 // CHECK-LABEL: @test_s2
70 // CHECK: call void asm sideeffect "", "{$r25}"(i32 undef)
72 register int a
asm ("$s2");
73 register int b
asm ("s2");
78 // CHECK-LABEL: @test_f0
79 // CHECK: call void asm sideeffect "", "{$f0}"(float undef)
81 register float a
asm ("$f0");
85 // CHECK-LABEL: @test_f14
86 // CHECK: call void asm sideeffect "", "{$f14}"(float undef)
88 register float a
asm ("$f14");
92 // CHECK-LABEL: @test_f31
93 // CHECK: call void asm sideeffect "", "{$f31}"(float undef)
95 register float a
asm ("$f31");
99 // CHECK-LABEL: @test_fa0
100 // CHECK: call void asm sideeffect "", "{$f0}"(float undef)
102 register float a
asm ("$fa0");
106 // CHECK-LABEL: @test_ft1
107 // CHECK: call void asm sideeffect "", "{$f9}"(float undef)
109 register float a
asm ("$ft1");
113 // CHECK-LABEL: @test_fs2
114 // CHECK: call void asm sideeffect "", "{$f26}"(float undef)
116 register float a
asm ("$fs2");
120 // CHECK-LABEL: @test_fcc
121 // CHECK: call void asm sideeffect "", "~{$fcc0}"()
122 // CHECK: call void asm sideeffect "", "~{$fcc7}"()
124 asm ("" ::: "$fcc0");
125 asm ("" ::: "$fcc7");