63 lines · plain
1; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs < %s \2; RUN: | FileCheck %s --check-prefix=ASM3; RUN: llc --mtriple=loongarch64 -mattr=+d --print-after-isel -o /dev/null 2>&1 < %s \4; RUN: | FileCheck %s --check-prefix=MACHINE-INSTR5 6;; Note amswap.w is not available on loongarch32.7 8define void @ZB(ptr %p) nounwind {9; ASM-LABEL: ZB:10; ASM: # %bb.0:11; ASM-NEXT: #APP12; ASM-NEXT: amswap.w $t0, $t1, $a013; ASM-NEXT: #NO_APP14; ASM-NEXT: ret15;; Make sure machine instr with this "ZB" constraint is printed correctly.16; MACHINE-INSTR: INLINEASM{{.*}}[mem:ZB]17 call void asm "amswap.w $$r12, $$r13, $0", "*^ZB"(ptr elementtype(i32) %p)18 ret void19}20 21define void @ZB_constant_offset(ptr %p) nounwind {22; ASM-LABEL: ZB_constant_offset:23; ASM: # %bb.0:24; ASM-NEXT: addi.d $a0, $a0, 125; ASM-NEXT: #APP26; ASM-NEXT: amswap.w $t0, $t1, $a027; ASM-NEXT: #NO_APP28; ASM-NEXT: ret29 %1 = getelementptr inbounds i8, ptr %p, i32 130;; Make sure machine instr with this "ZB" constraint is printed correctly.31; MACHINE-INSTR: INLINEASM{{.*}}[mem:ZB]32 call void asm "amswap.w $$r12, $$r13, $0", "*^ZB"(ptr elementtype(i32) %1)33 ret void34}35 36define void @ZB_variable_offset(ptr %p, i32 signext %idx) nounwind {37; ASM-LABEL: ZB_variable_offset:38; ASM: # %bb.0:39; ASM-NEXT: add.d $a0, $a0, $a140; ASM-NEXT: #APP41; ASM-NEXT: amswap.w $t0, $t1, $a042; ASM-NEXT: #NO_APP43; ASM-NEXT: ret44 %1 = getelementptr inbounds i8, ptr %p, i32 %idx45;; Make sure machine instr with this "ZB" constraint is printed correctly.46; MACHINE-INSTR: INLINEASM{{.*}}[mem:ZB]47 call void asm "amswap.w $$r12, $$r13, $0", "*^ZB"(ptr elementtype(i32) %1)48 ret void49}50 51define void @ZB_Input_Output(ptr %p) nounwind {52; ASM-LABEL: ZB_Input_Output:53; ASM: # %bb.0:54; ASM-NEXT: #APP55; ASM-NEXT: amadd_db.d $zero, $t1, $a056; ASM-NEXT: #NO_APP57; ASM-NEXT: ret58;; Make sure machine instr with this "ZB" constraint is printed correctly.59; MACHINE-INSTR: INLINEASM{{.*}}[mem:ZB], %0:gpr, 060 call void asm "amadd_db.d $$zero, $$r13, $0", "=*^ZB,*^ZB,~{memory}"(ptr elementtype(i64) %p, ptr elementtype(i64) %p)61 ret void62}63