• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%verify "executed"
2%include "mips/unflopWide.S" {"instr":"b d2l_doconv", "st_result":"STORE64(rRESULT0, rRESULT1, rOBJ)"}
3%break
4
5d2l_doconv:
6#ifdef SOFT_FLOAT
7    la        t0, .LDOUBLE_TO_LONG_max
8    LOAD64(rARG2, rARG3, t0)
9    move      rBIX, rARG0                  #  save a0
10    move      rTEMP, rARG1                 #  and a1
11    JAL(__gedf2)
12
13    move      t1, v0
14    la        t0, .LDOUBLE_TO_LONG_ret_max
15    LOAD64(rRESULT0, rRESULT1, t0)
16    bgez      t1, .L${opcode}_set_vreg
17
18    move      rARG0, rBIX
19    move      rARG1, rTEMP
20    la        t0, .LDOUBLE_TO_LONG_min
21    LOAD64(rARG2, rARG3, t0)
22    JAL(__ledf2)
23
24    move      t1, v0
25    la        t0, .LDOUBLE_TO_LONG_ret_min
26    LOAD64(rRESULT0, rRESULT1, t0)
27    blez      t1, .L${opcode}_set_vreg
28
29    move      rARG0, rBIX
30    move      rARG1, rTEMP
31    move      rARG2, rBIX
32    move      rARG3, rTEMP
33    JAL(__nedf2)
34
35    move      t0, v0
36    li        rRESULT0, 0
37    li        rRESULT1, 0
38    bnez      t0, .L${opcode}_set_vreg
39
40    move      rARG0, rBIX
41    move      rARG1, rTEMP
42    JAL(__fixdfdi)
43
44#else
45    la        t0, .LDOUBLE_TO_LONG_max
46    LOAD64_F(fa1, fa1f, t0)
47    c.ole.d   fcc0, fa1, fa0
48    la        t0, .LDOUBLE_TO_LONG_ret_max
49    LOAD64(rRESULT0, rRESULT1, t0)
50    bc1t      .L${opcode}_set_vreg
51
52    la        t0, .LDOUBLE_TO_LONG_min
53    LOAD64_F(fa1, fa1f, t0)
54    c.ole.d   fcc0, fa0, fa1
55    la        t0, .LDOUBLE_TO_LONG_ret_min
56    LOAD64(rRESULT0, rRESULT1, t0)
57    bc1t      .L${opcode}_set_vreg
58
59    mov.d     fa1, fa0
60    c.un.d    fcc0, fa0, fa1
61    li        rRESULT0, 0
62    li        rRESULT1, 0
63    bc1t      .L${opcode}_set_vreg
64    JAL(__fixdfdi)
65#endif
66    b         .L${opcode}_set_vreg
67
68
69.LDOUBLE_TO_LONG_max:
70    .dword 0x43e0000000000000              #  maxlong, as a double (high word)
71.LDOUBLE_TO_LONG_min:
72    .dword 0xc3e0000000000000              #  minlong, as a double (high word)
73.LDOUBLE_TO_LONG_ret_max:
74    .dword 0x7fffffffffffffff
75.LDOUBLE_TO_LONG_ret_min:
76    .dword 0x8000000000000000
77