1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=mips64-unknown-freebsd -O0 -o - %s | FileCheck %s
4 ; Previously SelectionDAGBuilder would always set alignment to 1 for hidden sret
5 ; parameters so we were generating ldl+ldr/lwl+lwr to load those values even
6 ; though we know that they are aligned (since we allocated an aligned frame index)
8 declare dso_local void @use_sret(i32, i128, i64) unnamed_addr
9 declare dso_local { i32, i128, i64 } @implicit_sret_decl() unnamed_addr
11 define internal void @test() unnamed_addr nounwind {
13 ; CHECK: # %bb.0: # %start
14 ; CHECK-NEXT: daddiu $sp, $sp, -64
15 ; CHECK-NEXT: sd $ra, 56($sp) # 8-byte Folded Spill
16 ; CHECK-NEXT: daddiu $4, $sp, 0
17 ; CHECK-NEXT: jal implicit_sret_decl
19 ; CHECK-NEXT: ld $6, 24($sp)
20 ; CHECK-NEXT: ld $5, 16($sp)
21 ; CHECK-NEXT: ld $7, 32($sp)
22 ; CHECK-NEXT: lw $1, 0($sp)
23 ; CHECK-NEXT: # implicit-def: $a0_64
24 ; CHECK-NEXT: move $4, $1
25 ; CHECK-NEXT: jal use_sret
27 ; CHECK-NEXT: ld $ra, 56($sp) # 8-byte Folded Reload
28 ; CHECK-NEXT: daddiu $sp, $sp, 64
32 %0 = call { i32, i128, i64 } @implicit_sret_decl()
33 %1 = extractvalue { i32, i128, i64 } %0, 0
34 %2 = extractvalue { i32, i128, i64 } %0, 1
35 %3 = extractvalue { i32, i128, i64 } %0, 2
36 call void @use_sret(i32 %1, i128 %2, i64 %3)
40 define internal { i32, i128, i64 } @implicit_sret_impl() unnamed_addr nounwind {
41 ; CHECK-LABEL: implicit_sret_impl:
43 ; CHECK-NEXT: # kill: def $at_64 killed $a0_64
44 ; CHECK-NEXT: daddiu $1, $zero, 20
45 ; CHECK-NEXT: sd $1, 24($4)
46 ; CHECK-NEXT: daddiu $1, $zero, 0
47 ; CHECK-NEXT: sd $zero, 16($4)
48 ; CHECK-NEXT: daddiu $1, $zero, 30
49 ; CHECK-NEXT: sd $1, 32($4)
50 ; CHECK-NEXT: addiu $1, $zero, 10
51 ; CHECK-NEXT: sw $1, 0($4)
54 ret { i32, i128, i64 } { i32 10, i128 20, i64 30 }
57 declare dso_local { i32, i32, i32, i32, i32, i32 } @implicit_sret_decl2() unnamed_addr
58 declare dso_local void @use_sret2(i32, i32, i32) unnamed_addr
59 define internal void @test2() unnamed_addr nounwind {
61 ; CHECK: # %bb.0: # %start
62 ; CHECK-NEXT: daddiu $sp, $sp, -32
63 ; CHECK-NEXT: sd $ra, 24($sp) # 8-byte Folded Spill
64 ; CHECK-NEXT: daddiu $4, $sp, 0
65 ; CHECK-NEXT: jal implicit_sret_decl2
67 ; CHECK-NEXT: lw $1, 20($sp)
68 ; CHECK-NEXT: lw $2, 12($sp)
69 ; CHECK-NEXT: lw $3, 4($sp)
70 ; CHECK-NEXT: # implicit-def: $a0_64
71 ; CHECK-NEXT: move $4, $3
72 ; CHECK-NEXT: # implicit-def: $a1_64
73 ; CHECK-NEXT: move $5, $2
74 ; CHECK-NEXT: # implicit-def: $a2_64
75 ; CHECK-NEXT: move $6, $1
76 ; CHECK-NEXT: jal use_sret2
78 ; CHECK-NEXT: ld $ra, 24($sp) # 8-byte Folded Reload
79 ; CHECK-NEXT: daddiu $sp, $sp, 32
83 %0 = call { i32, i32, i32, i32, i32, i32 } @implicit_sret_decl2()
84 %1 = extractvalue { i32, i32, i32, i32, i32, i32 } %0, 1
85 %2 = extractvalue { i32, i32, i32, i32, i32, i32 } %0, 3
86 %3 = extractvalue { i32, i32, i32, i32, i32, i32 } %0, 5
87 call void @use_sret2(i32 %1, i32 %2, i32 %3)
92 define internal { i32, i32, i32, i32, i32, i32 } @implicit_sret_impl2() unnamed_addr nounwind {
93 ; CHECK-LABEL: implicit_sret_impl2:
95 ; CHECK-NEXT: # kill: def $at_64 killed $a0_64
96 ; CHECK-NEXT: addiu $1, $zero, 6
97 ; CHECK-NEXT: sw $1, 20($4)
98 ; CHECK-NEXT: addiu $1, $zero, 5
99 ; CHECK-NEXT: sw $1, 16($4)
100 ; CHECK-NEXT: addiu $1, $zero, 4
101 ; CHECK-NEXT: sw $1, 12($4)
102 ; CHECK-NEXT: addiu $1, $zero, 3
103 ; CHECK-NEXT: sw $1, 8($4)
104 ; CHECK-NEXT: addiu $1, $zero, 2
105 ; CHECK-NEXT: sw $1, 4($4)
106 ; CHECK-NEXT: addiu $1, $zero, 1
107 ; CHECK-NEXT: sw $1, 0($4)
110 ret { i32, i32, i32, i32, i32, i32 } { i32 1, i32 2, i32 3, i32 4, i32 5, i32 6 }