This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: ARM VFP test


Richard Earnshaw wrote:

+   /* negsf2_vfp */
+   /* { dg-final { scan-assembler "fnegs" } } */
+   f1 = -f1;


This generates a failure on all the machines I've tried, because the
compiler does this with integer registers and logical operations (it's
cheaper that way).

I think changing the test to something more complex but requiring a
fnegs would fix it (something like -(f1 + f2)), but I haven't tried it
yet.

That didn't work, actually -- the compiler seems rather determined to use integer registers. I gave up, and went with the attached patch.


Thanks,

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
2005-05-10  Mark Mitchell  <mark@codesourcery.com>

	* gcc.dg/arm-vfp1.c: Remove test for fnegs.

Index: gcc.dg/arm-vfp1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/arm-vfp1.c,v
retrieving revision 1.3
diff -c -5 -p -r1.3 arm-vfp1.c
*** gcc.dg/arm-vfp1.c	5 May 2005 15:12:01 -0000	1.3
--- gcc.dg/arm-vfp1.c	10 May 2005 16:53:22 -0000
*************** volatile float f1, f2, f3;
*** 12,22 ****
  void test_sf() {
    /* abssf2_vfp */
    /* { dg-final { scan-assembler "fabss" } } */
    f1 = fabsf (f1);
    /* negsf2_vfp */
!   /* { dg-final { scan-assembler "fnegs" } } */
    f1 = -f1;
    /* addsf3_vfp */
    /* { dg-final { scan-assembler "fadds" } } */
    f1 = f2 + f3;
    /* subsf3_vfp */
--- 12,29 ----
  void test_sf() {
    /* abssf2_vfp */
    /* { dg-final { scan-assembler "fabss" } } */
    f1 = fabsf (f1);
    /* negsf2_vfp */
!   /* There is no test for "fnegs" because the compiler will use an
!      integer operation instead to implement this operation.  Adding
!      complexity to the operand (e.g., "-(f1 + f2)") doesn't change the
!      situation, as the compiler still wants the result in an integer
!      register before writing it back to memory.  If we used an ABI that
!      required passing floating-point values in VFP registers that
!      would likely persuade the compiler to keep the value in the VFP
!      registers.  */ 
    f1 = -f1;
    /* addsf3_vfp */
    /* { dg-final { scan-assembler "fadds" } } */
    f1 = f2 + f3;
    /* subsf3_vfp */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]