On Tue, 15 Apr 2008 09:15:45 -0400, "Daniel Jacobowitz" <[EMAIL PROTECTED]>
said:
> 
> I'm going to keep asking until I get something we can work
> with... you're reporting a bug in the compiler, so we need a test case
> and the exact error message.  What is generating any kind of sqrt
> libcall?  There is nothing in GCC to call __aeabi_sqrt, which AFAIK
> does not exist.

gcc shouldn't call __aeabi_sqrt, since it doesn't exist.  It could
however try to do a libcall through the optab to sqrtsf2, since
sqrt_optab does exist in optabs.h/c and genopinit.c ...  

Ok, to try and test this out, I added this patch to gcc, and recompiled
gcc & glibc --with-fp for crunch:

--- gcc-4.2.2/gcc/config/arm/arm.md     2008-04-15 17:59:35.000000000
+1000
+++ gcc-4.2.2/gcc/config/arm/arm.md     2008-04-15 18:02:08.000000000
+1000
@@ -3100,6 +3100,22 @@
   "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
   "")
 
+(define_expand "sqrtsf2_soft_insn"
+  [(set (match_operand:SF         0 "s_register_operand" "")
+       (sqrt:SF (match_operand:SF 1 "s_register_operand" "")))]
+  "TARGET_ARM && !(TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP))"
+  "{
+  FAIL;
+  }")
+
+(define_expand "sqrtdf2_soft_insn"
+  [(set (match_operand:DF         0 "s_register_operand" "")
+       (sqrt:DF (match_operand:DF 1 "s_register_operand" "")))]
+  "TARGET_ARM && !(TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP))"
+  "{
+  FAIL;
+  }")
+
 (define_insn_and_split "one_cmpldi2"
   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
        (not:DI (match_operand:DI 1 "s_register_operand" "?r,0")))]

I was expecting it to fail since now gcc shouldn't be able to expand
that operation.  I double check glibc config.status, and with_fp=yes.
So, I'm not sure how glibc is doing it's sqrt routines on arm.  In that
case I suspect that glibc doesn't call sqrt for VFP or FPA, then, and
you were right in your first e-mail.

glibc uses its own internal sqrt function, rather than the
sqrtsf2/sqrtdf2 opcode, even on FPA or VFP.

In any case if you want a test, then something like
gcc/testsuite/gcc.dg/arm-vfp1.c is enough (of course with different
dejagnu lines, e.g. dg-final scan-assembler lines) ...

I still think something like the above patch needs to be added to gcc,
just to ensure that the sqrtsf2 / sqrtdf2 libcall never happens, and an
error happens at compile time rather than runtime.  In the future glibc,
uclibc or some standalone function could make use of the "gcc" sqrt,
rather than the glibc sqrt.

Anyway, I misunderstood how the toolchain gets assembled and I would
appreciate it someone could point out where the sqrt function is in
glibc, on arm.
Does arm use glibc/sysdeps/ieee754/dbl-64/mpsqrt.c ???

Reply via email to