1 %verify "executed" 2 %include "mips/unflop.S" {"instr":"b f2i_doconv", "instr_f":"b f2i_doconv"} 3 %break 4 5 /* 6 * Not an entry point as it is used only once !! 7 */ 8 f2i_doconv: 9 #ifdef SOFT_FLOAT 10 li a1, 0x4f000000 # (float)maxint 11 move rBIX, a0 12 JAL(__gesf2) # is arg >= maxint? 13 move t0, v0 14 li v0, ~0x80000000 # return maxint (7fffffff) 15 bgez t0, .L${opcode}_set_vreg 16 17 move a0, rBIX # recover arg 18 li a1, 0xcf000000 # (float)minint 19 JAL(__lesf2) 20 21 move t0, v0 22 li v0, 0x80000000 # return minint (80000000) 23 blez t0, .L${opcode}_set_vreg 24 move a0, rBIX 25 move a1, rBIX 26 JAL(__nesf2) 27 28 move t0, v0 29 li v0, 0 # return zero for NaN 30 bnez t0, .L${opcode}_set_vreg 31 32 move a0, rBIX 33 JAL(__fixsfsi) 34 b .L${opcode}_set_vreg 35 #else 36 l.s fa1, .LFLOAT_TO_INT_max 37 c.ole.s fcc0, fa1, fa0 38 l.s fv0, .LFLOAT_TO_INT_ret_max 39 bc1t .L${opcode}_set_vreg_f 40 41 l.s fa1, .LFLOAT_TO_INT_min 42 c.ole.s fcc0, fa0, fa1 43 l.s fv0, .LFLOAT_TO_INT_ret_min 44 bc1t .L${opcode}_set_vreg_f 45 46 mov.s fa1, fa0 47 c.un.s fcc0, fa0, fa1 48 li.s fv0, 0 49 bc1t .L${opcode}_set_vreg_f 50 51 trunc.w.s fv0, fa0 52 b .L${opcode}_set_vreg_f 53 #endif 54 55 .LFLOAT_TO_INT_max: 56 .word 0x4f000000 57 .LFLOAT_TO_INT_min: 58 .word 0xcf000000 59 .LFLOAT_TO_INT_ret_max: 60 .word 0x7fffffff 61 .LFLOAT_TO_INT_ret_min: 62 .word 0x80000000 63 64