diff options
author | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-13 17:44:56 +0000 |
---|---|---|
committer | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-13 17:44:56 +0000 |
commit | 2b2f5cfbdd0e559f9062c294bceb7f486b9cb9da (patch) | |
tree | 77b0e8646b86bb0b70f9dec160ea2b7da24fb530 /gcc/longlong.h | |
parent | 679f19b4de2f05a8dcc4d6218648b864bb3eb175 (diff) | |
download | gcc-2b2f5cfbdd0e559f9062c294bceb7f486b9cb9da.tar.gz |
PR target/28014:
gcc:
* config/sh/t-sh (LIB1ASMFUNCS): Add _udiv_qrnnd16
* config/sh/sh.c (print_operand): Add !SHMEDIA functionality to 'M'.
* config/sh/lib1funcs.h (SL, SL1): Define.
* config/sh/lib1funcs.asm (__udiv_qrnnd16): New hidden function.
* longlong.h (__sh__): Define umul_ppmm, udiv_qrnnd and sub_ddmmss.
* config/sh/t-sh ($(T)unwind-dw2-Os-4-200.o): New rule.
(OBJS_Os_4_200): New variable.
($(T)libgcc-Os-4-200.a): Use it.
* sh.md (udivsi3): For TARGET_DIVIDE_CALL_TABLE, avoid function call
when dividing 1 and/or by 0.
gcc/testsuite:
* g++.dg/eh/div.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114616 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/longlong.h')
-rw-r--r-- | gcc/longlong.h | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/gcc/longlong.h b/gcc/longlong.h index cdcabed6a40..c4131c67b21 100644 --- a/gcc/longlong.h +++ b/gcc/longlong.h @@ -831,18 +831,51 @@ UDItype __umulsidi3 (USItype, USItype); } while (0) #endif -#if defined (__sh2__) && W_TYPE_SIZE == 32 +#if defined(__sh__) && !__SHMEDIA__ && W_TYPE_SIZE == 32 +#ifndef __sh1__ #define umul_ppmm(w1, w0, u, v) \ __asm__ ( \ - "dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0" \ - : "=r" ((USItype)(w1)), \ - "=r" ((USItype)(w0)) \ + "dmulu.l %2,%3\n\tsts%M1 macl,%1\n\tsts%M0 mach,%0" \ + : "=r<" ((USItype)(w1)), \ + "=r<" ((USItype)(w0)) \ : "r" ((USItype)(u)), \ "r" ((USItype)(v)) \ : "macl", "mach") #define UMUL_TIME 5 #endif +/* This is the same algorithm as __udiv_qrnnd_c. */ +#define UDIV_NEEDS_NORMALIZATION 1 + +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \ + __attribute__ ((visibility ("hidden"))); \ + /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \ + __asm__ ( \ + "mov%M4 %4,r5\n" \ +" swap.w %3,r4\n" \ +" swap.w r5,r6\n" \ +" jsr @%5\n" \ +" shll16 r6\n" \ +" swap.w r4,r4\n" \ +" jsr @%5\n" \ +" swap.w r1,%0\n" \ +" or r1,%0" \ + : "=r" (q), "=&z" (r) \ + : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \ + : "r1", "r2", "r4", "r5", "r6", "pr"); \ + } while (0) + +#define UDIV_TIME 80 + +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("clrt;subc %5,%1; subc %4,%0" \ + : "=r" (sh), "=r" (sl) \ + : "0" (ah), "1" (al), "r" (bh), "r" (bl)) + +#endif /* __sh__ */ + #if defined (__SH5__) && __SHMEDIA__ && W_TYPE_SIZE == 32 #define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) #define count_leading_zeros(count, x) \ |