floatsisfvfp.S revision b4b1e8c5085cf83a50242057775a33ae4323d402
10963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik//===-- floatsisfvfp.S - Implement floatsisfvfp ---------------------------===// 20963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// 30963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// The LLVM Compiler Infrastructure 40963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// 50963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// This file is distributed under the University of Illinois Open Source 60963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik// License. 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// 19b4b1e8c5085cf83a50242057775a33ae4323d402Daniel DunbarDEFINE_COMPILERRT_FUNCTION(__floatsisfvfp) 200963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik fmsr s15, r0 // move int to float register s15 210963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik fsitos s15, s15 // convert 32-bit int in s15 to float in s15 220963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik fmrs r0, s15 // move s15 to result register 230963c9e8ea7f97732b0fce419fa6f2e96d951969Nick Kledzik bx lr 24