xref: /openbsd-src/gnu/llvm/compiler-rt/lib/builtins/arm/ltsf2vfp.S (revision 3cab2bb3f667058bece8e38b12449a63a9d73c4b)
1*3cab2bb3Spatrick//===-- ltsf2vfp.S - Implement ltsf2vfp -----------------------------------===//
2*3cab2bb3Spatrick//
3*3cab2bb3Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*3cab2bb3Spatrick// See https://llvm.org/LICENSE.txt for license information.
5*3cab2bb3Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*3cab2bb3Spatrick//
7*3cab2bb3Spatrick//===----------------------------------------------------------------------===//
8*3cab2bb3Spatrick
9*3cab2bb3Spatrick#include "../assembly.h"
10*3cab2bb3Spatrick
11*3cab2bb3Spatrick//
12*3cab2bb3Spatrick// extern int __ltsf2vfp(float a, float b);
13*3cab2bb3Spatrick//
14*3cab2bb3Spatrick// Returns one iff a < b and neither is NaN.
15*3cab2bb3Spatrick// Uses Darwin calling convention where single precision arguments are passsed
16*3cab2bb3Spatrick// like 32-bit ints
17*3cab2bb3Spatrick//
18*3cab2bb3Spatrick	.syntax unified
19*3cab2bb3Spatrick	.p2align 2
20*3cab2bb3SpatrickDEFINE_COMPILERRT_FUNCTION(__ltsf2vfp)
21*3cab2bb3Spatrick#if defined(COMPILER_RT_ARMHF_TARGET)
22*3cab2bb3Spatrick	vcmp.f32 s0, s1
23*3cab2bb3Spatrick#else
24*3cab2bb3Spatrick	vmov	s14, r0     // move from GPR 0 to float register
25*3cab2bb3Spatrick	vmov	s15, r1     // move from GPR 1 to float register
26*3cab2bb3Spatrick	vcmp.f32 s14, s15
27*3cab2bb3Spatrick#endif
28*3cab2bb3Spatrick	vmrs	apsr_nzcv, fpscr
29*3cab2bb3Spatrick	ITE(mi)
30*3cab2bb3Spatrick	movmi	r0, #1      // set result register to 1 if equal
31*3cab2bb3Spatrick	movpl	r0, #0
32*3cab2bb3Spatrick	bx	lr
33*3cab2bb3SpatrickEND_COMPILERRT_FUNCTION(__ltsf2vfp)
34*3cab2bb3Spatrick
35*3cab2bb3SpatrickNO_EXEC_STACK_DIRECTIVE
36*3cab2bb3Spatrick
37