fsel.c 748 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <linux/types.h>
  2. #include <linux/errno.h>
  3. #include <asm/uaccess.h>
  4. #include <asm/sfp-machine.h>
  5. #include <math-emu/soft-fp.h>
  6. #include <math-emu/double.h>
  7. int
  8. fsel(u32 *frD, void *frA, u32 *frB, u32 *frC)
  9. {
  10. FP_DECL_D(A);
  11. FP_DECL_EX;
  12. #ifdef DEBUG
  13. printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
  14. #endif
  15. FP_UNPACK_DP(A, frA);
  16. #ifdef DEBUG
  17. printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
  18. printk("B: %08x %08x\n", frB[0], frB[1]);
  19. printk("C: %08x %08x\n", frC[0], frC[1]);
  20. #endif
  21. if (A_c == FP_CLS_NAN || (A_c != FP_CLS_ZERO && A_s)) {
  22. frD[0] = frB[0];
  23. frD[1] = frB[1];
  24. } else {
  25. frD[0] = frC[0];
  26. frD[1] = frC[1];
  27. }
  28. #ifdef DEBUG
  29. printk("D: %08x.%08x\n", frD[0], frD[1]);
  30. #endif
  31. return 0;
  32. }