diff options
Diffstat (limited to 'apps/plugins/fractals/cpu_coldfire.c')
-rw-r--r-- | apps/plugins/fractals/cpu_coldfire.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/apps/plugins/fractals/cpu_coldfire.c b/apps/plugins/fractals/cpu_coldfire.c new file mode 100644 index 0000000000..a005a3141e --- /dev/null +++ b/apps/plugins/fractals/cpu_coldfire.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 Tomer Shalev | ||
11 | * | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include "cpu_coldfire.h" | ||
23 | |||
24 | inline short muls16_asr10(short a, short b) | ||
25 | { | ||
26 | asm ( | ||
27 | "muls.w %[a],%[b] \n" | ||
28 | "asr.l #8,%[b] \n" | ||
29 | "asr.l #2,%[b] \n" | ||
30 | : /* outputs */ | ||
31 | [b]"+d"(b) | ||
32 | : /* inputs */ | ||
33 | [a]"d" (a) | ||
34 | ); | ||
35 | return b; | ||
36 | } | ||
37 | |||
38 | inline long muls32_asr26(long a, long b) | ||
39 | { | ||
40 | long r, t1; | ||
41 | asm ( | ||
42 | "mac.l %[a], %[b], %%acc0 \n" /* multiply */ | ||
43 | "move.l %%accext01, %[t1] \n" /* get low part */ | ||
44 | "movclr.l %%acc0, %[r] \n" /* get high part */ | ||
45 | "asl.l #5, %[r] \n" /* hi <<= 5, plus one free */ | ||
46 | "lsr.l #3, %[t1] \n" /* lo >>= 3 */ | ||
47 | "and.l #0x1f, %[t1] \n" /* mask out unrelated bits */ | ||
48 | "or.l %[t1], %[r] \n" /* combine result */ | ||
49 | : /* outputs */ | ||
50 | [r] "=d"(r), | ||
51 | [t1]"=d"(t1) | ||
52 | : /* inputs */ | ||
53 | [a] "d" (a), | ||
54 | [b] "d" (b) | ||
55 | ); | ||
56 | return r; | ||
57 | } | ||
58 | |||