1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32
4 @.str = private unnamed_addr constant [11 x i8] c"string %s\0A\00", align 1
5 declare void @llvm.va_start(ptr)
6 declare void @llvm.va_copy(ptr, ptr)
7 declare i32 @printf(ptr, ...)
9 define void @testVaCopyArg(ptr %fmt, ...) {
10 ; MIPS32-LABEL: testVaCopyArg:
11 ; MIPS32: # %bb.0: # %entry
12 ; MIPS32-NEXT: addiu $sp, $sp, -40
13 ; MIPS32-NEXT: .cfi_def_cfa_offset 40
14 ; MIPS32-NEXT: sw $ra, 36($sp) # 4-byte Folded Spill
15 ; MIPS32-NEXT: .cfi_offset 31, -4
16 ; MIPS32-NEXT: move $3, $4
17 ; MIPS32-NEXT: addiu $1, $sp, 44
18 ; MIPS32-NEXT: sw $5, 0($1)
19 ; MIPS32-NEXT: addiu $1, $sp, 48
20 ; MIPS32-NEXT: sw $6, 0($1)
21 ; MIPS32-NEXT: addiu $1, $sp, 52
22 ; MIPS32-NEXT: sw $7, 0($1)
23 ; MIPS32-NEXT: lui $1, %hi($.str)
24 ; MIPS32-NEXT: addiu $4, $1, %lo($.str)
25 ; MIPS32-NEXT: addiu $6, $sp, 32
26 ; MIPS32-NEXT: addiu $2, $sp, 28
27 ; MIPS32-NEXT: addiu $5, $sp, 24
28 ; MIPS32-NEXT: addiu $1, $sp, 20
29 ; MIPS32-NEXT: sw $3, 0($6)
30 ; MIPS32-NEXT: addiu $3, $sp, 44
31 ; MIPS32-NEXT: sw $3, 0($2)
32 ; MIPS32-NEXT: lw $2, 0($2)
33 ; MIPS32-NEXT: sw $2, 0($5)
34 ; MIPS32-NEXT: lw $2, 0($5)
35 ; MIPS32-NEXT: ori $3, $zero, 4
36 ; MIPS32-NEXT: addu $3, $2, $3
37 ; MIPS32-NEXT: sw $3, 0($5)
38 ; MIPS32-NEXT: lw $2, 0($2)
39 ; MIPS32-NEXT: sw $2, 0($1)
40 ; MIPS32-NEXT: lw $5, 0($1)
41 ; MIPS32-NEXT: jal printf
43 ; MIPS32-NEXT: lw $ra, 36($sp) # 4-byte Folded Reload
44 ; MIPS32-NEXT: addiu $sp, $sp, 40
48 %fmt.addr = alloca ptr, align 4
49 %ap = alloca ptr, align 4
50 %aq = alloca ptr, align 4
51 %s = alloca ptr, align 4
52 store ptr %fmt, ptr %fmt.addr, align 4
53 call void @llvm.va_start(ptr %ap)
54 call void @llvm.va_copy(ptr %aq, ptr %ap)
55 %argp.cur = load ptr, ptr %aq, align 4
56 %argp.next = getelementptr inbounds i8, ptr %argp.cur, i32 4
57 store ptr %argp.next, ptr %aq, align 4
58 %0 = load ptr, ptr %argp.cur, align 4
59 store ptr %0, ptr %s, align 4
60 %1 = load ptr, ptr %s, align 4
61 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %1)