1; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs < %s \ 2; RUN: | FileCheck %s --check-prefix=ASM 3; RUN: llc --mtriple=loongarch64 -mattr=+d --print-after-isel -o /dev/null 2>&1 < %s \ 4; RUN: | FileCheck %s --check-prefix=MACHINE-INSTR 5 6define i64 @k_variable_offset(ptr %p, i64 %idx) nounwind { 7; ASM-LABEL: k_variable_offset: 8; ASM: # %bb.0: 9; ASM-NEXT: #APP 10; ASM-NEXT: ldx.d $a0, $a0, $a1 11; ASM-NEXT: #NO_APP 12; ASM-NEXT: ret 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) 17 ret i64 %2 18} 19 20define i64 @k_constant_offset(ptr %p) nounwind { 21; ASM-LABEL: k_constant_offset: 22; ASM: # %bb.0: 23; ASM-NEXT: ori $a1, $zero, 5 24; ASM-NEXT: #APP 25; ASM-NEXT: ldx.d $a0, $a0, $a1 26; ASM-NEXT: #NO_APP 27; ASM-NEXT: ret 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) 32 ret i64 %2 33} 34