OSDN Git Service

2009-08-28 Sebastian Pop <sebastian.pop@amd.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / spu / float_unssidf.c
1 /* Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
2   
3    This file is free software; you can redistribute it and/or modify it under
4    the terms of the GNU General Public License as published by the Free
5    Software Foundation; either version 3 of the License, or (at your option)
6    any later version.
7   
8    This file is distributed in the hope that it will be useful, but WITHOUT
9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11    for more details.
12   
13    Under Section 7 of GPL version 3, you are granted additional
14    permissions described in the GCC Runtime Library Exception, version
15    3.1, as published by the Free Software Foundation.
16
17    You should have received a copy of the GNU General Public License and
18    a copy of the GCC Runtime Library Exception along with this program;
19    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
20    <http://www.gnu.org/licenses/>.  */
21
22 #include <spu_intrinsics.h>
23 const unsigned char __sidf_pat[16] __attribute__ ((__aligned__ (16))) = {
24   0x02, 0x03, 0x10, 0x11,
25   0x12, 0x13, 0x80, 0x80,
26   0x06, 0x07, 0x14, 0x15,
27   0x16, 0x17, 0x80, 0x80
28 };
29
30 /* double __float_unssidf (unsigned int SI) */
31 qword __float_unssidf (qword SI);
32 qword
33 __float_unssidf (qword SI)
34 {
35   qword t0, t1, t2, t3, t4, t5, t6, t7;
36   t0 = si_clz (SI);
37   t1 = si_il (1054);
38   t2 = si_shl (SI, t0);
39   t3 = si_ceqi (t0, 32);
40   t4 = si_sf (t0, t1);
41   t5 = si_a (t2, t2);
42   t6 = si_andc (t4, t3);
43   t7 = si_shufb (t6, t5, *(const qword *) __sidf_pat);
44   return si_shlqbii (t7, 4);
45 }