1%include "mips/funop.S" {"instr":"b f2i_doconv"}
2%break
3
4/*
5 * Not an entry point as it is used only once !!
6 */
7f2i_doconv:
8#ifdef MIPS32REVGE6
9    l.s       fa1, .LFLOAT_TO_INT_max
10    cmp.ule.s ft2, fa1, fa0
11    l.s       fv0, .LFLOAT_TO_INT_ret_max
12    bc1nez    ft2, .L${opcode}_set_vreg_f
13
14    l.s       fa1, .LFLOAT_TO_INT_min
15    cmp.ule.s ft2, fa0, fa1
16    l.s       fv0, .LFLOAT_TO_INT_ret_min
17    bc1nez    ft2, .L${opcode}_set_vreg_f
18
19    mov.s     fa1, fa0
20    cmp.un.s  ft2, fa0, fa1
21    li.s      fv0, 0
22    bc1nez    ft2, .L${opcode}_set_vreg_f
23#else
24    l.s       fa1, .LFLOAT_TO_INT_max
25    c.ole.s   fcc0, fa1, fa0
26    l.s       fv0, .LFLOAT_TO_INT_ret_max
27    bc1t      .L${opcode}_set_vreg_f
28
29    l.s       fa1, .LFLOAT_TO_INT_min
30    c.ole.s   fcc0, fa0, fa1
31    l.s       fv0, .LFLOAT_TO_INT_ret_min
32    bc1t      .L${opcode}_set_vreg_f
33
34    mov.s     fa1, fa0
35    c.un.s    fcc0, fa0, fa1
36    li.s      fv0, 0
37    bc1t      .L${opcode}_set_vreg_f
38#endif
39
40    trunc.w.s  fv0, fa0
41    b         .L${opcode}_set_vreg_f
42
43.LFLOAT_TO_INT_max:
44    .word 0x4f000000
45.LFLOAT_TO_INT_min:
46    .word 0xcf000000
47.LFLOAT_TO_INT_ret_max:
48    .word 0x7fffffff
49.LFLOAT_TO_INT_ret_min:
50    .word 0x80000000
51