1%default {}
2    /*
3     * Compare two floating-point values.  Puts 0, 1, or -1 into the
4     * destination register based on the results of the comparison.
5     *
6     * For: cmpl-double, cmpg-double
7     */
8    /* op vAA, vBB, vCC */
9    srl     a4, rINST, 8                # a4 <- AA
10    lbu     a2, 2(rPC)                  # a2 <- BB
11    lbu     a3, 3(rPC)                  # a3 <- CC
12    GET_VREG_DOUBLE f0, a2              # f0 <- vBB
13    GET_VREG_DOUBLE f1, a3              # f1 <- vCC
14    cmp.eq.d f2, f0, f1
15    li      a0, 0
16    bc1nez  f2, 1f                      # done if vBB == vCC (ordered)
17    .if $gt_bias
18    cmp.lt.d f2, f0, f1
19    li      a0, -1
20    bc1nez  f2, 1f                      # done if vBB < vCC (ordered)
21    li      a0, 1                       # vBB > vCC or unordered
22    .else
23    cmp.lt.d f2, f1, f0
24    li      a0, 1
25    bc1nez  f2, 1f                      # done if vBB > vCC (ordered)
26    li      a0, -1                      # vBB < vCC or unordered
27    .endif
281:
29    FETCH_ADVANCE_INST 2                # advance rPC, load rINST
30    GET_INST_OPCODE v0                  # extract opcode from rINST
31    SET_VREG a0, a4                     # vAA <- a0
32    GOTO_OPCODE v0                      # jump to next instruction
33