floatunssisfvfp.S revision 9ad441ffec97db647fee3725b3424284fb913e14
10963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//===-- floatunssisfvfp.S - Implement floatunssisfvfp ---------------------===//
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 __floatunssisfvfp(unsigned 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//
19d016b38b065fbe3e22584728c3b8bc55fc8a5f9cNick Kledzik	.align 2
20b4b1e8c5085cf83a50242057775a33ae4323d402Daniel DunbarDEFINE_COMPILERRT_FUNCTION(__floatunssisfvfp)
210963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik	fmsr	s15, r0	     // move int to float register s15
220963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik	fuitos 	s15, s15     // convert 32-bit int in s15 to float in s15
230963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik	fmrs	r0, s15      // move s15 to result register
240963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik	bx	lr
25