xref: /netbsd-src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/truncdfsf2vfp.S (revision 61f2f2562dcc3e4eb50e7ec5dab0dfa1f093861a)
1156cd587Sjoerg//===-- truncdfsf2vfp.S - Implement truncdfsf2vfp -------------------------===//
2156cd587Sjoerg//
3156cd587Sjoerg//                     The LLVM Compiler Infrastructure
4156cd587Sjoerg//
5156cd587Sjoerg// This file is dual licensed under the MIT and the University of Illinois Open
6156cd587Sjoerg// Source Licenses. See LICENSE.TXT for details.
7156cd587Sjoerg//
8156cd587Sjoerg//===----------------------------------------------------------------------===//
9156cd587Sjoerg
10156cd587Sjoerg#include "../assembly.h"
11156cd587Sjoerg
12156cd587Sjoerg//
13156cd587Sjoerg// extern float __truncdfsf2vfp(double a);
14156cd587Sjoerg//
15156cd587Sjoerg// Converts double precision float to signle precision result.
16156cd587Sjoerg// Uses Darwin calling convention where a double precision parameter is
17156cd587Sjoerg// passed in a R0/R1 pair and a signle precision result is returned in R0.
18156cd587Sjoerg//
19156cd587Sjoerg	.syntax unified
20*61f2f256Sjoerg	.p2align 2
21156cd587SjoergDEFINE_COMPILERRT_FUNCTION(__truncdfsf2vfp)
22156cd587Sjoerg	vmov 	d7, r0, r1   // load double from r0/r1 pair
23156cd587Sjoerg	vcvt.f32.f64 s15, d7 // convert double to single (trucate precision)
24156cd587Sjoerg	vmov 	r0, s15      // return result in r0
25156cd587Sjoerg	bx	lr
26156cd587SjoergEND_COMPILERRT_FUNCTION(__truncdfsf2vfp)
27