1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-pc-elfiamcu | FileCheck %s
4 %struct.st12_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
6 define i32 @test_ints(i32 %a, i32 %b, i32 %c, i32 %d) #0 {
7 ; CHECK-LABEL: test_ints:
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: addl %edx, %eax
10 ; CHECK-NEXT: imull %ecx, %eax
11 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %eax
20 define i32 @test_floats(i32 %a, i32 %b, float %c, float %d) #0 {
21 ; CHECK-LABEL: test_floats:
22 ; CHECK: # %bb.0: # %entry
23 ; CHECK-NEXT: addl %edx, %eax
24 ; CHECK-NEXT: imull %ecx, %eax
25 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %eax
28 %ci = bitcast float %c to i32
29 %di = bitcast float %d to i32
31 %r2 = mul i32 %ci, %r1
32 %r3 = add i32 %di, %r2
36 define double @test_doubles(double %d1, double %d2) #0 {
37 ; CHECK-LABEL: test_doubles:
38 ; CHECK: # %bb.0: # %entry
39 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %eax
40 ; CHECK-NEXT: adcl {{[0-9]+}}(%esp), %edx
43 %d1i = bitcast double %d1 to i64
44 %d2i = bitcast double %d2 to i64
45 %r = add i64 %d1i, %d2i
46 %rd = bitcast i64 %r to double
50 define double @test_mixed_doubles(double %d2, i32 %i) #0 {
51 ; CHECK-LABEL: test_mixed_doubles:
52 ; CHECK: # %bb.0: # %entry
53 ; CHECK-NEXT: addl %ecx, %eax
54 ; CHECK-NEXT: adcl $0, %edx
57 %iext = zext i32 %i to i64
58 %d2i = bitcast double %d2 to i64
59 %r = add i64 %iext, %d2i
60 %rd = bitcast i64 %r to double
64 define void @ret_large_struct(ptr noalias nocapture sret(%struct.st12_t) %agg.result, ptr byval(%struct.st12_t) nocapture readonly align 4 %r) #0 {
65 ; CHECK-LABEL: ret_large_struct:
66 ; CHECK: # %bb.0: # %entry
67 ; CHECK-NEXT: pushl %esi
68 ; CHECK-NEXT: movl %eax, %esi
69 ; CHECK-NEXT: leal {{[0-9]+}}(%esp), %edx
70 ; CHECK-NEXT: movl $48, %ecx
71 ; CHECK-NEXT: calll memcpy
72 ; CHECK-NEXT: movl %esi, %eax
73 ; CHECK-NEXT: popl %esi
76 call void @llvm.memcpy.p0.p0.i32(ptr %agg.result, ptr %r, i32 48, i1 false)
80 define i32 @var_args(i32 %i1, ...) #0 {
81 ; CHECK-LABEL: var_args:
82 ; CHECK: # %bb.0: # %entry
83 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
89 %struct.S = type { i8 }
91 define i32 @test_lib_args(float %a, float %b) #0 {
92 ; CHECK-LABEL: test_lib_args:
94 ; CHECK-NEXT: movl %edx, %eax
95 ; CHECK-NEXT: calll __fixsfsi
97 %ret = fptosi float %b to i32
101 define i32 @test_fp128(ptr %ptr) #0 {
102 ; CHECK-LABEL: test_fp128:
104 ; CHECK-NEXT: pushl 12(%eax)
105 ; CHECK-NEXT: pushl 8(%eax)
106 ; CHECK-NEXT: pushl 4(%eax)
107 ; CHECK-NEXT: pushl (%eax)
108 ; CHECK-NEXT: calll __fixtfsi
109 ; CHECK-NEXT: addl $16, %esp
111 %v = load fp128, ptr %ptr
112 %ret = fptosi fp128 %v to i32
116 declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1) #1
118 define void @test_alignment_d() #0 {
119 ; CHECK-LABEL: test_alignment_d:
120 ; CHECK: # %bb.0: # %entry
121 ; CHECK-NEXT: subl $8, %esp
122 ; CHECK-NEXT: movl $1073741824, {{[0-9]+}}(%esp) # imm = 0x40000000
123 ; CHECK-NEXT: movl $0, (%esp)
124 ; CHECK-NEXT: movl %esp, %eax
125 ; CHECK-NEXT: calll food@PLT
126 ; CHECK-NEXT: addl $8, %esp
130 store double 2.000000e+00, ptr %d
131 call void @food(ptr inreg %d)
135 define void @test_alignment_i() #0 {
136 ; CHECK-LABEL: test_alignment_i:
137 ; CHECK: # %bb.0: # %entry
138 ; CHECK-NEXT: subl $8, %esp
139 ; CHECK-NEXT: movl $0, {{[0-9]+}}(%esp)
140 ; CHECK-NEXT: movl $2, (%esp)
141 ; CHECK-NEXT: movl %esp, %eax
142 ; CHECK-NEXT: calll fooi@PLT
143 ; CHECK-NEXT: addl $8, %esp
148 call void @fooi(ptr inreg %i)
152 define void @test_alignment_s() #0 {
153 ; CHECK-LABEL: test_alignment_s:
155 ; CHECK-NEXT: pushl %eax
156 ; CHECK-NEXT: movl %esp, %eax
157 ; CHECK-NEXT: calll foos@PLT
158 ; CHECK-NEXT: popl %eax
160 %s = alloca %struct.S, align 4
161 call void @foos(ptr inreg %s)
165 define void @test_alignment_fp() #0 {
166 ; CHECK-LABEL: test_alignment_fp:
167 ; CHECK: # %bb.0: # %entry
168 ; CHECK-NEXT: subl $16, %esp
169 ; CHECK-NEXT: movl $1073741824, {{[0-9]+}}(%esp) # imm = 0x40000000
170 ; CHECK-NEXT: movl $0, {{[0-9]+}}(%esp)
171 ; CHECK-NEXT: movl $0, {{[0-9]+}}(%esp)
172 ; CHECK-NEXT: movl $0, (%esp)
173 ; CHECK-NEXT: movl %esp, %eax
174 ; CHECK-NEXT: calll foofp@PLT
175 ; CHECK-NEXT: addl $16, %esp
179 store fp128 0xL00000000000000004000000000000000, ptr %f
180 call void @foofp(ptr inreg %f)
184 declare void @food(ptr inreg)
185 declare void @fooi(ptr inreg)
186 declare void @foos(ptr inreg)
187 declare void @foofp(ptr inreg)
189 attributes #0 = { nounwind "use-soft-float"="true"}
190 attributes #1 = { nounwind argmemonly }