Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / gcc / config / spu / float_unssidf.c
bloba7bb24777635a035e666a08c61f9d1a9d8aabf6a
1 /* Copyright (C) 2006, 2008 Free Software Foundation, Inc.
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 2 of the License, or (at your option)
6 any later version.
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.
13 You should have received a copy of the GNU General Public License
14 along with this file; see the file COPYING. If not, write to the Free
15 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
16 02110-1301, USA. */
18 /* As a special exception, if you link this library with files compiled with
19 GCC to produce an executable, this does not cause the resulting executable
20 to be covered by the GNU General Public License. The exception does not
21 however invalidate any other reasons why the executable file might be covered
22 by the GNU General Public License. */
24 #include <spu_intrinsics.h>
25 const unsigned char __sidf_pat[16] __attribute__ ((__aligned__ (16))) = {
26 0x02, 0x03, 0x10, 0x11,
27 0x12, 0x13, 0x80, 0x80,
28 0x06, 0x07, 0x14, 0x15,
29 0x16, 0x17, 0x80, 0x80
32 /* double __float_unssidf (unsigned int SI) */
33 qword __float_unssidf (qword SI);
34 qword
35 __float_unssidf (qword SI)
37 qword t0, t1, t2, t3, t4, t5, t6, t7;
38 t0 = si_clz (SI);
39 t1 = si_il (1054);
40 t2 = si_shl (SI, t0);
41 t3 = si_ceqi (t0, 32);
42 t4 = si_sf (t0, t1);
43 t5 = si_a (t2, t2);
44 t6 = si_andc (t4, t3);
45 t7 = si_shufb (t6, t5, *(const qword *) __sidf_pat);
46 return si_shlqbii (t7, 4);