1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i386-unknown | FileCheck %s --check-prefixes=X86,X86-X87 3 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefixes=X64,X64-X87 4 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=X64,X64-SSSE3 5 6 ; 7 ; fptosi 8 ; 9 10 define i16 @fptosi_i16_fp80(x86_fp80 %a0) nounwind { 11 ; X86-LABEL: fptosi_i16_fp80: 12 ; X86: # %bb.0: 13 ; X86-NEXT: pushl %eax 14 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 15 ; X86-NEXT: fnstcw (%esp) 16 ; X86-NEXT: movzwl (%esp), %eax 17 ; X86-NEXT: movw $3199, (%esp) # imm = 0xC7F 18 ; X86-NEXT: fldcw (%esp) 19 ; X86-NEXT: movw %ax, (%esp) 20 ; X86-NEXT: fistps {{[0-9]+}}(%esp) 21 ; X86-NEXT: fldcw (%esp) 22 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 23 ; X86-NEXT: popl %ecx 24 ; X86-NEXT: retl 25 ; 26 ; X64-X87-LABEL: fptosi_i16_fp80: 27 ; X64-X87: # %bb.0: 28 ; X64-X87-NEXT: fldt {{[0-9]+}}(%rsp) 29 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 30 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 31 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 32 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 33 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 34 ; X64-X87-NEXT: fistpl -{{[0-9]+}}(%rsp) 35 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 36 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 37 ; X64-X87-NEXT: # kill: def $ax killed $ax killed $eax 38 ; X64-X87-NEXT: retq 39 ; 40 ; X64-SSSE3-LABEL: fptosi_i16_fp80: 41 ; X64-SSSE3: # %bb.0: 42 ; X64-SSSE3-NEXT: fldt {{[0-9]+}}(%rsp) 43 ; X64-SSSE3-NEXT: fisttpl -{{[0-9]+}}(%rsp) 44 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 45 ; X64-SSSE3-NEXT: # kill: def $ax killed $ax killed $eax 46 ; X64-SSSE3-NEXT: retq 47 %1 = fptosi x86_fp80 %a0 to i16 48 ret i16 %1 49 } 50 51 define i16 @fptosi_i16_fp80_ld(x86_fp80 *%a0) nounwind { 52 ; X86-LABEL: fptosi_i16_fp80_ld: 53 ; X86: # %bb.0: 54 ; X86-NEXT: pushl %eax 55 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 56 ; X86-NEXT: fldt (%eax) 57 ; X86-NEXT: fnstcw (%esp) 58 ; X86-NEXT: movzwl (%esp), %eax 59 ; X86-NEXT: movw $3199, (%esp) # imm = 0xC7F 60 ; X86-NEXT: fldcw (%esp) 61 ; X86-NEXT: movw %ax, (%esp) 62 ; X86-NEXT: fistps {{[0-9]+}}(%esp) 63 ; X86-NEXT: fldcw (%esp) 64 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 65 ; X86-NEXT: popl %ecx 66 ; X86-NEXT: retl 67 ; 68 ; X64-X87-LABEL: fptosi_i16_fp80_ld: 69 ; X64-X87: # %bb.0: 70 ; X64-X87-NEXT: fldt (%rdi) 71 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 72 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 73 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 74 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 75 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 76 ; X64-X87-NEXT: fistpl -{{[0-9]+}}(%rsp) 77 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 78 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 79 ; X64-X87-NEXT: # kill: def $ax killed $ax killed $eax 80 ; X64-X87-NEXT: retq 81 ; 82 ; X64-SSSE3-LABEL: fptosi_i16_fp80_ld: 83 ; X64-SSSE3: # %bb.0: 84 ; X64-SSSE3-NEXT: fldt (%rdi) 85 ; X64-SSSE3-NEXT: fisttpl -{{[0-9]+}}(%rsp) 86 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 87 ; X64-SSSE3-NEXT: # kill: def $ax killed $ax killed $eax 88 ; X64-SSSE3-NEXT: retq 89 %1 = load x86_fp80, x86_fp80 *%a0 90 %2 = fptosi x86_fp80 %1 to i16 91 ret i16 %2 92 } 93 94 define i32 @fptosi_i32_fp80(x86_fp80 %a0) nounwind { 95 ; X86-LABEL: fptosi_i32_fp80: 96 ; X86: # %bb.0: 97 ; X86-NEXT: subl $8, %esp 98 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 99 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 100 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 101 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 102 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 103 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 104 ; X86-NEXT: fistpl {{[0-9]+}}(%esp) 105 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 106 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 107 ; X86-NEXT: addl $8, %esp 108 ; X86-NEXT: retl 109 ; 110 ; X64-X87-LABEL: fptosi_i32_fp80: 111 ; X64-X87: # %bb.0: 112 ; X64-X87-NEXT: fldt {{[0-9]+}}(%rsp) 113 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 114 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 115 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 116 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 117 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 118 ; X64-X87-NEXT: fistpl -{{[0-9]+}}(%rsp) 119 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 120 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 121 ; X64-X87-NEXT: retq 122 ; 123 ; X64-SSSE3-LABEL: fptosi_i32_fp80: 124 ; X64-SSSE3: # %bb.0: 125 ; X64-SSSE3-NEXT: fldt {{[0-9]+}}(%rsp) 126 ; X64-SSSE3-NEXT: fisttpl -{{[0-9]+}}(%rsp) 127 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 128 ; X64-SSSE3-NEXT: retq 129 %1 = fptosi x86_fp80 %a0 to i32 130 ret i32 %1 131 } 132 133 define i32 @fptosi_i32_fp80_ld(x86_fp80 *%a0) nounwind { 134 ; X86-LABEL: fptosi_i32_fp80_ld: 135 ; X86: # %bb.0: 136 ; X86-NEXT: subl $8, %esp 137 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 138 ; X86-NEXT: fldt (%eax) 139 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 140 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 141 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 142 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 143 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 144 ; X86-NEXT: fistpl {{[0-9]+}}(%esp) 145 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 146 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 147 ; X86-NEXT: addl $8, %esp 148 ; X86-NEXT: retl 149 ; 150 ; X64-X87-LABEL: fptosi_i32_fp80_ld: 151 ; X64-X87: # %bb.0: 152 ; X64-X87-NEXT: fldt (%rdi) 153 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 154 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 155 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 156 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 157 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 158 ; X64-X87-NEXT: fistpl -{{[0-9]+}}(%rsp) 159 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 160 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 161 ; X64-X87-NEXT: retq 162 ; 163 ; X64-SSSE3-LABEL: fptosi_i32_fp80_ld: 164 ; X64-SSSE3: # %bb.0: 165 ; X64-SSSE3-NEXT: fldt (%rdi) 166 ; X64-SSSE3-NEXT: fisttpl -{{[0-9]+}}(%rsp) 167 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 168 ; X64-SSSE3-NEXT: retq 169 %1 = load x86_fp80, x86_fp80 *%a0 170 %2 = fptosi x86_fp80 %1 to i32 171 ret i32 %2 172 } 173 174 define i64 @fptosi_i64_fp80(x86_fp80 %a0) nounwind { 175 ; X86-LABEL: fptosi_i64_fp80: 176 ; X86: # %bb.0: 177 ; X86-NEXT: pushl %ebp 178 ; X86-NEXT: movl %esp, %ebp 179 ; X86-NEXT: andl $-8, %esp 180 ; X86-NEXT: subl $16, %esp 181 ; X86-NEXT: fldt 8(%ebp) 182 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 183 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 184 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 185 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 186 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 187 ; X86-NEXT: fistpll {{[0-9]+}}(%esp) 188 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 189 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 190 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 191 ; X86-NEXT: movl %ebp, %esp 192 ; X86-NEXT: popl %ebp 193 ; X86-NEXT: retl 194 ; 195 ; X64-X87-LABEL: fptosi_i64_fp80: 196 ; X64-X87: # %bb.0: 197 ; X64-X87-NEXT: fldt {{[0-9]+}}(%rsp) 198 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 199 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 200 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 201 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 202 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 203 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 204 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 205 ; X64-X87-NEXT: movq -{{[0-9]+}}(%rsp), %rax 206 ; X64-X87-NEXT: retq 207 ; 208 ; X64-SSSE3-LABEL: fptosi_i64_fp80: 209 ; X64-SSSE3: # %bb.0: 210 ; X64-SSSE3-NEXT: fldt {{[0-9]+}}(%rsp) 211 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 212 ; X64-SSSE3-NEXT: movq -{{[0-9]+}}(%rsp), %rax 213 ; X64-SSSE3-NEXT: retq 214 %1 = fptosi x86_fp80 %a0 to i64 215 ret i64 %1 216 } 217 218 define i64 @fptosi_i64_fp80_ld(x86_fp80 *%a0) nounwind { 219 ; X86-LABEL: fptosi_i64_fp80_ld: 220 ; X86: # %bb.0: 221 ; X86-NEXT: pushl %ebp 222 ; X86-NEXT: movl %esp, %ebp 223 ; X86-NEXT: andl $-8, %esp 224 ; X86-NEXT: subl $16, %esp 225 ; X86-NEXT: movl 8(%ebp), %eax 226 ; X86-NEXT: fldt (%eax) 227 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 228 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 229 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 230 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 231 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 232 ; X86-NEXT: fistpll {{[0-9]+}}(%esp) 233 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 234 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 235 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx 236 ; X86-NEXT: movl %ebp, %esp 237 ; X86-NEXT: popl %ebp 238 ; X86-NEXT: retl 239 ; 240 ; X64-X87-LABEL: fptosi_i64_fp80_ld: 241 ; X64-X87: # %bb.0: 242 ; X64-X87-NEXT: fldt (%rdi) 243 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 244 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 245 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 246 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 247 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 248 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 249 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 250 ; X64-X87-NEXT: movq -{{[0-9]+}}(%rsp), %rax 251 ; X64-X87-NEXT: retq 252 ; 253 ; X64-SSSE3-LABEL: fptosi_i64_fp80_ld: 254 ; X64-SSSE3: # %bb.0: 255 ; X64-SSSE3-NEXT: fldt (%rdi) 256 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 257 ; X64-SSSE3-NEXT: movq -{{[0-9]+}}(%rsp), %rax 258 ; X64-SSSE3-NEXT: retq 259 %1 = load x86_fp80, x86_fp80 *%a0 260 %2 = fptosi x86_fp80 %1 to i64 261 ret i64 %2 262 } 263 264 ; 265 ; fptoui 266 ; 267 268 define i16 @fptoui_i16_fp80(x86_fp80 %a0) nounwind { 269 ; X86-LABEL: fptoui_i16_fp80: 270 ; X86: # %bb.0: 271 ; X86-NEXT: subl $8, %esp 272 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 273 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 274 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 275 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 276 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 277 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 278 ; X86-NEXT: fistpl {{[0-9]+}}(%esp) 279 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 280 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 281 ; X86-NEXT: # kill: def $ax killed $ax killed $eax 282 ; X86-NEXT: addl $8, %esp 283 ; X86-NEXT: retl 284 ; 285 ; X64-X87-LABEL: fptoui_i16_fp80: 286 ; X64-X87: # %bb.0: 287 ; X64-X87-NEXT: fldt {{[0-9]+}}(%rsp) 288 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 289 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 290 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 291 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 292 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 293 ; X64-X87-NEXT: fistpl -{{[0-9]+}}(%rsp) 294 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 295 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 296 ; X64-X87-NEXT: # kill: def $ax killed $ax killed $eax 297 ; X64-X87-NEXT: retq 298 ; 299 ; X64-SSSE3-LABEL: fptoui_i16_fp80: 300 ; X64-SSSE3: # %bb.0: 301 ; X64-SSSE3-NEXT: fldt {{[0-9]+}}(%rsp) 302 ; X64-SSSE3-NEXT: fisttpl -{{[0-9]+}}(%rsp) 303 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 304 ; X64-SSSE3-NEXT: # kill: def $ax killed $ax killed $eax 305 ; X64-SSSE3-NEXT: retq 306 %1 = fptoui x86_fp80 %a0 to i16 307 ret i16 %1 308 } 309 310 define i16 @fptoui_i16_fp80_ld(x86_fp80 *%a0) nounwind { 311 ; X86-LABEL: fptoui_i16_fp80_ld: 312 ; X86: # %bb.0: 313 ; X86-NEXT: subl $8, %esp 314 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 315 ; X86-NEXT: fldt (%eax) 316 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 317 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 318 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 319 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 320 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 321 ; X86-NEXT: fistpl {{[0-9]+}}(%esp) 322 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 323 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 324 ; X86-NEXT: # kill: def $ax killed $ax killed $eax 325 ; X86-NEXT: addl $8, %esp 326 ; X86-NEXT: retl 327 ; 328 ; X64-X87-LABEL: fptoui_i16_fp80_ld: 329 ; X64-X87: # %bb.0: 330 ; X64-X87-NEXT: fldt (%rdi) 331 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 332 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 333 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 334 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 335 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 336 ; X64-X87-NEXT: fistpl -{{[0-9]+}}(%rsp) 337 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 338 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 339 ; X64-X87-NEXT: # kill: def $ax killed $ax killed $eax 340 ; X64-X87-NEXT: retq 341 ; 342 ; X64-SSSE3-LABEL: fptoui_i16_fp80_ld: 343 ; X64-SSSE3: # %bb.0: 344 ; X64-SSSE3-NEXT: fldt (%rdi) 345 ; X64-SSSE3-NEXT: fisttpl -{{[0-9]+}}(%rsp) 346 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 347 ; X64-SSSE3-NEXT: # kill: def $ax killed $ax killed $eax 348 ; X64-SSSE3-NEXT: retq 349 %1 = load x86_fp80, x86_fp80 *%a0 350 %2 = fptoui x86_fp80 %1 to i16 351 ret i16 %2 352 } 353 354 define i32 @fptoui_i32_fp80(x86_fp80 %a0) nounwind { 355 ; X86-LABEL: fptoui_i32_fp80: 356 ; X86: # %bb.0: 357 ; X86-NEXT: pushl %ebp 358 ; X86-NEXT: movl %esp, %ebp 359 ; X86-NEXT: andl $-8, %esp 360 ; X86-NEXT: subl $16, %esp 361 ; X86-NEXT: fldt 8(%ebp) 362 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 363 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 364 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 365 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 366 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 367 ; X86-NEXT: fistpll {{[0-9]+}}(%esp) 368 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 369 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 370 ; X86-NEXT: movl %ebp, %esp 371 ; X86-NEXT: popl %ebp 372 ; X86-NEXT: retl 373 ; 374 ; X64-X87-LABEL: fptoui_i32_fp80: 375 ; X64-X87: # %bb.0: 376 ; X64-X87-NEXT: fldt {{[0-9]+}}(%rsp) 377 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 378 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 379 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 380 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 381 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 382 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 383 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 384 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 385 ; X64-X87-NEXT: retq 386 ; 387 ; X64-SSSE3-LABEL: fptoui_i32_fp80: 388 ; X64-SSSE3: # %bb.0: 389 ; X64-SSSE3-NEXT: fldt {{[0-9]+}}(%rsp) 390 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 391 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 392 ; X64-SSSE3-NEXT: retq 393 %1 = fptoui x86_fp80 %a0 to i32 394 ret i32 %1 395 } 396 397 define i32 @fptoui_i32_fp80_ld(x86_fp80 *%a0) nounwind { 398 ; X86-LABEL: fptoui_i32_fp80_ld: 399 ; X86: # %bb.0: 400 ; X86-NEXT: pushl %ebp 401 ; X86-NEXT: movl %esp, %ebp 402 ; X86-NEXT: andl $-8, %esp 403 ; X86-NEXT: subl $16, %esp 404 ; X86-NEXT: movl 8(%ebp), %eax 405 ; X86-NEXT: fldt (%eax) 406 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 407 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 408 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 409 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 410 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 411 ; X86-NEXT: fistpll {{[0-9]+}}(%esp) 412 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 413 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 414 ; X86-NEXT: movl %ebp, %esp 415 ; X86-NEXT: popl %ebp 416 ; X86-NEXT: retl 417 ; 418 ; X64-X87-LABEL: fptoui_i32_fp80_ld: 419 ; X64-X87: # %bb.0: 420 ; X64-X87-NEXT: fldt (%rdi) 421 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 422 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 423 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 424 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 425 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 426 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 427 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 428 ; X64-X87-NEXT: movl -{{[0-9]+}}(%rsp), %eax 429 ; X64-X87-NEXT: retq 430 ; 431 ; X64-SSSE3-LABEL: fptoui_i32_fp80_ld: 432 ; X64-SSSE3: # %bb.0: 433 ; X64-SSSE3-NEXT: fldt (%rdi) 434 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 435 ; X64-SSSE3-NEXT: movl -{{[0-9]+}}(%rsp), %eax 436 ; X64-SSSE3-NEXT: retq 437 %1 = load x86_fp80, x86_fp80 *%a0 438 %2 = fptoui x86_fp80 %1 to i32 439 ret i32 %2 440 } 441 442 define i64 @fptoui_i64_fp80(x86_fp80 %a0) nounwind { 443 ; X86-LABEL: fptoui_i64_fp80: 444 ; X86: # %bb.0: 445 ; X86-NEXT: pushl %ebp 446 ; X86-NEXT: movl %esp, %ebp 447 ; X86-NEXT: andl $-8, %esp 448 ; X86-NEXT: subl $16, %esp 449 ; X86-NEXT: fldt 8(%ebp) 450 ; X86-NEXT: flds {{\.LCPI.*}} 451 ; X86-NEXT: fld %st(1) 452 ; X86-NEXT: fsub %st(1) 453 ; X86-NEXT: fxch %st(1) 454 ; X86-NEXT: fucomp %st(2) 455 ; X86-NEXT: fnstsw %ax 456 ; X86-NEXT: # kill: def $ah killed $ah killed $ax 457 ; X86-NEXT: sahf 458 ; X86-NEXT: ja .LBB10_2 459 ; X86-NEXT: # %bb.1: 460 ; X86-NEXT: fstp %st(1) 461 ; X86-NEXT: fldz 462 ; X86-NEXT: .LBB10_2: 463 ; X86-NEXT: fstp %st(0) 464 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 465 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 466 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 467 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 468 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 469 ; X86-NEXT: fistpll {{[0-9]+}}(%esp) 470 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 471 ; X86-NEXT: setbe %al 472 ; X86-NEXT: movzbl %al, %edx 473 ; X86-NEXT: shll $31, %edx 474 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %edx 475 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 476 ; X86-NEXT: movl %ebp, %esp 477 ; X86-NEXT: popl %ebp 478 ; X86-NEXT: retl 479 ; 480 ; X64-X87-LABEL: fptoui_i64_fp80: 481 ; X64-X87: # %bb.0: 482 ; X64-X87-NEXT: fldt {{[0-9]+}}(%rsp) 483 ; X64-X87-NEXT: flds {{.*}}(%rip) 484 ; X64-X87-NEXT: fld %st(1) 485 ; X64-X87-NEXT: fsub %st(1) 486 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 487 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 488 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 489 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 490 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 491 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 492 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 493 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 494 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 495 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 496 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 497 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 498 ; X64-X87-NEXT: fld %st(1) 499 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 500 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 501 ; X64-X87-NEXT: fucompi %st(1) 502 ; X64-X87-NEXT: fstp %st(0) 503 ; X64-X87-NEXT: jbe .LBB10_1 504 ; X64-X87-NEXT: # %bb.2: 505 ; X64-X87-NEXT: movq -{{[0-9]+}}(%rsp), %rax 506 ; X64-X87-NEXT: retq 507 ; X64-X87-NEXT: .LBB10_1: 508 ; X64-X87-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 509 ; X64-X87-NEXT: xorq -{{[0-9]+}}(%rsp), %rax 510 ; X64-X87-NEXT: retq 511 ; 512 ; X64-SSSE3-LABEL: fptoui_i64_fp80: 513 ; X64-SSSE3: # %bb.0: 514 ; X64-SSSE3-NEXT: fldt {{[0-9]+}}(%rsp) 515 ; X64-SSSE3-NEXT: flds {{.*}}(%rip) 516 ; X64-SSSE3-NEXT: fld %st(1) 517 ; X64-SSSE3-NEXT: fsub %st(1) 518 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 519 ; X64-SSSE3-NEXT: fld %st(1) 520 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 521 ; X64-SSSE3-NEXT: fucompi %st(1) 522 ; X64-SSSE3-NEXT: fstp %st(0) 523 ; X64-SSSE3-NEXT: jbe .LBB10_1 524 ; X64-SSSE3-NEXT: # %bb.2: 525 ; X64-SSSE3-NEXT: movq -{{[0-9]+}}(%rsp), %rax 526 ; X64-SSSE3-NEXT: retq 527 ; X64-SSSE3-NEXT: .LBB10_1: 528 ; X64-SSSE3-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 529 ; X64-SSSE3-NEXT: xorq -{{[0-9]+}}(%rsp), %rax 530 ; X64-SSSE3-NEXT: retq 531 %1 = fptoui x86_fp80 %a0 to i64 532 ret i64 %1 533 } 534 535 define i64 @fptoui_i64_fp80_ld(x86_fp80 *%a0) nounwind { 536 ; X86-LABEL: fptoui_i64_fp80_ld: 537 ; X86: # %bb.0: 538 ; X86-NEXT: pushl %ebp 539 ; X86-NEXT: movl %esp, %ebp 540 ; X86-NEXT: andl $-8, %esp 541 ; X86-NEXT: subl $16, %esp 542 ; X86-NEXT: movl 8(%ebp), %eax 543 ; X86-NEXT: fldt (%eax) 544 ; X86-NEXT: flds {{\.LCPI.*}} 545 ; X86-NEXT: fld %st(1) 546 ; X86-NEXT: fsub %st(1) 547 ; X86-NEXT: fxch %st(1) 548 ; X86-NEXT: fucomp %st(2) 549 ; X86-NEXT: fnstsw %ax 550 ; X86-NEXT: # kill: def $ah killed $ah killed $ax 551 ; X86-NEXT: sahf 552 ; X86-NEXT: ja .LBB11_2 553 ; X86-NEXT: # %bb.1: 554 ; X86-NEXT: fstp %st(1) 555 ; X86-NEXT: fldz 556 ; X86-NEXT: .LBB11_2: 557 ; X86-NEXT: fstp %st(0) 558 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp) 559 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 560 ; X86-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 561 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 562 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 563 ; X86-NEXT: fistpll {{[0-9]+}}(%esp) 564 ; X86-NEXT: fldcw {{[0-9]+}}(%esp) 565 ; X86-NEXT: setbe %al 566 ; X86-NEXT: movzbl %al, %edx 567 ; X86-NEXT: shll $31, %edx 568 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %edx 569 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 570 ; X86-NEXT: movl %ebp, %esp 571 ; X86-NEXT: popl %ebp 572 ; X86-NEXT: retl 573 ; 574 ; X64-X87-LABEL: fptoui_i64_fp80_ld: 575 ; X64-X87: # %bb.0: 576 ; X64-X87-NEXT: fldt (%rdi) 577 ; X64-X87-NEXT: flds {{.*}}(%rip) 578 ; X64-X87-NEXT: fld %st(1) 579 ; X64-X87-NEXT: fsub %st(1) 580 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 581 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 582 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 583 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 584 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 585 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 586 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 587 ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) 588 ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax 589 ; X64-X87-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F 590 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 591 ; X64-X87-NEXT: movw %ax, -{{[0-9]+}}(%rsp) 592 ; X64-X87-NEXT: fld %st(1) 593 ; X64-X87-NEXT: fistpll -{{[0-9]+}}(%rsp) 594 ; X64-X87-NEXT: fldcw -{{[0-9]+}}(%rsp) 595 ; X64-X87-NEXT: fucompi %st(1) 596 ; X64-X87-NEXT: fstp %st(0) 597 ; X64-X87-NEXT: jbe .LBB11_1 598 ; X64-X87-NEXT: # %bb.2: 599 ; X64-X87-NEXT: movq -{{[0-9]+}}(%rsp), %rax 600 ; X64-X87-NEXT: retq 601 ; X64-X87-NEXT: .LBB11_1: 602 ; X64-X87-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 603 ; X64-X87-NEXT: xorq -{{[0-9]+}}(%rsp), %rax 604 ; X64-X87-NEXT: retq 605 ; 606 ; X64-SSSE3-LABEL: fptoui_i64_fp80_ld: 607 ; X64-SSSE3: # %bb.0: 608 ; X64-SSSE3-NEXT: fldt (%rdi) 609 ; X64-SSSE3-NEXT: flds {{.*}}(%rip) 610 ; X64-SSSE3-NEXT: fld %st(1) 611 ; X64-SSSE3-NEXT: fsub %st(1) 612 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 613 ; X64-SSSE3-NEXT: fld %st(1) 614 ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) 615 ; X64-SSSE3-NEXT: fucompi %st(1) 616 ; X64-SSSE3-NEXT: fstp %st(0) 617 ; X64-SSSE3-NEXT: jbe .LBB11_1 618 ; X64-SSSE3-NEXT: # %bb.2: 619 ; X64-SSSE3-NEXT: movq -{{[0-9]+}}(%rsp), %rax 620 ; X64-SSSE3-NEXT: retq 621 ; X64-SSSE3-NEXT: .LBB11_1: 622 ; X64-SSSE3-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 623 ; X64-SSSE3-NEXT: xorq -{{[0-9]+}}(%rsp), %rax 624 ; X64-SSSE3-NEXT: retq 625 %1 = load x86_fp80, x86_fp80 *%a0 626 %2 = fptoui x86_fp80 %1 to i64 627 ret i64 %2 628 } 629 630 ; 631 ; sitofp 632 ; 633 634 define x86_fp80 @sitofp_fp80_i16(i16 %a0) nounwind { 635 ; X86-LABEL: sitofp_fp80_i16: 636 ; X86: # %bb.0: 637 ; X86-NEXT: pushl %eax 638 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 639 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 640 ; X86-NEXT: filds {{[0-9]+}}(%esp) 641 ; X86-NEXT: popl %eax 642 ; X86-NEXT: retl 643 ; 644 ; X64-LABEL: sitofp_fp80_i16: 645 ; X64: # %bb.0: 646 ; X64-NEXT: movswl %di, %eax 647 ; X64-NEXT: movl %eax, -{{[0-9]+}}(%rsp) 648 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp) 649 ; X64-NEXT: retq 650 %1 = sitofp i16 %a0 to x86_fp80 651 ret x86_fp80 %1 652 } 653 654 define x86_fp80 @sitofp_fp80_i16_ld(i16 *%a0) nounwind { 655 ; X86-LABEL: sitofp_fp80_i16_ld: 656 ; X86: # %bb.0: 657 ; X86-NEXT: pushl %eax 658 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 659 ; X86-NEXT: movzwl (%eax), %eax 660 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp) 661 ; X86-NEXT: filds {{[0-9]+}}(%esp) 662 ; X86-NEXT: popl %eax 663 ; X86-NEXT: retl 664 ; 665 ; X64-LABEL: sitofp_fp80_i16_ld: 666 ; X64: # %bb.0: 667 ; X64-NEXT: movswl (%rdi), %eax 668 ; X64-NEXT: movl %eax, -{{[0-9]+}}(%rsp) 669 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp) 670 ; X64-NEXT: retq 671 %1 = load i16, i16 *%a0 672 %2 = sitofp i16 %1 to x86_fp80 673 ret x86_fp80 %2 674 } 675 676 define x86_fp80 @sitofp_fp80_i32(i32 %a0) nounwind { 677 ; X86-LABEL: sitofp_fp80_i32: 678 ; X86: # %bb.0: 679 ; X86-NEXT: pushl %eax 680 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 681 ; X86-NEXT: movl %eax, (%esp) 682 ; X86-NEXT: fildl (%esp) 683 ; X86-NEXT: popl %eax 684 ; X86-NEXT: retl 685 ; 686 ; X64-LABEL: sitofp_fp80_i32: 687 ; X64: # %bb.0: 688 ; X64-NEXT: movl %edi, -{{[0-9]+}}(%rsp) 689 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp) 690 ; X64-NEXT: retq 691 %1 = sitofp i32 %a0 to x86_fp80 692 ret x86_fp80 %1 693 } 694 695 define x86_fp80 @sitofp_fp80_i32_ld(i32 *%a0) nounwind { 696 ; X86-LABEL: sitofp_fp80_i32_ld: 697 ; X86: # %bb.0: 698 ; X86-NEXT: pushl %eax 699 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 700 ; X86-NEXT: movl (%eax), %eax 701 ; X86-NEXT: movl %eax, (%esp) 702 ; X86-NEXT: fildl (%esp) 703 ; X86-NEXT: popl %eax 704 ; X86-NEXT: retl 705 ; 706 ; X64-LABEL: sitofp_fp80_i32_ld: 707 ; X64: # %bb.0: 708 ; X64-NEXT: movl (%rdi), %eax 709 ; X64-NEXT: movl %eax, -{{[0-9]+}}(%rsp) 710 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp) 711 ; X64-NEXT: retq 712 %1 = load i32, i32 *%a0 713 %2 = sitofp i32 %1 to x86_fp80 714 ret x86_fp80 %2 715 } 716 717 define x86_fp80 @sitofp_fp80_i64(i64 %a0) nounwind { 718 ; X86-LABEL: sitofp_fp80_i64: 719 ; X86: # %bb.0: 720 ; X86-NEXT: fildll {{[0-9]+}}(%esp) 721 ; X86-NEXT: retl 722 ; 723 ; X64-LABEL: sitofp_fp80_i64: 724 ; X64: # %bb.0: 725 ; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp) 726 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp) 727 ; X64-NEXT: retq 728 %1 = sitofp i64 %a0 to x86_fp80 729 ret x86_fp80 %1 730 } 731 732 define x86_fp80 @sitofp_fp80_i64_ld(i64 *%a0) nounwind { 733 ; X86-LABEL: sitofp_fp80_i64_ld: 734 ; X86: # %bb.0: 735 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 736 ; X86-NEXT: fildll (%eax) 737 ; X86-NEXT: retl 738 ; 739 ; X64-LABEL: sitofp_fp80_i64_ld: 740 ; X64: # %bb.0: 741 ; X64-NEXT: movq (%rdi), %rax 742 ; X64-NEXT: movq %rax, -{{[0-9]+}}(%rsp) 743 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp) 744 ; X64-NEXT: retq 745 %1 = load i64, i64 *%a0 746 %2 = sitofp i64 %1 to x86_fp80 747 ret x86_fp80 %2 748 } 749 750 ; 751 ; uitofp 752 ; 753 754 define x86_fp80 @uitofp_fp80_i16(i16 %a0) nounwind { 755 ; X86-LABEL: uitofp_fp80_i16: 756 ; X86: # %bb.0: 757 ; X86-NEXT: pushl %eax 758 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax 759 ; X86-NEXT: movl %eax, (%esp) 760 ; X86-NEXT: fildl (%esp) 761 ; X86-NEXT: popl %eax 762 ; X86-NEXT: retl 763 ; 764 ; X64-LABEL: uitofp_fp80_i16: 765 ; X64: # %bb.0: 766 ; X64-NEXT: movzwl %di, %eax 767 ; X64-NEXT: movl %eax, -{{[0-9]+}}(%rsp) 768 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp) 769 ; X64-NEXT: retq 770 %1 = uitofp i16 %a0 to x86_fp80 771 ret x86_fp80 %1 772 } 773 774 define x86_fp80 @uitofp_fp80_i16_ld(i16 *%a0) nounwind { 775 ; X86-LABEL: uitofp_fp80_i16_ld: 776 ; X86: # %bb.0: 777 ; X86-NEXT: pushl %eax 778 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 779 ; X86-NEXT: movzwl (%eax), %eax 780 ; X86-NEXT: movl %eax, (%esp) 781 ; X86-NEXT: fildl (%esp) 782 ; X86-NEXT: popl %eax 783 ; X86-NEXT: retl 784 ; 785 ; X64-LABEL: uitofp_fp80_i16_ld: 786 ; X64: # %bb.0: 787 ; X64-NEXT: movzwl (%rdi), %eax 788 ; X64-NEXT: movl %eax, -{{[0-9]+}}(%rsp) 789 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp) 790 ; X64-NEXT: retq 791 %1 = load i16, i16 *%a0 792 %2 = uitofp i16 %1 to x86_fp80 793 ret x86_fp80 %2 794 } 795 796 define x86_fp80 @uitofp_fp80_i32(i32 %a0) nounwind { 797 ; X86-LABEL: uitofp_fp80_i32: 798 ; X86: # %bb.0: 799 ; X86-NEXT: pushl %ebp 800 ; X86-NEXT: movl %esp, %ebp 801 ; X86-NEXT: andl $-8, %esp 802 ; X86-NEXT: subl $8, %esp 803 ; X86-NEXT: movl 8(%ebp), %eax 804 ; X86-NEXT: movl %eax, (%esp) 805 ; X86-NEXT: movl $0, {{[0-9]+}}(%esp) 806 ; X86-NEXT: fildll (%esp) 807 ; X86-NEXT: movl %ebp, %esp 808 ; X86-NEXT: popl %ebp 809 ; X86-NEXT: retl 810 ; 811 ; X64-LABEL: uitofp_fp80_i32: 812 ; X64: # %bb.0: 813 ; X64-NEXT: movl %edi, %eax 814 ; X64-NEXT: movq %rax, -{{[0-9]+}}(%rsp) 815 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp) 816 ; X64-NEXT: retq 817 %1 = uitofp i32 %a0 to x86_fp80 818 ret x86_fp80 %1 819 } 820 821 define x86_fp80 @uitofp_fp80_i32_ld(i32 *%a0) nounwind { 822 ; X86-LABEL: uitofp_fp80_i32_ld: 823 ; X86: # %bb.0: 824 ; X86-NEXT: pushl %ebp 825 ; X86-NEXT: movl %esp, %ebp 826 ; X86-NEXT: andl $-8, %esp 827 ; X86-NEXT: subl $8, %esp 828 ; X86-NEXT: movl 8(%ebp), %eax 829 ; X86-NEXT: movl (%eax), %eax 830 ; X86-NEXT: movl %eax, (%esp) 831 ; X86-NEXT: movl $0, {{[0-9]+}}(%esp) 832 ; X86-NEXT: fildll (%esp) 833 ; X86-NEXT: movl %ebp, %esp 834 ; X86-NEXT: popl %ebp 835 ; X86-NEXT: retl 836 ; 837 ; X64-LABEL: uitofp_fp80_i32_ld: 838 ; X64: # %bb.0: 839 ; X64-NEXT: movl (%rdi), %eax 840 ; X64-NEXT: movq %rax, -{{[0-9]+}}(%rsp) 841 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp) 842 ; X64-NEXT: retq 843 %1 = load i32, i32 *%a0 844 %2 = uitofp i32 %1 to x86_fp80 845 ret x86_fp80 %2 846 } 847 848 define x86_fp80 @uitofp_fp80_i64(i64 %a0) nounwind { 849 ; X86-LABEL: uitofp_fp80_i64: 850 ; X86: # %bb.0: 851 ; X86-NEXT: pushl %ebp 852 ; X86-NEXT: movl %esp, %ebp 853 ; X86-NEXT: andl $-8, %esp 854 ; X86-NEXT: subl $8, %esp 855 ; X86-NEXT: movl 8(%ebp), %eax 856 ; X86-NEXT: movl 12(%ebp), %ecx 857 ; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp) 858 ; X86-NEXT: movl %eax, (%esp) 859 ; X86-NEXT: xorl %eax, %eax 860 ; X86-NEXT: testl %ecx, %ecx 861 ; X86-NEXT: setns %al 862 ; X86-NEXT: fildll (%esp) 863 ; X86-NEXT: fadds {{\.LCPI.*}}(,%eax,4) 864 ; X86-NEXT: movl %ebp, %esp 865 ; X86-NEXT: popl %ebp 866 ; X86-NEXT: retl 867 ; 868 ; X64-LABEL: uitofp_fp80_i64: 869 ; X64: # %bb.0: 870 ; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp) 871 ; X64-NEXT: xorl %eax, %eax 872 ; X64-NEXT: testq %rdi, %rdi 873 ; X64-NEXT: setns %al 874 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp) 875 ; X64-NEXT: fadds {{\.LCPI.*}}(,%rax,4) 876 ; X64-NEXT: retq 877 %1 = uitofp i64 %a0 to x86_fp80 878 ret x86_fp80 %1 879 } 880 881 define x86_fp80 @uitofp_fp80_i64_ld(i64 *%a0) nounwind { 882 ; X86-LABEL: uitofp_fp80_i64_ld: 883 ; X86: # %bb.0: 884 ; X86-NEXT: pushl %ebp 885 ; X86-NEXT: movl %esp, %ebp 886 ; X86-NEXT: andl $-8, %esp 887 ; X86-NEXT: subl $8, %esp 888 ; X86-NEXT: movl 8(%ebp), %eax 889 ; X86-NEXT: movl (%eax), %ecx 890 ; X86-NEXT: movl 4(%eax), %eax 891 ; X86-NEXT: movl %eax, {{[0-9]+}}(%esp) 892 ; X86-NEXT: movl %ecx, (%esp) 893 ; X86-NEXT: xorl %ecx, %ecx 894 ; X86-NEXT: testl %eax, %eax 895 ; X86-NEXT: setns %cl 896 ; X86-NEXT: fildll (%esp) 897 ; X86-NEXT: fadds {{\.LCPI.*}}(,%ecx,4) 898 ; X86-NEXT: movl %ebp, %esp 899 ; X86-NEXT: popl %ebp 900 ; X86-NEXT: retl 901 ; 902 ; X64-LABEL: uitofp_fp80_i64_ld: 903 ; X64: # %bb.0: 904 ; X64-NEXT: movq (%rdi), %rax 905 ; X64-NEXT: movq %rax, -{{[0-9]+}}(%rsp) 906 ; X64-NEXT: xorl %ecx, %ecx 907 ; X64-NEXT: testq %rax, %rax 908 ; X64-NEXT: setns %cl 909 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp) 910 ; X64-NEXT: fadds {{\.LCPI.*}}(,%rcx,4) 911 ; X64-NEXT: retq 912 %1 = load i64, i64 *%a0 913 %2 = uitofp i64 %1 to x86_fp80 914 ret x86_fp80 %2 915 } 916 917 ; 918 ; floor 919 ; 920 921 define x86_fp80 @floor_fp80(x86_fp80 %a0) nounwind { 922 ; X86-LABEL: floor_fp80: 923 ; X86: # %bb.0: 924 ; X86-NEXT: subl $12, %esp 925 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 926 ; X86-NEXT: fstpt (%esp) 927 ; X86-NEXT: calll floorl 928 ; X86-NEXT: addl $12, %esp 929 ; X86-NEXT: retl 930 ; 931 ; X64-LABEL: floor_fp80: 932 ; X64: # %bb.0: 933 ; X64-NEXT: subq $24, %rsp 934 ; X64-NEXT: fldt {{[0-9]+}}(%rsp) 935 ; X64-NEXT: fstpt (%rsp) 936 ; X64-NEXT: callq floorl 937 ; X64-NEXT: addq $24, %rsp 938 ; X64-NEXT: retq 939 %1 = call x86_fp80 @llvm.floor.f80(x86_fp80 %a0) 940 ret x86_fp80 %1 941 } 942 943 define x86_fp80 @floor_fp80_ld(x86_fp80 *%a0) nounwind { 944 ; X86-LABEL: floor_fp80_ld: 945 ; X86: # %bb.0: 946 ; X86-NEXT: subl $12, %esp 947 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 948 ; X86-NEXT: fldt (%eax) 949 ; X86-NEXT: fstpt (%esp) 950 ; X86-NEXT: calll floorl 951 ; X86-NEXT: addl $12, %esp 952 ; X86-NEXT: retl 953 ; 954 ; X64-LABEL: floor_fp80_ld: 955 ; X64: # %bb.0: 956 ; X64-NEXT: subq $24, %rsp 957 ; X64-NEXT: fldt (%rdi) 958 ; X64-NEXT: fstpt (%rsp) 959 ; X64-NEXT: callq floorl 960 ; X64-NEXT: addq $24, %rsp 961 ; X64-NEXT: retq 962 %1 = load x86_fp80, x86_fp80 *%a0 963 %2 = call x86_fp80 @llvm.floor.f80(x86_fp80 %1) 964 ret x86_fp80 %2 965 } 966 967 declare x86_fp80 @llvm.floor.f80(x86_fp80 %p) 968 969 ; 970 ; ceil 971 ; 972 973 define x86_fp80 @ceil_fp80(x86_fp80 %a0) nounwind { 974 ; X86-LABEL: ceil_fp80: 975 ; X86: # %bb.0: 976 ; X86-NEXT: subl $12, %esp 977 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 978 ; X86-NEXT: fstpt (%esp) 979 ; X86-NEXT: calll ceill 980 ; X86-NEXT: addl $12, %esp 981 ; X86-NEXT: retl 982 ; 983 ; X64-LABEL: ceil_fp80: 984 ; X64: # %bb.0: 985 ; X64-NEXT: subq $24, %rsp 986 ; X64-NEXT: fldt {{[0-9]+}}(%rsp) 987 ; X64-NEXT: fstpt (%rsp) 988 ; X64-NEXT: callq ceill 989 ; X64-NEXT: addq $24, %rsp 990 ; X64-NEXT: retq 991 %1 = call x86_fp80 @llvm.ceil.f80(x86_fp80 %a0) 992 ret x86_fp80 %1 993 } 994 995 define x86_fp80 @ceil_fp80_ld(x86_fp80 *%a0) nounwind { 996 ; X86-LABEL: ceil_fp80_ld: 997 ; X86: # %bb.0: 998 ; X86-NEXT: subl $12, %esp 999 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1000 ; X86-NEXT: fldt (%eax) 1001 ; X86-NEXT: fstpt (%esp) 1002 ; X86-NEXT: calll ceill 1003 ; X86-NEXT: addl $12, %esp 1004 ; X86-NEXT: retl 1005 ; 1006 ; X64-LABEL: ceil_fp80_ld: 1007 ; X64: # %bb.0: 1008 ; X64-NEXT: subq $24, %rsp 1009 ; X64-NEXT: fldt (%rdi) 1010 ; X64-NEXT: fstpt (%rsp) 1011 ; X64-NEXT: callq ceill 1012 ; X64-NEXT: addq $24, %rsp 1013 ; X64-NEXT: retq 1014 %1 = load x86_fp80, x86_fp80 *%a0 1015 %2 = call x86_fp80 @llvm.ceil.f80(x86_fp80 %1) 1016 ret x86_fp80 %2 1017 } 1018 1019 declare x86_fp80 @llvm.ceil.f80(x86_fp80 %p) 1020 1021 ; 1022 ; trunc 1023 ; 1024 1025 define x86_fp80 @trunc_fp80(x86_fp80 %a0) nounwind { 1026 ; X86-LABEL: trunc_fp80: 1027 ; X86: # %bb.0: 1028 ; X86-NEXT: subl $12, %esp 1029 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 1030 ; X86-NEXT: fstpt (%esp) 1031 ; X86-NEXT: calll truncl 1032 ; X86-NEXT: addl $12, %esp 1033 ; X86-NEXT: retl 1034 ; 1035 ; X64-LABEL: trunc_fp80: 1036 ; X64: # %bb.0: 1037 ; X64-NEXT: subq $24, %rsp 1038 ; X64-NEXT: fldt {{[0-9]+}}(%rsp) 1039 ; X64-NEXT: fstpt (%rsp) 1040 ; X64-NEXT: callq truncl 1041 ; X64-NEXT: addq $24, %rsp 1042 ; X64-NEXT: retq 1043 %1 = call x86_fp80 @llvm.trunc.f80(x86_fp80 %a0) 1044 ret x86_fp80 %1 1045 } 1046 1047 define x86_fp80 @trunc_fp80_ld(x86_fp80 *%a0) nounwind { 1048 ; X86-LABEL: trunc_fp80_ld: 1049 ; X86: # %bb.0: 1050 ; X86-NEXT: subl $12, %esp 1051 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1052 ; X86-NEXT: fldt (%eax) 1053 ; X86-NEXT: fstpt (%esp) 1054 ; X86-NEXT: calll truncl 1055 ; X86-NEXT: addl $12, %esp 1056 ; X86-NEXT: retl 1057 ; 1058 ; X64-LABEL: trunc_fp80_ld: 1059 ; X64: # %bb.0: 1060 ; X64-NEXT: subq $24, %rsp 1061 ; X64-NEXT: fldt (%rdi) 1062 ; X64-NEXT: fstpt (%rsp) 1063 ; X64-NEXT: callq truncl 1064 ; X64-NEXT: addq $24, %rsp 1065 ; X64-NEXT: retq 1066 %1 = load x86_fp80, x86_fp80 *%a0 1067 %2 = call x86_fp80 @llvm.trunc.f80(x86_fp80 %1) 1068 ret x86_fp80 %2 1069 } 1070 1071 declare x86_fp80 @llvm.trunc.f80(x86_fp80 %p) 1072 1073 ; 1074 ; rint 1075 ; 1076 1077 define x86_fp80 @rint_fp80(x86_fp80 %a0) nounwind { 1078 ; X86-LABEL: rint_fp80: 1079 ; X86: # %bb.0: 1080 ; X86-NEXT: subl $12, %esp 1081 ; X86-NEXT: fldt {{[0-9]+}}(%esp) 1082 ; X86-NEXT: fstpt (%esp) 1083 ; X86-NEXT: calll rintl 1084 ; X86-NEXT: addl $12, %esp 1085 ; X86-NEXT: retl 1086 ; 1087 ; X64-LABEL: rint_fp80: 1088 ; X64: # %bb.0: 1089 ; X64-NEXT: subq $24, %rsp 1090 ; X64-NEXT: fldt {{[0-9]+}}(%rsp) 1091 ; X64-NEXT: fstpt (%rsp) 1092 ; X64-NEXT: callq rintl 1093 ; X64-NEXT: addq $24, %rsp 1094 ; X64-NEXT: retq 1095 %1 = call x86_fp80 @llvm.rint.f80(x86_fp80 %a0) 1096 ret x86_fp80 %1 1097 } 1098 1099 define x86_fp80 @rint_fp80_ld(x86_fp80 *%a0) nounwind { 1100 ; X86-LABEL: rint_fp80_ld: 1101 ; X86: # %bb.0: 1102 ; X86-NEXT: subl $12, %esp 1103 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1104 ; X86-NEXT: fldt (%eax) 1105 ; X86-NEXT: fstpt (%esp) 1106 ; X86-NEXT: calll rintl 1107 ; X86-NEXT: addl $12, %esp 1108 ; X86-NEXT: retl 1109 ; 1110 ; X64-LABEL: rint_fp80_ld: 1111 ; X64: # %bb.0: 1112 ; X64-NEXT: subq $24, %rsp 1113 ; X64-NEXT: fldt (%rdi) 1114 ; X64-NEXT: fstpt (%rsp) 1115 ; X64-NEXT: callq rintl 1116 ; X64-NEXT: addq $24, %rsp 1117 ; X64-NEXT: retq 1118 %1 = load x86_fp80, x86_fp80 *%a0 1119 %2 = call x86_fp80 @llvm.rint.f80(x86_fp80 %1) 1120 ret x86_fp80 %2 1121 } 1122 1123 declare x86_fp80 @llvm.rint.f80(x86_fp80 %p) 1124