xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/x86_64/floatundisf.S (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2// See https://llvm.org/LICENSE.txt for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#include "../assembly.h"
6
7// float __floatundisf(du_int a);
8
9#ifdef __x86_64__
10
11CONST_SECTION
12
13	.balign 16
14two:
15	.single 2.0
16
17#define REL_ADDR(_a)	(_a)(%rip)
18
19.text
20.balign 4
21DEFINE_COMPILERRT_FUNCTION(__floatundisf)
22	movq		$1,			%rsi
23	testq		%rdi,		%rdi
24	js			1f
25	cvtsi2ssq	%rdi,		%xmm0
26	ret
27
281:	andq		%rdi,		%rsi
29	shrq		%rdi
30	orq			%rsi,		%rdi
31	cvtsi2ssq	%rdi,		%xmm0
32	mulss	REL_ADDR(two),	%xmm0
33	ret
34END_COMPILERRT_FUNCTION(__floatundisf)
35
36#endif // __x86_64__
37
38NO_EXEC_STACK_DIRECTIVE
39
40