10963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//===-- floatsisfvfp.S - Implement floatsisfvfp ---------------------------===//
20963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
30963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//                     The LLVM Compiler Infrastructure
40963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
59ad441ffec97db647fee3725b3424284fb913e14Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
69ad441ffec97db647fee3725b3424284fb913e14Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
70963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
80963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//===----------------------------------------------------------------------===//
90963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik
1019336a2d6b9b375ac106125950f4ff09742d1aecDaniel Dunbar#include "../assembly.h"
110963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik
120963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
130963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// extern float __floatsisfvfp(int a);
140963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
150963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// Converts single precision float to a 32-bit int rounding towards zero.
160963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// Uses Darwin calling convention where a single precision result is
170963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// return in a GPR..
180963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
19c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	.syntax unified
20d016b38b065fbe3e22584728c3b8bc55fc8a5f9cNick Kledzik	.align 2
21b4b1e8c5085cf83a50242057775a33ae4323d402Daniel DunbarDEFINE_COMPILERRT_FUNCTION(__floatsisfvfp)
22c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	vmov	s15, r0	       // move int to float register s15
23c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	vcvt.f32.s32 s15, s15  // convert 32-bit int in s15 to float in s15
24c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	vmov	r0, s15        // move s15 to result register
250963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik	bx	lr
26