Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
1da177e4 LT |
2 | #include <linux/types.h> |
3 | #include <linux/errno.h> | |
7c0f6ba6 | 4 | #include <linux/uaccess.h> |
1da177e4 | 5 | |
d2b194ed KG |
6 | #include <asm/sfp-machine.h> |
7 | #include <math-emu/soft-fp.h> | |
8 | #include <math-emu/double.h> | |
1da177e4 LT |
9 | |
10 | int | |
11 | fsel(u32 *frD, void *frA, u32 *frB, u32 *frC) | |
12 | { | |
13 | FP_DECL_D(A); | |
d2b194ed | 14 | FP_DECL_EX; |
1da177e4 LT |
15 | |
16 | #ifdef DEBUG | |
e48b1b45 | 17 | printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); |
1da177e4 LT |
18 | #endif |
19 | ||
d2b194ed | 20 | FP_UNPACK_DP(A, frA); |
1da177e4 LT |
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 | } |