xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/arm/ledf2vfp.S (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1//===-- ledf2vfp.S - Implement ledf2vfp -----------------------------------===//
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//
12// extern double __ledf2vfp(double a, double b);
13//
14// Returns one iff a <= b and neither is NaN.
15// Uses Darwin calling convention where double precision arguments are passsed
16// like in GPR pairs.
17//
18	.syntax unified
19	.p2align 2
20DEFINE_COMPILERRT_FUNCTION(__ledf2vfp)
21#if defined(COMPILER_RT_ARMHF_TARGET)
22	vcmp.f64 d0, d1
23#else
24	vmov 	d6, r0, r1	// load r0/r1 pair in double register
25	vmov 	d7, r2, r3	// load r2/r3 pair in double register
26	vcmp.f64 d6, d7
27#endif
28	vmrs	apsr_nzcv, fpscr
29	ITE(ls)
30	movls	r0, #1		// set result register to 1 if equal
31	movhi	r0, #0
32	bx	lr
33END_COMPILERRT_FUNCTION(__ledf2vfp)
34
35NO_EXEC_STACK_DIRECTIVE
36
37