10963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//===-- fixsfsivfp.S - Implement fixsfsivfp -----------------------===//
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 int __fixsfsivfp(float 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 parameter is
170963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// passed in a GPR..
180963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//
19c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	.syntax unified
202d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines	.p2align 2
21b4b1e8c5085cf83a50242057775a33ae4323d402Daniel DunbarDEFINE_COMPILERRT_FUNCTION(__fixsfsivfp)
22c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	vmov	s15, r0        // load float register from R0
23c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	vcvt.s32.f32 s15, s15  // convert single to 32-bit int into s15
24c20f862690410045fc8c77879f7e78918d2372e4Bob Wilson	vmov	r0, s15	       // move s15 to result register
250963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik	bx	lr
262d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen HinesEND_COMPILERRT_FUNCTION(__fixsfsivfp)
27