patch-2.1.79 linux/arch/sparc64/math-emu/fcmpeq.c

Next file: linux/arch/sparc64/math-emu/fcmpq.c
Previous file: linux/arch/sparc64/math-emu/fadds.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.78/linux/arch/sparc64/math-emu/fcmpeq.c linux/arch/sparc64/math-emu/fcmpeq.c
@@ -0,0 +1,28 @@
+#include "soft-fp.h"
+#include "quad.h"
+
+int FCMPEQ(void *rd, void *rs2, void *rs1)
+{
+	FP_DECL_Q(A); FP_DECL_Q(B);
+	long ret;
+	int fccno = ((long)rd) & 3;
+	unsigned long fsr;
+	
+	rd = (void *)(((long)rd)&~3);
+	__FP_UNPACK_Q(A, rs1);
+	__FP_UNPACK_Q(B, rs2);
+	FP_CMP_Q(ret, A, B, 3);
+	switch (ret) {
+	case 1: ret = 2; break;
+	case -1: ret = 1; break;
+	}
+	fsr = *(unsigned long *)rd;
+	switch (fccno) {
+	case 0: fsr &= ~0xc00; fsr |= (ret << 10); break;
+	case 1: fsr &= ~0x300000000UL; fsr |= (ret << 32); break;
+	case 2: fsr &= ~0xc00000000UL; fsr |= (ret << 34); break;
+	case 3: fsr &= ~0x3000000000UL; fsr |= (ret << 36); break;
+	}
+	*(unsigned long *)rd = fsr;
+	return 1;
+}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov