On Tue, 2013-03-05 at 00:15 +0100, Oleg Endo wrote:
> Hi,
> 
> On Mon, 2013-03-04 at 15:55 +0900, Yoshinori Sato wrote:
> > It function called to divide operator.
> > But libgcc.a is not include it helper functions.
> > 
> > This patch is included those functions.
> > 
> > diff -ru gcc-4.7.2.org/gcc/config.gcc gcc-4.7.2/gcc/config.gcc
> > --- gcc-4.7.2.org/gcc/config.gcc    2012-09-12 18:03:54.000000000 +0900
> > +++ gcc-4.7.2/gcc/config.gcc        2013-03-03 03:12:41.000000000 +0900
> > @@ -2338,7 +2338,7 @@
> >             sh[1234]*)      sh_multilibs=${sh_cpu_target} ;;
> >             sh64* | sh5*)   
> > sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu
> >  ;;
> >             sh-superh-*)    
> > sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
> > -           sh*-*-linux*)   sh_multilibs=m1,m3e,m4 ;;
> > +           sh*-*-linux*)   sh_multilibs=m1,m2,m3e,m4 ;;
> >             sh*-*-netbsd*)  sh_multilibs=m3,m3e,m4 ;;
> >             *) 
> > sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
> >             esac
> 
> I think in this case, we might at well add SH2A to the multilib list.
> 
> > diff -ru gcc-4.7.2.org/libgcc/config/sh/lib1funcs.S 
> > gcc-4.7.2/libgcc/config/sh/lib1funcs.S
> > --- gcc-4.7.2.org/libgcc/config/sh/lib1funcs.S      2011-11-03 
> > 00:03:19.000000000 +0900
> > +++ gcc-4.7.2/libgcc/config/sh/lib1funcs.S  2013-03-03 03:29:32.000000000 
> > +0900
> > @@ -3255,8 +3255,8 @@
> >     .word   17136
> >     .word   16639
> >  
> > -#elif defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || 
> > defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined 
> > (__SH4_NOFPU__)
> > -/* This code used shld, thus is not suitable for SH1 / SH2.  */
> > +#elif defined (__sh2__) || defined (__SH3__) || defined (__SH3E__) || 
> > defined (__SH4__) || defined (__SH4_SINGLE__) || defined 
> > (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__)
> > +/* This code used shld, thus is not suitable for SH1.  */
> >  
> >  /* Signed / unsigned division without use of FPU, optimized for SH4.
> >     Uses a lookup table for divisors in the range -128 .. +128, and
> 
> The code that you have enabled in lib1funcs.S will utilize dynamic shift
> instructions, which are not available on SH1 or SH2.  Maybe your target
> HW is SH2A which has dynamic shift instructions and you haven't noticed
> a problem?
> Adding __SH2A__ instead of __SH2__ should be fine though.
> 
> If I'm not mistaken, the __sdivsi3_i4i and __udivsi3_i4i division
> functions will be used by the compiler if the -mdiv=call-table option is
> used.  The compiler should reject 'call-table' for SH targets that don't
> have dynamic shifts ... in sh.c there is a check...
> 
>       else if (! strcmp (sh_div_str, "call-table") && TARGET_SH2)
>       sh_div_strategy = SH_DIV_CALL_TABLE;
> 
> ... which is not quite complete.
> I will prepare a patch for this.
> 

...and before that, open a new PR 56529.

Cheers,
Oleg

Reply via email to