| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mmcu=avrtiny -gdwarf -Os" } */ |
| 3 |
|
| 4 |
/* This is a stripped down piece of libgcc2.c that triggerd an ICE for avr with |
| 5 |
"-mmcu=avrtiny -g -Os"; replace_reg_with_saved_mem would generate: |
| 6 |
(concatn:SI [ |
| 7 |
(reg:SI 18 r18) |
| 8 |
(reg:SI 19 r19) |
| 9 |
(mem/c:QI (plus:HI (reg/f:HI 28 r28) |
| 10 |
(const_int 43 [0x2b])) [6 S1 A8]) |
| 11 |
(mem/c:QI (plus:HI (reg/f:HI 28 r28) |
| 12 |
(const_int 44 [0x2c])) [6 S1 A8]) |
| 13 |
]) */ |
| 14 |
|
| 15 |
typedef int SItype __attribute__ ((mode (SI))); |
| 16 |
typedef unsigned int USItype __attribute__ ((mode (SI))); |
| 17 |
typedef int DItype __attribute__ ((mode (DI))); |
| 18 |
typedef unsigned int UDItype __attribute__ ((mode (DI))); |
| 19 |
struct DWstruct |
| 20 |
{ |
| 21 |
SItype low, high; |
| 22 |
}; |
| 23 |
typedef union |
| 24 |
{ |
| 25 |
struct DWstruct s; |
| 26 |
DItype ll; |
| 27 |
} DWunion; |
| 28 |
|
| 29 |
UDItype |
| 30 |
__udivmoddi4 (UDItype n, UDItype d) |
| 31 |
{ |
| 32 |
const DWunion nn = {.ll = n }; |
| 33 |
const DWunion dd = {.ll = d }; |
| 34 |
USItype d0, d1, n2; |
| 35 |
USItype q0; |
| 36 |
|
| 37 |
d0 = dd.s.low; |
| 38 |
d1 = dd.s.high; |
| 39 |
n2 = nn.s.high; |
| 40 |
|
| 41 |
USItype m0; |
| 42 |
|
| 43 |
do |
| 44 |
{ |
| 45 |
USItype __d1, __d0, __q1, __q0; |
| 46 |
USItype __r1, __m; |
| 47 |
__d1 = ((USItype) (d1) >> 16); |
| 48 |
__d0 = ((USItype) (d1) & (((USItype) 1 << 16) - 1)); |
| 49 |
__r1 = (n2) % __d1; |
| 50 |
__q1 = (n2) / __d1; |
| 51 |
__m = (USItype) __q1 *__d0; |
| 52 |
__r1 -= __m; |
| 53 |
__q0 = __r1 / __d1; |
| 54 |
(q0) = (USItype) __q1 *((USItype) 1 << 16) | __q0; |
| 55 |
} |
| 56 |
while (0); |
| 57 |
do |
| 58 |
{ |
| 59 |
USItype __x0, __x1, __x2; |
| 60 |
USItype __ul, __vl, __uh, __vh; |
| 61 |
__ul = ((USItype) (q0) & (((USItype) 1 << 16) - 1)); |
| 62 |
__uh = ((USItype) (q0) >> 16); |
| 63 |
__vl = ((USItype) (d0) & (((USItype) 1 << 16) - 1)); |
| 64 |
__vh = ((USItype) (d0) >> 16); |
| 65 |
__x0 = (USItype) __ul *__vl; |
| 66 |
__x1 = (USItype) __ul *__vh; |
| 67 |
__x2 = (USItype) __uh *__vl; |
| 68 |
__x1 += ((USItype) (__x0) >> 16); |
| 69 |
__x1 += __x2; |
| 70 |
(m0) = |
| 71 |
((USItype) (__x1) & (((USItype) 1 << 16) - 1)) * |
| 72 |
((USItype) 1 << 16) + |
| 73 |
((USItype) (__x0) & (((USItype) 1 << 16) - 1)); |
| 74 |
} |
| 75 |
while (0); |
| 76 |
|
| 77 |
return m0; |
| 78 |
} |