• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1    /*
2     * float-to-long
3     *
4     * We have to clip values to long min/max per the specification.  The
5     * expected common case is a "reasonable" value that converts directly
6     * to modest integer.  The EABI convert function isn't doing this for us
7     * for pre-R6.
8     */
9    /* unop vA, vB */
10    GET_OPA4(rOBJ)                         #  rOBJ <- A+
11    GET_OPB(a3)                            #  a3 <- B
12    GET_VREG_F(fa0, a3)
13    FETCH_ADVANCE_INST(1)                  #  advance rPC, load rINST
14
15#ifdef MIPS32REVGE6
16    GET_INST_OPCODE(t1)                    #  extract opcode from rINST
17    trunc.l.s fa0, fa0
18    SET_VREG64_F_GOTO(fa0, fa0f, rOBJ, t1) #  vA <- result
19#else
20    c.eq.s    fcc0, fa0, fa0
21    li        rRESULT0, 0
22    li        rRESULT1, 0
23    bc1f      fcc0, .L${opcode}_get_opcode
24
25    li        t0, LONG_MIN_AS_FLOAT
26    mtc1      t0, fa1
27    c.ole.s   fcc0, fa0, fa1
28    li        rRESULT1, LONG_MIN_HIGH
29    bc1t      fcc0, .L${opcode}_get_opcode
30
31    neg.s     fa1, fa1
32    c.ole.s   fcc0, fa1, fa0
33    nor       rRESULT0, rRESULT0, zero
34    nor       rRESULT1, rRESULT1, zero
35    bc1t      fcc0, .L${opcode}_get_opcode
36
37    JAL(__fixsfdi)
38    GET_INST_OPCODE(t1)                    #  extract opcode from rINST
39    b         .L${opcode}_set_vreg
40#endif
41%break
42
43#ifndef MIPS32REVGE6
44.L${opcode}_get_opcode:
45    GET_INST_OPCODE(t1)                    #  extract opcode from rINST
46.L${opcode}_set_vreg:
47    SET_VREG64_GOTO(rRESULT0, rRESULT1, rOBJ, t1)   #  vA/vA+1 <- v0/v1
48#endif
49