fixsfsivfp.S revision 314564
1276789Sdim//===-- fixsfsivfp.S - Implement fixsfsivfp -----------------------===// 2276789Sdim// 3276789Sdim// The LLVM Compiler Infrastructure 4276789Sdim// 5276789Sdim// This file is dual licensed under the MIT and the University of Illinois Open 6276789Sdim// Source Licenses. See LICENSE.TXT for details. 7276789Sdim// 8276789Sdim//===----------------------------------------------------------------------===// 9276789Sdim 10276789Sdim#include "../assembly.h" 11276789Sdim 12276789Sdim// 13276789Sdim// extern int __fixsfsivfp(float a); 14276789Sdim// 15276789Sdim// Converts single precision float to a 32-bit int rounding towards zero. 16276789Sdim// Uses Darwin calling convention where a single precision parameter is 17276789Sdim// passed in a GPR.. 18276789Sdim// 19276789Sdim .syntax unified 20276789Sdim .p2align 2 21276789SdimDEFINE_COMPILERRT_FUNCTION(__fixsfsivfp) 22314564Sdim#if defined(COMPILER_RT_ARMHF_TARGET) 23314564Sdim vcvt.s32.f32 s0, s0 24314564Sdim vmov r0, s0 25314564Sdim#else 26276789Sdim vmov s15, r0 // load float register from R0 27276789Sdim vcvt.s32.f32 s15, s15 // convert single to 32-bit int into s15 28276789Sdim vmov r0, s15 // move s15 to result register 29314564Sdim#endif 30276789Sdim bx lr 31276789SdimEND_COMPILERRT_FUNCTION(__fixsfsivfp) 32309124Sdim 33309124SdimNO_EXEC_STACK_DIRECTIVE 34309124Sdim 35