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