comparison gcc/config/spu/float_unsdidf.c @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
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 __didf_scale[16] __attribute__ ((__aligned__ (16))) = {
24 0x00, 0x00, 0x04, 0x3e,
25 0x00, 0x00, 0x04, 0x1e,
26 0x00, 0x00, 0x00, 0x00,
27 0x00, 0x00, 0x00, 0x00
28 };
29 const unsigned char __didf_pat[16] __attribute__ ((__aligned__ (16))) = {
30 0x02, 0x03, 0x10, 0x11,
31 0x12, 0x13, 0x80, 0x80,
32 0x06, 0x07, 0x14, 0x15,
33 0x16, 0x17, 0x80, 0x80
34 };
35
36 /* double __float_unsdidf (unsigned long long int)
37 Construct two exact doubles representing the high and low parts (in
38 parallel), then add them. */
39 qword __float_unsdidf (qword DI);
40 qword
41 __float_unsdidf (qword DI)
42 {
43 qword t0, t1, t2, t3, t4, t5, t6, t7, t8;
44 t0 = si_clz (DI);
45 t1 = si_shl (DI, t0);
46 t2 = si_ceqi (t0, 32);
47 t3 = si_sf (t0, *(const qword *) __didf_scale);
48 t4 = si_a (t1, t1);
49 t5 = si_andc (t3, t2);
50 t6 = si_shufb (t5, t4, *(const qword *) __didf_pat);
51 t7 = si_shlqbii (t6, 4);
52 t8 = si_shlqbyi (t7, 8);
53 return si_dfa (t7, t8);
54 }