| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #define JUMP_MASK $t6 | |
| 8 | |
| 9 /* | 7 /* |
| 10 * Rounding mode control field is bits [1:0] in FCSR. | 8 * Rounding mode control field is bits [1:0] in FCSR. |
| 11 * This function takes the two-bit value and sets bits [1:0]. | 9 * This function takes the two-bit value and sets bits [1:0]. |
| 12 * | 10 * |
| 13 * The bit patterns for MIPS are: | 11 * The bit patterns for MIPS are: |
| 14 * 0b00 Round to Nearest (RN) mode | 12 * 0b00 Round to Nearest (RN) mode |
| 15 * 0b10 Round towards Plus Infinity (RP) mode | 13 * 0b10 Round towards Plus Infinity (RP) mode |
| 16 * 0b11 Round towards Minus Infinity (RM) mode | 14 * 0b11 Round towards Minus Infinity (RM) mode |
| 17 * 0b01 Round towards Zero (RZ) mode | 15 * 0b01 Round towards Zero (RZ) mode |
| 18 */ | 16 */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 li $t1, 0xfffffffc | 32 li $t1, 0xfffffffc |
| 35 and $v0, $v0, $t1 | 33 and $v0, $v0, $t1 |
| 36 or $v0, $v0, $a0 | 34 or $v0, $v0, $a0 |
| 37 #if defined(__clang__) | 35 #if defined(__clang__) |
| 38 # .word 0x44c2f800 | 36 # .word 0x44c2f800 |
| 39 #else | 37 #else |
| 40 ctc1 $v0, $31 /* fcsr */ | 38 ctc1 $v0, $31 /* fcsr */ |
| 41 #endif | 39 #endif |
| 42 nop /* Force return sequence to next bundle. */ | 40 nop /* Force return sequence to next bundle. */ |
| 43 | 41 |
| 44 and $ra, $ra, JUMP_MASK | |
| 45 jr $ra | 42 jr $ra |
| 46 nop | 43 nop |
| 47 | 44 |
| 48 .p2align 4 | 45 .p2align 4 |
| 49 .globl set_round_toward_nearest | 46 .globl set_round_toward_nearest |
| 50 set_round_toward_nearest: | 47 set_round_toward_nearest: |
| 51 li $a0, 0 | 48 li $a0, 0 |
| 52 j set_rounding_control_field | 49 j set_rounding_control_field |
| 53 | 50 |
| 54 .p2align 4 | 51 .p2align 4 |
| 55 .globl set_round_toward_plus_infinity | 52 .globl set_round_toward_plus_infinity |
| 56 set_round_toward_plus_infinity: | 53 set_round_toward_plus_infinity: |
| 57 li $a0, 2 | 54 li $a0, 2 |
| 58 j set_rounding_control_field | 55 j set_rounding_control_field |
| 59 | 56 |
| 60 .p2align 4 | 57 .p2align 4 |
| 61 .globl set_round_toward_minus_infinity | 58 .globl set_round_toward_minus_infinity |
| 62 set_round_toward_minus_infinity: | 59 set_round_toward_minus_infinity: |
| 63 li $a0, 3 | 60 li $a0, 3 |
| 64 j set_rounding_control_field | 61 j set_rounding_control_field |
| 65 | 62 |
| 66 .p2align 4 | 63 .p2align 4 |
| 67 .globl set_round_toward_zero | 64 .globl set_round_toward_zero |
| 68 set_round_toward_zero: | 65 set_round_toward_zero: |
| 69 li $a0, 1 | 66 li $a0, 1 |
| 70 j set_rounding_control_field | 67 j set_rounding_control_field |
| OLD | NEW |