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