Skip to content

Commit e015fc8

Browse files
committed
Adjust loongarch assembly test
This generates different code on loongarch32r now.
1 parent 749a279 commit e015fc8

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

tests/assembly-llvm/asm/loongarch-type.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
//@ add-minicore
2-
//@ revisions: loongarch32 loongarch64
2+
//@ revisions: loongarch32s loongarch32r loongarch64
33

44
//@ assembly-output: emit-asm
55

6-
//@[loongarch32] compile-flags: --target loongarch32-unknown-none
7-
//@[loongarch32] needs-llvm-components: loongarch
6+
//@[loongarch32s] compile-flags: --target loongarch32-unknown-none -Ctarget-feature=+32s
7+
//@[loongarch32s] needs-llvm-components: loongarch
8+
9+
//@[loongarch32r] compile-flags: --target loongarch32-unknown-none
10+
//@[loongarch32r] needs-llvm-components: loongarch
11+
//@[loongarch32r] min-llvm-version: 22
812

913
//@[loongarch64] compile-flags: --target loongarch64-unknown-none
1014
//@[loongarch64] needs-llvm-components: loongarch
@@ -28,8 +32,12 @@ extern "C" {
2832

2933
// CHECK-LABEL: sym_fn:
3034
// CHECK: #APP
31-
// CHECK: pcalau12i $t0, %got_pc_hi20(extern_func)
32-
// CHECK: ld.{{[wd]}} $t0, $t0, %got_pc_lo12(extern_func)
35+
// loongarch64: pcalau12i $t0, %got_pc_hi20(extern_func)
36+
// loongarch64: ld.d $t0, $t0, %got_pc_lo12(extern_func)
37+
// loongarch32s: pcalau12i $t0, %got_pc_hi20(extern_func)
38+
// loongarch32s: ld.w $t0, $t0, %got_pc_lo12(extern_func)
39+
// loongarch32r: pcaddu12i $t0, %got_pcadd_hi20(extern_func)
40+
// loongarch32r: ld.w $t0, $t0, %got_pcadd_lo12(.Lpcadd_hi0)
3341
// CHECK: #NO_APP
3442
#[no_mangle]
3543
pub unsafe fn sym_fn() {
@@ -38,8 +46,13 @@ pub unsafe fn sym_fn() {
3846

3947
// CHECK-LABEL: sym_static:
4048
// CHECK: #APP
41-
// CHECK: pcalau12i $t0, %got_pc_hi20(extern_static)
42-
// CHECK: ld.{{[wd]}} $t0, $t0, %got_pc_lo12(extern_static)
49+
// loongarch64: pcalau12i $t0, %got_pc_hi20(extern_static)
50+
// loongarch64: ld.d $t0, $t0, %got_pc_lo12(extern_static)
51+
// loongarch32s: pcalau12i $t0, %got_pc_hi20(extern_static)
52+
// loongarch32s: ld.w $t0, $t0, %got_pc_lo12(extern_static)
53+
// loongarch32r: pcaddu12i $t0, %got_pcadd_hi20(extern_static)
54+
// loongarch32r: ld.w $t0, $t0, %got_pcadd_lo12(.Lpcadd_hi1)
55+
4356
// CHECK: #NO_APP
4457
#[no_mangle]
4558
pub unsafe fn sym_static() {

0 commit comments

Comments
 (0)