[M3devel] div/mod gcc builtin vs. m3core function

Jay K jay.krell at cornell.edu
Sun Jun 20 04:07:21 CEST 2010


So..I'm debugging why 64bit mod on ARM doesn't work..changed the C compiler to use floor instead of trunc, see if it fails..see what it does.
  If it fails, I could report that as a bug.


Now, I'm nervous.
I'm nervous that gcc might sometimes use libgcc functions for div or mod, with the assumption that trunc is needed.
This would clearly be a bug in gcc.
But I'm nervous.

The implementation of div/mod varies a lot -- sometimes a function call in gcc, sometimes not.

I tested some architectures at the time..but I wonder now.

Maybe safest to just always use our functions?

I might try to prove gcc does it wrong, e.g. for ARM, with a modified C front end..but so far I can't run ARM code.

Thoughts?


jbook2:gcc jay$ grep sdiv_optab  */*/*/* 
gcc/config/alpha/alpha.c:      set_optab_libfunc (sdiv_optab, SImode, 0);
gcc/config/alpha/alpha.c:      set_optab_libfunc (sdiv_optab, DImode, "$sldiv");
gcc/config/alpha/alpha.c:      set_optab_libfunc (sdiv_optab, SImode, "OTS$DIV_I");
gcc/config/alpha/alpha.c:      set_optab_libfunc (sdiv_optab, DImode, "OTS$DIV_L");
gcc/config/alpha/alpha.md:  div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
gcc/config/arm/arm.c:  set_optab_libfunc (sdiv_optab, DFmode, "__aeabi_ddiv");
gcc/config/arm/arm.c:  set_optab_libfunc (sdiv_optab, SFmode, "__aeabi_fdiv");
gcc/config/arm/arm.c:  set_optab_libfunc (sdiv_optab, DImode, "__aeabi_ldivmod");
gcc/config/arm/arm.c:  set_optab_libfunc (sdiv_optab, SImode, "__aeabi_idiv");
gcc/config/cris/cris.c:  set_optab_libfunc (sdiv_optab, SImode, "__Div");
gcc/config/frv/frv.c:  set_optab_libfunc (sdiv_optab,     DImode, "__divll");
gcc/config/frv/frv.c:  set_optab_libfunc (sdiv_optab,     SFmode, "__divf");
gcc/config/frv/frv.c:  set_optab_libfunc (sdiv_optab,     DFmode, "__divd");
gcc/config/h8300/h8300.c:  set_optab_libfunc (sdiv_optab, HImode, "__divhi3");
gcc/config/ia64/ia64.c:  set_optab_libfunc (sdiv_optab, SImode, "__divsi3");
gcc/config/ia64/ia64.c:  set_optab_libfunc (sdiv_optab, TFmode, "_U_Qfdiv");
gcc/config/ia64/ia64.c:  set_optab_libfunc (sdiv_optab, SImode, 0);
gcc/config/ia64/ia64.c:  set_optab_libfunc (sdiv_optab, DImode, "__milli_divI");
gcc/config/ia64/ia64.c:  set_optab_libfunc (sdiv_optab, SImode, "OTS$DIV_I");
gcc/config/ia64/ia64.c:  set_optab_libfunc (sdiv_optab, DImode, "OTS$DIV_L");
gcc/config/mips/mips.c:      set_optab_libfunc (sdiv_optab, SImode, "__vr4120_divsi3");
gcc/config/mips/mips.c:      set_optab_libfunc (sdiv_optab, SFmode, "__mips16_divsf3");
gcc/config/mips/mips.c:      set_optab_libfunc (sdiv_optab, DFmode, "__mips16_divdf3");
gcc/config/pa/pa.c:  set_optab_libfunc (sdiv_optab, TFmode, "_U_Qfdiv");
gcc/config/rs6000/rs6000.c:    set_optab_libfunc (sdiv_optab, TFmode, "__gcc_qdiv");
gcc/config/rs6000/rs6000.c:    set_optab_libfunc (sdiv_optab, TFmode, "_xlqdiv");
gcc/config/rs6000/rs6000.c:      set_optab_libfunc (sdiv_optab, TFmode, "_q_div");
gcc/config/sparc/sparc.c:      set_optab_libfunc (sdiv_optab, SImode, "*.div");
gcc/config/sparc/sparc.c:      set_optab_libfunc (sdiv_optab, TFmode, "_Q_div");
gcc/config/sparc/sparc.c:      set_optab_libfunc (sdiv_optab, SImode, 0);
gcc/config/sparc/sparc.c:      set_optab_libfunc (sdiv_optab, DImode, "__div64");
gcc/config/spu/spu.c:  set_optab_libfunc (sdiv_optab, DImode, "__divdi3");
j



 - Jay




 		 	   		  


More information about the M3devel mailing list