blob: 0ea225abe88020118456c11b610c6e5540f31d0b [file] [log] [blame]
Vincent Chen1ac83252018-11-22 11:14:35 +08001// 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>
6int 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
13 FP_UNPACK_DP(A, fa);
14 FP_UNPACK_DP(B, fb);
15
16 FP_CMP_D(cmp, A, B, SF_CUN);
17 cmp += 2;
18 if (cmp == SF_CGT)
19 *(long *)ft = 0;
20 else
21 *(long *)ft = (cmp & cmpop) ? 1 : 0;
22
23 return 0;
24}