1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=mips64el-mti-linux-gnu -mattr=+single-float < %s | FileCheck %s
3 ; This test casts a 32-bit float to a 64-bit int. This would cause a crash due
4 ; to LLVM incorrectly lowering the float on single-float platforms.
6 define void @foo(float* %in, i64* %out) {
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: daddiu $sp, $sp, -16
10 ; CHECK-NEXT: .cfi_def_cfa_offset 16
11 ; CHECK-NEXT: sd $5, 0($sp)
12 ; CHECK-NEXT: sd $4, 8($sp)
13 ; CHECK-NEXT: lwc1 $f0, 0($4)
14 ; CHECK-NEXT: mfc1 $1, $f0
15 ; CHECK-NEXT: lui $2, 32640
16 ; CHECK-NEXT: and $2, $1, $2
17 ; CHECK-NEXT: srl $2, $2, 23
18 ; CHECK-NEXT: lui $3, 127
19 ; CHECK-NEXT: ori $3, $3, 65535
20 ; CHECK-NEXT: addiu $4, $zero, 150
21 ; CHECK-NEXT: subu $4, $4, $2
22 ; CHECK-NEXT: and $3, $1, $3
23 ; CHECK-NEXT: lui $6, 128
24 ; CHECK-NEXT: or $3, $3, $6
25 ; CHECK-NEXT: dsll $3, $3, 32
26 ; CHECK-NEXT: dsrl $3, $3, 32
27 ; CHECK-NEXT: dsrlv $4, $3, $4
28 ; CHECK-NEXT: addiu $6, $2, -150
29 ; CHECK-NEXT: dsllv $3, $3, $6
30 ; CHECK-NEXT: addiu $2, $2, -127
31 ; CHECK-NEXT: slti $6, $2, 24
32 ; CHECK-NEXT: movz $4, $3, $6
33 ; CHECK-NEXT: sra $1, $1, 31
34 ; CHECK-NEXT: xor $3, $4, $1
35 ; CHECK-NEXT: dsubu $1, $3, $1
36 ; CHECK-NEXT: slti $2, $2, 0
37 ; CHECK-NEXT: movn $1, $zero, $2
38 ; CHECK-NEXT: sd $1, 0($5)
40 ; CHECK-NEXT: daddiu $sp, $sp, 16
42 %in.addr = alloca float*, align 8
43 %out.addr = alloca i64*, align 8
44 store float* %in, float** %in.addr, align 8
45 store i64* %out, i64** %out.addr, align 8
46 %0 = load float*, float** %in.addr, align 8
47 %1 = load float, float* %0, align 4
48 %conv = fptosi float %1 to i64
49 %2 = load i64*, i64** %out.addr, align 8
50 store i64 %conv, i64* %2, align 8