55; RUN: opt -S -passes=lowertypetests -mtriple=riscv32-unknown-linux-gnu %s | FileCheck --check-prefixes=RISCV,NATIVE %s
66; RUN: opt -S -passes=lowertypetests -mtriple=riscv64-unknown-linux-gnu %s | FileCheck --check-prefixes=RISCV,NATIVE %s
77; RUN: opt -S -passes=lowertypetests -mtriple=wasm32-unknown-unknown %s | FileCheck --check-prefix=WASM32 %s
8+ ; RUN: opt -S -passes=lowertypetests -mtriple=loongarch64-unknown-linux-gnu %s | FileCheck --check-prefixes=LOONGARCH64,NATIVE %s
89
910; The right format for Arm jump tables depends on the selected
1011; subtarget, so we can't get these tests right without the Arm target
@@ -34,6 +35,7 @@ target datalayout = "e-p:64:64"
3435; THUMB: @g = internal alias void (), getelementptr inbounds ([2 x [4 x i8]], ptr @[[JT]], i64 0, i64 1)
3536; THUMBV6M: @g = internal alias void (), getelementptr inbounds ([2 x [16 x i8]], ptr @[[JT]], i64 0, i64 1)
3637; RISCV: @g = internal alias void (), getelementptr inbounds ([2 x [8 x i8]], ptr @[[JT]], i64 0, i64 1)
38+ ; LOONGARCH64: @g = internal alias void (), getelementptr inbounds ([2 x [8 x i8]], ptr @[[JT]], i64 0, i64 1)
3739
3840; NATIVE: define hidden void @f.cfi()
3941; WASM32: define void @f() !type !{{[0-9]+}} !wasm.index ![[I0:[0-9]+]]
@@ -65,6 +67,7 @@ define i1 @foo(ptr %p) {
6567; THUMB: define private void @[[JT]]() #[[ATTR:.*]] align 4 {
6668; THUMBV6M: define private void @[[JT]]() #[[ATTR:.*]] align 16 {
6769; RISCV: define private void @[[JT]]() #[[ATTR:.*]] align 8 {
70+ ; LOONGARCH64: define private void @[[JT]]() #[[ATTR:.*]] align 8 {
6871
6972; X86: jmp ${0:c}@plt
7073; X86-SAME: int3
@@ -99,6 +102,11 @@ define i1 @foo(ptr %p) {
99102; RISCV: tail $0@plt
100103; RISCV-SAME: tail $1@plt
101104
105+ ; LOONGARCH64: pcalau12i $$t0, %pc_hi20($0)
106+ ; LOONGARCH64-SAME: jirl $$r0, $$t0, %pc_lo12($0)
107+ ; LOONGARCH64-SAME: pcalau12i $$t0, %pc_hi20($1)
108+ ; LOONGARCH64-SAME: jirl $$r0, $$t0, %pc_lo12($1)
109+
102110; NATIVE-SAME: "s,s"(ptr @f.cfi, ptr @g.cfi)
103111
104112; X86-LINUX: attributes #[[ATTR]] = { naked nocf_check nounwind }
@@ -107,6 +115,7 @@ define i1 @foo(ptr %p) {
107115; THUMB: attributes #[[ATTR]] = { naked nounwind "branch-target-enforcement"="false" "sign-return-address"="none" "target-cpu"="cortex-a8" "target-features"="+thumb-mode" }
108116; THUMBV6M: attributes #[[ATTR]] = { naked nounwind "branch-target-enforcement"="false" "sign-return-address"="none" "target-features"="+thumb-mode" }
109117; RISCV: attributes #[[ATTR]] = { naked nounwind "target-features"="-c,-relax" }
118+ ; LOONGARCH64: attributes #[[ATTR]] = { naked nounwind }
110119
111120; WASM32: ![[I0]] = !{i64 1}
112121; WASM32: ![[I1]] = !{i64 2}
0 commit comments