fcmpd.c 472 B

123456789101112131415161718192021222324
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2005-2018 Andes Technology Corporation
  3. #include <asm/sfp-machine.h>
  4. #include <math-emu/soft-fp.h>
  5. #include <math-emu/double.h>
  6. int fcmpd(void *ft, void *fa, void *fb, int cmpop)
  7. {
  8. FP_DECL_D(A);
  9. FP_DECL_D(B);
  10. FP_DECL_EX;
  11. long cmp;
  12. FP_UNPACK_DP(A, fa);
  13. FP_UNPACK_DP(B, fb);
  14. FP_CMP_D(cmp, A, B, SF_CUN);
  15. cmp += 2;
  16. if (cmp == SF_CGT)
  17. *(long *)ft = 0;
  18. else
  19. *(long *)ft = (cmp & cmpop) ? 1 : 0;
  20. return 0;
  21. }