File: no-ret-in-x87-reg.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (193 lines) | stat: -rw-r--r-- 6,057 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-- | FileCheck %s -check-prefix=X87
; RUN: llc < %s -mtriple=i686-- -mattr=-x87 | FileCheck %s -check-prefixes=NOX87,NOSSE-NOX87
; RUN: llc < %s -mtriple=i686-- -mattr=-x87,-sse2 | FileCheck %s -check-prefixes=NOX87,NOSSE-NOX87
; RUN: llc < %s -mtriple=i686-- -mattr=-x87,+sse2 | FileCheck %s -check-prefixes=NOX87,SSE-NOX87

define float @f1(float %a, float %b) nounwind {
; X87-LABEL: f1:
; X87:       # %bb.0: # %entry
; X87-NEXT:    flds {{[0-9]+}}(%esp)
; X87-NEXT:    retl
;
; NOSSE-NOX87-LABEL: f1:
; NOSSE-NOX87:       # %bb.0: # %entry
; NOSSE-NOX87-NEXT:    movl {{[0-9]+}}(%esp), %eax
; NOSSE-NOX87-NEXT:    retl
;
; SSE-NOX87-LABEL: f1:
; SSE-NOX87:       # %bb.0: # %entry
; SSE-NOX87-NEXT:    movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
; SSE-NOX87-NEXT:    movd %xmm0, %eax
; SSE-NOX87-NEXT:    retl
entry:
  ret float %b
}

define double @f2(double %a, double %b) nounwind {
; X87-LABEL: f2:
; X87:       # %bb.0: # %entry
; X87-NEXT:    fldl {{[0-9]+}}(%esp)
; X87-NEXT:    retl
;
; NOX87-LABEL: f2:
; NOX87:       # %bb.0: # %entry
; NOX87-NEXT:    movl {{[0-9]+}}(%esp), %eax
; NOX87-NEXT:    movl {{[0-9]+}}(%esp), %edx
; NOX87-NEXT:    retl
entry:
  ret double %b
}

define x86_fp80 @f3(x86_fp80 %a, x86_fp80 %b) nounwind {
; X87-LABEL: f3:
; X87:       # %bb.0: # %entry
; X87-NEXT:    fldt {{[0-9]+}}(%esp)
; X87-NEXT:    retl
;
; NOX87-LABEL: f3:
; NOX87:       # %bb.0: # %entry
; NOX87-NEXT:    movl {{[0-9]+}}(%esp), %eax
; NOX87-NEXT:    movl {{[0-9]+}}(%esp), %edx
; NOX87-NEXT:    movl {{[0-9]+}}(%esp), %ecx
; NOX87-NEXT:    retl
entry:
  ret x86_fp80 %b
}

define float @f4(float %a, float %b) nounwind {
; X87-LABEL: f4:
; X87:       # %bb.0: # %entry
; X87-NEXT:    flds {{[0-9]+}}(%esp)
; X87-NEXT:    fadds {{[0-9]+}}(%esp)
; X87-NEXT:    retl
;
; NOSSE-NOX87-LABEL: f4:
; NOSSE-NOX87:       # %bb.0: # %entry
; NOSSE-NOX87-NEXT:    pushl {{[0-9]+}}(%esp)
; NOSSE-NOX87-NEXT:    pushl {{[0-9]+}}(%esp)
; NOSSE-NOX87-NEXT:    calll __addsf3
; NOSSE-NOX87-NEXT:    addl $8, %esp
; NOSSE-NOX87-NEXT:    retl
;
; SSE-NOX87-LABEL: f4:
; SSE-NOX87:       # %bb.0: # %entry
; SSE-NOX87-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; SSE-NOX87-NEXT:    addss {{[0-9]+}}(%esp), %xmm0
; SSE-NOX87-NEXT:    movd %xmm0, %eax
; SSE-NOX87-NEXT:    retl
entry:
  %0 = fadd float %a, %b
  ret float %0
}

define double @f5(double %a, double %b) nounwind {
; X87-LABEL: f5:
; X87:       # %bb.0: # %entry
; X87-NEXT:    fldl {{[0-9]+}}(%esp)
; X87-NEXT:    faddl {{[0-9]+}}(%esp)
; X87-NEXT:    retl
;
; NOSSE-NOX87-LABEL: f5:
; NOSSE-NOX87:       # %bb.0: # %entry
; NOSSE-NOX87-NEXT:    pushl {{[0-9]+}}(%esp)
; NOSSE-NOX87-NEXT:    pushl {{[0-9]+}}(%esp)
; NOSSE-NOX87-NEXT:    pushl {{[0-9]+}}(%esp)
; NOSSE-NOX87-NEXT:    pushl {{[0-9]+}}(%esp)
; NOSSE-NOX87-NEXT:    calll __adddf3
; NOSSE-NOX87-NEXT:    addl $16, %esp
; NOSSE-NOX87-NEXT:    retl
;
; SSE-NOX87-LABEL: f5:
; SSE-NOX87:       # %bb.0: # %entry
; SSE-NOX87-NEXT:    pushl %ebp
; SSE-NOX87-NEXT:    movl %esp, %ebp
; SSE-NOX87-NEXT:    andl $-8, %esp
; SSE-NOX87-NEXT:    subl $8, %esp
; SSE-NOX87-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
; SSE-NOX87-NEXT:    addsd 16(%ebp), %xmm0
; SSE-NOX87-NEXT:    movsd %xmm0, (%esp)
; SSE-NOX87-NEXT:    movl (%esp), %eax
; SSE-NOX87-NEXT:    movl {{[0-9]+}}(%esp), %edx
; SSE-NOX87-NEXT:    movl %ebp, %esp
; SSE-NOX87-NEXT:    popl %ebp
; SSE-NOX87-NEXT:    retl
entry:
  %0 = fadd double %a, %b
  ret double %0
}

