comparison test/CodeGen/AArch64/tail-call.ll @ 95:afa8332a0e37

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 54457678186b
children
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
57 ; Important point is that the call reuses the "dead" argument space 57 ; Important point is that the call reuses the "dead" argument space
58 ; above %a on the stack. If it tries to go below incoming-SP then the 58 ; above %a on the stack. If it tries to go below incoming-SP then the
59 ; callee will not deallocate the space, even in fastcc. 59 ; callee will not deallocate the space, even in fastcc.
60 tail call fastcc void @callee_stack16([8 x i32] undef, i64 42, i64 2) 60 tail call fastcc void @callee_stack16([8 x i32] undef, i64 42, i64 2)
61 61
62 ; CHECK: stp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16] 62 ; CHECK: stp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16]!
63 ; CHECK-NEXT: add sp, sp, #16
64 ; CHECK-NEXT: b callee_stack16 63 ; CHECK-NEXT: b callee_stack16
65 ret void 64 ret void
66 } 65 }
67 66
68 67
87 ; otherwise either %a or %b will be wrongly clobbered. 86 ; otherwise either %a or %b will be wrongly clobbered.
88 tail call fastcc void @callee_stack16([8 x i32] undef, i64 %b, i64 %a) 87 tail call fastcc void @callee_stack16([8 x i32] undef, i64 %b, i64 %a)
89 ret void 88 ret void
90 89
91 ; CHECK: ldp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16] 90 ; CHECK: ldp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16]
92 ; CHECK: stp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16] 91 ; CHECK: stp {{x[0-9]+}}, {{x[0-9]+}}, [sp, #16]!
93 ; CHECK-NEXT: add sp, sp, #16
94 ; CHECK-NEXT: b callee_stack16 92 ; CHECK-NEXT: b callee_stack16
95 } 93 }
96 94
97 95
98 ; Weakly-referenced extern functions cannot be tail-called, as AAELF does 96 ; Weakly-referenced extern functions cannot be tail-called, as AAELF does
101 ; CHECK-LABEL: caller_weak: 99 ; CHECK-LABEL: caller_weak:
102 ; CHECK: bl callee_weak 100 ; CHECK: bl callee_weak
103 tail call void @callee_weak() 101 tail call void @callee_weak()
104 ret void 102 ret void
105 } 103 }
104
105 declare { [2 x float] } @get_vec2()
106
107 define { [3 x float] } @test_add_elem() {
108 ; CHECK-LABEL: test_add_elem:
109 ; CHECK: bl get_vec2
110 ; CHECK: fmov s2, #1.0
111 ; CHECK: ret
112
113 %call = tail call { [2 x float] } @get_vec2()
114 %arr = extractvalue { [2 x float] } %call, 0
115 %arr.0 = extractvalue [2 x float] %arr, 0
116 %arr.1 = extractvalue [2 x float] %arr, 1
117
118 %res.0 = insertvalue { [3 x float] } undef, float %arr.0, 0, 0
119 %res.01 = insertvalue { [3 x float] } %res.0, float %arr.1, 0, 1
120 %res.012 = insertvalue { [3 x float] } %res.01, float 1.000000e+00, 0, 2
121 ret { [3 x float] } %res.012
122 }
123
124 declare double @get_double()
125 define { double, [2 x double] } @test_mismatched_insert() {
126 ; CHECK-LABEL: test_mismatched_insert:
127 ; CHECK: bl get_double
128 ; CHECK: bl get_double
129 ; CHECK: bl get_double
130 ; CHECK: ret
131
132 %val0 = call double @get_double()
133 %val1 = call double @get_double()
134 %val2 = tail call double @get_double()
135
136 %res.0 = insertvalue { double, [2 x double] } undef, double %val0, 0
137 %res.01 = insertvalue { double, [2 x double] } %res.0, double %val1, 1, 0
138 %res.012 = insertvalue { double, [2 x double] } %res.01, double %val2, 1, 1
139
140 ret { double, [2 x double] } %res.012
141 }