Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #include <linux/types.h> |
| 3 | #include <linux/errno.h> |
Linus Torvalds | 7c0f6ba | 2016-12-24 11:46:01 -0800 | [diff] [blame] | 4 | #include <linux/uaccess.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | |
Kumar Gala | d2b194e | 2008-06-04 02:59:29 -0500 | [diff] [blame] | 6 | #include <asm/sfp-machine.h> |
| 7 | #include <math-emu/soft-fp.h> |
| 8 | #include <math-emu/double.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 10 | int |
| 11 | fsel(u32 *frD, void *frA, u32 *frB, u32 *frC) |
| 12 | { |
| 13 | FP_DECL_D(A); |
Kumar Gala | d2b194e | 2008-06-04 02:59:29 -0500 | [diff] [blame] | 14 | FP_DECL_EX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | #ifdef DEBUG |
Harvey Harrison | e48b1b4 | 2008-03-29 08:21:07 +1100 | [diff] [blame] | 17 | printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #endif |
| 19 | |
Kumar Gala | d2b194e | 2008-06-04 02:59:29 -0500 | [diff] [blame] | 20 | FP_UNPACK_DP(A, frA); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
| 22 | #ifdef DEBUG |
| 23 | printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); |
| 24 | printk("B: %08x %08x\n", frB[0], frB[1]); |
| 25 | printk("C: %08x %08x\n", frC[0], frC[1]); |
| 26 | #endif |
| 27 | |
| 28 | if (A_c == FP_CLS_NAN || (A_c != FP_CLS_ZERO && A_s)) { |
| 29 | frD[0] = frB[0]; |
| 30 | frD[1] = frB[1]; |
| 31 | } else { |
| 32 | frD[0] = frC[0]; |
| 33 | frD[1] = frC[1]; |
| 34 | } |
| 35 | |
| 36 | #ifdef DEBUG |
| 37 | printk("D: %08x.%08x\n", frD[0], frD[1]); |
| 38 | #endif |
| 39 | |
| 40 | return 0; |
| 41 | } |