63 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS323 4@.str = private unnamed_addr constant [11 x i8] c"string %s\0A\00", align 15declare void @llvm.va_start(ptr)6declare void @llvm.va_copy(ptr, ptr)7declare i32 @printf(ptr, ...)8 9define void @testVaCopyArg(ptr %fmt, ...) {10 ; MIPS32-LABEL: name: testVaCopyArg11 ; MIPS32: bb.1.entry:12 ; MIPS32-NEXT: liveins: $a0, $a1, $a2, $a313 ; MIPS32-NEXT: {{ $}}14 ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $a015 ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a116 ; MIPS32-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.217 ; MIPS32-NEXT: G_STORE [[COPY1]](s32), [[FRAME_INDEX]](p0) :: (store (s32) into %fixed-stack.2)18 ; MIPS32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a219 ; MIPS32-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.120 ; MIPS32-NEXT: G_STORE [[COPY2]](s32), [[FRAME_INDEX1]](p0) :: (store (s32) into %fixed-stack.1)21 ; MIPS32-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $a322 ; MIPS32-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.023 ; MIPS32-NEXT: G_STORE [[COPY3]](s32), [[FRAME_INDEX2]](p0) :: (store (s32) into %fixed-stack.0)24 ; MIPS32-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @.str25 ; MIPS32-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0.fmt.addr26 ; MIPS32-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.1.ap27 ; MIPS32-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.2.aq28 ; MIPS32-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.3.s29 ; MIPS32-NEXT: G_STORE [[COPY]](p0), [[FRAME_INDEX3]](p0) :: (store (p0) into %ir.fmt.addr)30 ; MIPS32-NEXT: G_VASTART [[FRAME_INDEX4]](p0) :: (store (s32) into %ir.ap)31 ; MIPS32-NEXT: G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.va_copy), [[FRAME_INDEX5]](p0), [[FRAME_INDEX4]](p0)32 ; MIPS32-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX5]](p0) :: (dereferenceable load (p0) from %ir.aq)33 ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 434 ; MIPS32-NEXT: %13:_(p0) = nuw nusw inbounds G_PTR_ADD [[LOAD]], [[C]](s32)35 ; MIPS32-NEXT: G_STORE %13(p0), [[FRAME_INDEX5]](p0) :: (store (p0) into %ir.aq)36 ; MIPS32-NEXT: [[LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[LOAD]](p0) :: (load (p0) from %ir.argp.cur)37 ; MIPS32-NEXT: G_STORE [[LOAD1]](p0), [[FRAME_INDEX6]](p0) :: (store (p0) into %ir.s)38 ; MIPS32-NEXT: [[LOAD2:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX6]](p0) :: (dereferenceable load (p0) from %ir.s)39 ; MIPS32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp40 ; MIPS32-NEXT: $a0 = COPY [[GV]](p0)41 ; MIPS32-NEXT: $a1 = COPY [[LOAD2]](p0)42 ; MIPS32-NEXT: JAL @printf, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $v043 ; MIPS32-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $v044 ; MIPS32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp45 ; MIPS32-NEXT: RetRA46entry:47 %fmt.addr = alloca ptr, align 448 %ap = alloca ptr, align 449 %aq = alloca ptr, align 450 %s = alloca ptr, align 451 store ptr %fmt, ptr %fmt.addr, align 452 call void @llvm.va_start(ptr %ap)53 call void @llvm.va_copy(ptr %aq, ptr %ap)54 %argp.cur = load ptr, ptr %aq, align 455 %argp.next = getelementptr inbounds i8, ptr %argp.cur, i32 456 store ptr %argp.next, ptr %aq, align 457 %0 = load ptr, ptr %argp.cur, align 458 store ptr %0, ptr %s, align 459 %1 = load ptr, ptr %s, align 460 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %1)61 ret void62}63