Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 | * Copyright 2004-2009 Analog Devices Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 3 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 4 | * Licensed under the GPL-2 or later. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include "gcclib.h" |
| 8 | |
| 9 | #ifdef CONFIG_ARITHMETIC_OPS_L1 |
| 10 | DItype __ashldi3(DItype u, word_type b)__attribute__((l1_text)); |
| 11 | #endif |
| 12 | |
| 13 | DItype __ashldi3(DItype u, word_type b) |
| 14 | { |
| 15 | DIunion w; |
| 16 | word_type bm; |
| 17 | DIunion uu; |
| 18 | |
| 19 | if (b == 0) |
| 20 | return u; |
| 21 | |
| 22 | uu.ll = u; |
| 23 | |
| 24 | bm = (sizeof(SItype) * BITS_PER_UNIT) - b; |
| 25 | if (bm <= 0) { |
| 26 | w.s.low = 0; |
| 27 | w.s.high = (USItype) uu.s.low << -bm; |
| 28 | } else { |
| 29 | USItype carries = (USItype) uu.s.low >> bm; |
| 30 | w.s.low = (USItype) uu.s.low << b; |
| 31 | w.s.high = ((USItype) uu.s.high << b) | carries; |
| 32 | } |
| 33 | |
| 34 | return w.ll; |
| 35 | } |