blob: 89d3f07dfcc66c3929118e9d73eaf48ef5efbb03 [file] [log] [blame]
Howard Hinnant9ad441f2010-11-16 22:13:33 +00001// This file is dual licensed under the MIT and the University of Illinois Open
2// Source Licenses. See LICENSE.TXT for details.
Daniel Dunbarb3a69012009-06-26 16:47:03 +00003
Daniel Dunbar19336a22009-10-27 17:49:50 +00004#include "../assembly.h"
5
Daniel Dunbarb3a69012009-06-26 16:47:03 +00006// float __floatundisf(du_int a);
7
8#ifdef __x86_64__
9
Edward O'Callaghaneed13002009-11-04 23:52:51 +000010#ifndef __ELF__
Daniel Dunbarb3a69012009-06-26 16:47:03 +000011.literal4
Edward O'Callaghaneed13002009-11-04 23:52:51 +000012#endif
Daniel Dunbarb3a69012009-06-26 16:47:03 +000013two: .single 2.0
14
15#define REL_ADDR(_a) (_a)(%rip)
16
17.text
18.align 4
Daniel Dunbarb4b1e8c2009-10-27 17:50:21 +000019DEFINE_COMPILERRT_FUNCTION(__floatundisf)
Daniel Dunbarb3a69012009-06-26 16:47:03 +000020 movq $1, %rsi
21 testq %rdi, %rdi
22 js 1f
23 cvtsi2ssq %rdi, %xmm0
24 ret
25
261: andq %rdi, %rsi
27 shrq %rdi
28 orq %rsi, %rdi
29 cvtsi2ssq %rdi, %xmm0
30 mulss REL_ADDR(two), %xmm0
31 ret
32
Edward O'Callaghaneed13002009-11-04 23:52:51 +000033#endif // __x86_64__