1 ; RUN: llc --mtriple=loongarch64 --verify-machineinstrs < %s \
2 ; RUN: | FileCheck %s --check-prefix=ASM
3 ; RUN: llc --mtriple=loongarch64 --print-after-isel -o /dev/null 2>&1 < %s \
4 ; RUN: | FileCheck %s --check-prefix=MACHINE-INSTR
6 define i64 @k_variable_offset(ptr %p, i64 %idx) nounwind {
7 ; ASM-LABEL: k_variable_offset:
10 ; ASM-NEXT: ldx.d $a0, $a0, $a1
13 %1 = getelementptr inbounds i8, ptr %p, i64 %idx
14 ;; Make sure machine instr with this 'k' constraint is printed correctly.
15 ; MACHINE-INSTR: INLINEASM{{.*}}[mem:k]
16 %2 = call i64 asm "ldx.d $0, $1", "=r,*k"(ptr elementtype(i64) %1)
20 define i64 @k_constant_offset(ptr %p) nounwind {
21 ; ASM-LABEL: k_constant_offset:
23 ; ASM-NEXT: ori $a1, $zero, 5
25 ; ASM-NEXT: ldx.d $a0, $a0, $a1
28 %1 = getelementptr inbounds i8, ptr %p, i64 5
29 ;; Make sure machine instr with this 'k' constraint is printed correctly.
30 ; MACHINE-INSTR: INLINEASM{{.*}}[mem:k]
31 %2 = call i64 asm "ldx.d $0, $1", "=r,*k"(ptr elementtype(i64) %1)