1 ; RUN: llc < %s -mtriple=i686-pc-elfiamcu | FileCheck %s
3 %struct.st12_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
5 ; CHECK-LABEL: test_ints:
6 ; CHECK: addl %edx, %eax
7 ; CHECK-NEXT: imull %ecx, %eax
8 ; CHECK-NEXT: addl 4(%esp), %eax
10 define i32 @test_ints(i32 %a, i32 %b, i32 %c, i32 %d) #0 {
18 ; CHECK-LABEL: test_floats:
19 ; CHECK: addl %edx, %eax
20 ; CHECK-NEXT: imull %ecx, %eax
21 ; CHECK-NEXT: addl 4(%esp), %eax
23 define i32 @test_floats(i32 %a, i32 %b, float %c, float %d) #0 {
25 %ci = bitcast float %c to i32
26 %di = bitcast float %d to i32
28 %r2 = mul i32 %ci, %r1
29 %r3 = add i32 %di, %r2
33 ; CHECK-LABEL: test_doubles:
34 ; CHECK: addl 4(%esp), %eax
35 ; CHECK-NEXT: adcl 8(%esp), %edx
37 define double @test_doubles(double %d1, double %d2) #0 {
39 %d1i = bitcast double %d1 to i64
40 %d2i = bitcast double %d2 to i64
41 %r = add i64 %d1i, %d2i
42 %rd = bitcast i64 %r to double
46 ; CHECK-LABEL: test_mixed_doubles:
47 ; CHECK: addl %ecx, %eax
48 ; CHECK-NEXT: adcl $0, %edx
50 define double @test_mixed_doubles(double %d2, i32 %i) #0 {
52 %iext = zext i32 %i to i64
53 %d2i = bitcast double %d2 to i64
54 %r = add i64 %iext, %d2i
55 %rd = bitcast i64 %r to double
59 ; CHECK-LABEL: ret_large_struct:
61 ; CHECK-NEXT: movl %eax, %esi
62 ; CHECK-NEXT: leal 8(%esp), %edx
63 ; CHECK-NEXT: movl $48, %ecx
64 ; CHECK-NEXT: calll memcpy
65 ; CHECK-NEXT: movl %esi, %eax
66 ; CHECK-NEXT: popl %esi
69 define void @ret_large_struct(%struct.st12_t* noalias nocapture sret %agg.result, %struct.st12_t* byval nocapture readonly align 4 %r) #0 {
71 %0 = bitcast %struct.st12_t* %agg.result to i8*
72 %1 = bitcast %struct.st12_t* %r to i8*
73 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 48, i1 false)
77 ; CHECK-LABEL: var_args:
78 ; CHECK: movl 4(%esp), %eax
80 define i32 @var_args(i32 %i1, ...) #0 {
85 %struct.S = type { i8 }
87 ; CHECK-LABEL: test_lib_args:
88 ; CHECK: movl %edx, %eax
89 ; CHECK: calll __fixsfsi
90 define i32 @test_lib_args(float %a, float %b) #0 {
91 %ret = fptosi float %b to i32
95 ; CHECK-LABEL: test_fp128:
96 ; CHECK: pushl 12(%eax)
97 ; CHECK-NEXT: pushl 8(%eax)
98 ; CHECK-NEXT: pushl 4(%eax)
99 ; CHECK-NEXT: pushl (%eax)
100 ; CHECK-NEXT: calll __fixtfsi
101 define i32 @test_fp128(fp128* %ptr) #0 {
102 %v = load fp128, fp128* %ptr
103 %ret = fptosi fp128 %v to i32
107 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #1
109 ; CHECK-LABEL: test_alignment_d:
110 ; CHECK-NOT: andl {{.+}}, %esp
111 define void @test_alignment_d() #0 {
114 store double 2.000000e+00, double* %d
115 call void @food(double* inreg %d)
119 ; CHECK-LABEL: test_alignment_i:
120 ; CHECK-NOT: andl {{.+}}, %esp
121 define void @test_alignment_i() #0 {
125 call void @fooi(i64* inreg %i)
130 ; CHECK-LABEL: test_alignment_s:
131 ; CHECK-NOT: andl {{.+}}, %esp
132 define void @test_alignment_s() #0 {
133 %s = alloca %struct.S, align 4
134 call void @foos(%struct.S* inreg %s)
139 ; CHECK-LABEL: test_alignment_fp:
140 ; CHECK-NOT: andl {{.+}}, %esp
141 define void @test_alignment_fp() #0 {
144 store fp128 0xL00000000000000004000000000000000, fp128* %f
145 call void @foofp(fp128* inreg %f)
149 declare void @food(double* inreg)
150 declare void @fooi(i64* inreg)
151 declare void @foos(%struct.S* inreg)
152 declare void @foofp(fp128* inreg)
154 attributes #0 = { nounwind "use-soft-float"="true"}
155 attributes #1 = { nounwind argmemonly }