Revision 3b89f26c target-sparc/op_helper.c
b/target-sparc/op_helper.c | ||
---|---|---|
1582 | 1582 |
} |
1583 | 1583 |
#endif |
1584 | 1584 |
|
1585 |
target_ulong helper_udiv(target_ulong a, target_ulong b) |
|
1586 |
{ |
|
1587 |
uint64_t x0; |
|
1588 |
uint32_t x1; |
|
1589 |
|
|
1590 |
x0 = a | ((uint64_t) (env->y) << 32); |
|
1591 |
x1 = b; |
|
1592 |
|
|
1593 |
if (x1 == 0) { |
|
1594 |
raise_exception(TT_DIV_ZERO); |
|
1595 |
} |
|
1596 |
|
|
1597 |
x0 = x0 / x1; |
|
1598 |
if (x0 > 0xffffffff) { |
|
1599 |
env->cc_src2 = 1; |
|
1600 |
return 0xffffffff; |
|
1601 |
} else { |
|
1602 |
env->cc_src2 = 0; |
|
1603 |
return x0; |
|
1604 |
} |
|
1605 |
} |
|
1606 |
|
|
1607 |
target_ulong helper_sdiv(target_ulong a, target_ulong b) |
|
1608 |
{ |
|
1609 |
int64_t x0; |
|
1610 |
int32_t x1; |
|
1611 |
|
|
1612 |
x0 = a | ((int64_t) (env->y) << 32); |
|
1613 |
x1 = b; |
|
1614 |
|
|
1615 |
if (x1 == 0) { |
|
1616 |
raise_exception(TT_DIV_ZERO); |
|
1617 |
} |
|
1618 |
|
|
1619 |
x0 = x0 / x1; |
|
1620 |
if ((int32_t) x0 != x0) { |
|
1621 |
env->cc_src2 = 1; |
|
1622 |
return x0 < 0? 0x80000000: 0x7fffffff; |
|
1623 |
} else { |
|
1624 |
env->cc_src2 = 0; |
|
1625 |
return x0; |
|
1626 |
} |
|
1627 |
} |
|
1628 |
|
|
1585 | 1629 |
uint64_t helper_pack64(target_ulong high, target_ulong low) |
1586 | 1630 |
{ |
1587 | 1631 |
return ((uint64_t)high << 32) | (uint64_t)(low & 0xffffffff); |
Also available in: Unified diff