xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/arm/eqdf2vfp.S (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1//===-- eqdf2vfp.S - Implement eqdf2vfp -----------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "../assembly.h"
10
11// extern int __eqdf2vfp(double a, double b);
12//
13// Returns one iff a == b and neither is NaN.
14// Uses Darwin calling convention where double precision arguments are passsed
15// like in GPR pairs.
16
17	.syntax unified
18	.p2align 2
19DEFINE_COMPILERRT_FUNCTION(__eqdf2vfp)
20#if defined(COMPILER_RT_ARMHF_TARGET)
21	vcmp.f64 d0, d1
22#else
23	vmov	d6, r0, r1	// load r0/r1 pair in double register
24	vmov	d7, r2, r3	// load r2/r3 pair in double register
25	vcmp.f64 d6, d7
26#endif
27	vmrs	apsr_nzcv, fpscr
28	ITE(eq)
29	moveq	r0, #1		// set result register to 1 if equal
30	movne	r0, #0
31	bx	lr
32END_COMPILERRT_FUNCTION(__eqdf2vfp)
33
34NO_EXEC_STACK_DIRECTIVE
35
36