; FIXME: We should not generate x87 instructions when x87 is disabled.
define x86_fp80 @f6(x86_fp80 %a, x86_fp80 %b) nounwind {
; X87-LABEL: f6:
; X87:       # %bb.0: # %entry
; X87-NEXT:    fldt {{[0-9]+}}(%esp)
; X87-NEXT:    fldt {{[0-9]+}}(%esp)
; X87-NEXT:    faddp %st, %st(1)
; X87-NEXT:    retl
;
; NOX87-LABEL: f6:
; NOX87:       # %bb.0: # %entry
; NOX87-NEXT:    pushl %ebp
; NOX87-NEXT:    movl %esp, %ebp
; NOX87-NEXT:    andl $-8, %esp
; NOX87-NEXT:    subl $48, %esp
; NOX87-NEXT:    movl 20(%ebp), %eax
; NOX87-NEXT:    movl 24(%ebp), %ecx
; NOX87-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
; NOX87-NEXT:    movl %eax, {{[0-9]+}}(%esp)
; NOX87-NEXT:    movl 28(%ebp), %eax
; NOX87-NEXT:    movw %ax, {{[0-9]+}}(%esp)
; NOX87-NEXT:    movl 8(%ebp), %eax
; NOX87-NEXT:    movl 12(%ebp), %ecx
; NOX87-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
; NOX87-NEXT:    movl %eax, {{[0-9]+}}(%esp)
; NOX87-NEXT:    movl 16(%ebp), %eax
; NOX87-NEXT:    movw %ax, {{[0-9]+}}(%esp)
; NOX87-NEXT:    fldt {{[0-9]+}}(%esp)
; NOX87-NEXT:    fldt {{[0-9]+}}(%esp)
; NOX87-NEXT:    faddp %st, %st(1)
; NOX87-NEXT:    fstpt (%esp)
; NOX87-NEXT:    movl (%esp), %eax
; NOX87-NEXT:    movl {{[0-9]+}}(%esp), %edx
; NOX87-NEXT:    movzwl {{[0-9]+}}(%esp), %ecx
; NOX87-NEXT:    movl %ebp, %esp
; NOX87-NEXT:    popl %ebp
; NOX87-NEXT:    retl
entry:
  %0 = fadd x86_fp80 %a, %b
  ret x86_fp80 %0
}

define {float, float, float} @f7(float %a, float %b) nounwind {
; X87-LABEL: f7:
; X87:       # %bb.0: # %entry
; X87-NEXT:    movl {{[0-9]+}}(%esp), %eax
; X87-NEXT:    flds {{[0-9]+}}(%esp)
; X87-NEXT:    flds {{[0-9]+}}(%esp)
; X87-NEXT:    fstps 8(%eax)
; X87-NEXT:    fsts 4(%eax)
; X87-NEXT:    fstps (%eax)
; X87-NEXT:    retl $4
;
; NOSSE-NOX87-LABEL: f7:
; NOSSE-NOX87:       # %bb.0: # %entry
; NOSSE-NOX87-NEXT:    movl {{[0-9]+}}(%esp), %eax
; NOSSE-NOX87-NEXT:    movl {{[0-9]+}}(%esp), %ecx
; NOSSE-NOX87-NEXT:    movl %eax, %edx
; NOSSE-NOX87-NEXT:    retl
;
; SSE-NOX87-LABEL: f7:
; SSE-NOX87:       # %bb.0: # %entry
; SSE-NOX87-NEXT:    movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
; SSE-NOX87-NEXT:    movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
; SSE-NOX87-NEXT:    movd %xmm0, %eax
; SSE-NOX87-NEXT:    movd %xmm0, %edx
; SSE-NOX87-NEXT:    movd %xmm1, %ecx
; SSE-NOX87-NEXT:    retl
entry:
  %0 = insertvalue {float, float, float} undef, float %a, 0
  %1 = insertvalue {float, float, float} %0, float %a, 1
  %2 = insertvalue {float, float, float} %1, float %b, 2
  ret {float, float, float} %2
}