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(i8*)
6 declare void @llvm.va_copy(i8*, i8*)
7 declare i32 @printf(i8*, ...)
9 define void @testVaCopyArg(i8* %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: addiu $1, $sp, 44
17 ; MIPS32-NEXT: sw $5, 0($1)
18 ; MIPS32-NEXT: addiu $1, $sp, 48
19 ; MIPS32-NEXT: sw $6, 0($1)
20 ; MIPS32-NEXT: addiu $1, $sp, 52
21 ; MIPS32-NEXT: sw $7, 0($1)
22 ; MIPS32-NEXT: lui $1, %hi($.str)
23 ; MIPS32-NEXT: addiu $1, $1, %lo($.str)
24 ; MIPS32-NEXT: addiu $2, $sp, 32
25 ; MIPS32-NEXT: addiu $3, $sp, 28
26 ; MIPS32-NEXT: addiu $5, $sp, 24
27 ; MIPS32-NEXT: addiu $6, $sp, 20
28 ; MIPS32-NEXT: sw $4, 0($2)
29 ; MIPS32-NEXT: addiu $2, $sp, 44
30 ; MIPS32-NEXT: sw $2, 0($3)
31 ; MIPS32-NEXT: lw $2, 0($3)
32 ; MIPS32-NEXT: sw $2, 0($5)
33 ; MIPS32-NEXT: lw $2, 0($5)
34 ; MIPS32-NEXT: ori $3, $zero, 4
35 ; MIPS32-NEXT: addu $3, $2, $3
36 ; MIPS32-NEXT: sw $3, 0($5)
37 ; MIPS32-NEXT: lw $2, 0($2)
38 ; MIPS32-NEXT: sw $2, 0($6)
39 ; MIPS32-NEXT: lw $5, 0($6)
40 ; MIPS32-NEXT: move $4, $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 i8*, align 4
49 %ap = alloca i8*, align 4
50 %aq = alloca i8*, align 4
51 %s = alloca i8*, align 4
52 store i8* %fmt, i8** %fmt.addr, align 4
53 %ap1 = bitcast i8** %ap to i8*
54 call void @llvm.va_start(i8* %ap1)
55 %0 = bitcast i8** %aq to i8*
56 %1 = bitcast i8** %ap to i8*
57 call void @llvm.va_copy(i8* %0, i8* %1)
58 %argp.cur = load i8*, i8** %aq, align 4
59 %argp.next = getelementptr inbounds i8, i8* %argp.cur, i32 4
60 store i8* %argp.next, i8** %aq, align 4
61 %2 = bitcast i8* %argp.cur to i8**
62 %3 = load i8*, i8** %2, align 4
63 store i8* %3, i8** %s, align 4
64 %4 = load i8*, i8** %s, align 4
65 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* %4)