Alexey Frunze | 00b53b7 | 2016-02-02 20:25:45 -0800 | [diff] [blame] | 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-float, cmpg-float |
| 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_FLOAT f0, a2 # f0 <- vBB |
| 13 | GET_VREG_FLOAT f1, a3 # f1 <- vCC |
| 14 | cmp.eq.s f2, f0, f1 |
| 15 | li a0, 0 |
| 16 | bc1nez f2, 1f # done if vBB == vCC (ordered) |
| 17 | .if $gt_bias |
| 18 | cmp.lt.s 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.s 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 |
| 28 | 1: |
| 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 |