xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/arm/unordsf2vfp.S (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1//===-- unordsf2vfp.S - Implement unordsf2vfp -----------------------------===//
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 int __unordsf2vfp(float a, float b);
13//
14// Returns one iff a or b is NaN
15// Uses Darwin calling convention where single precision arguments are passsed
16// like 32-bit ints
17//
18	.syntax unified
19	.p2align 2
20DEFINE_COMPILERRT_FUNCTION(__unordsf2vfp)
21#if defined(COMPILER_RT_ARMHF_TARGET)
22	vcmp.f32 s0, s1
23#else
24	vmov	s14, r0     // move from GPR 0 to float register
25	vmov	s15, r1	    // move from GPR 1 to float register
26	vcmp.f32 s14, s15
27#endif
28	vmrs	apsr_nzcv, fpscr
29	ITE(vs)
30	movvs	r0, #1      // set result register to 1 if "overflow" (any NaNs)
31	movvc	r0, #0
32	bx	lr
33END_COMPILERRT_FUNCTION(__unordsf2vfp)
34
35NO_EXEC_STACK_DIRECTIVE
36
37