public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
@ 2014-08-28  6:02 Tony Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Wang @ 2014-08-28  6:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Earnshaw, Ramana Radhakrishnan

Ping?

> -----Original Message-----
> From: Tony Wang [mailto:tony.wang@arm.com]
> Sent: Thursday, August 21, 2014 2:15 PM
> To: 'gcc-patches@gcc.gnu.org'
> Subject: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
> 
> Step 3: Test cases to verify the code size reduction.
> 
> gcc/gcc/testsuite/ChangeLog:
> 2014-08-21  Tony Wang  <tony.wang@arm.com>
> 
>         * gcc.target/arm/size-optimization-ieee-1.c: New test case
>         * gcc.target/arm/size-optimization-ieee-2.c: New test case
>         * lib/gcc-dg.exp: Add new function scan-symbol-common, scan-symbol-yes,
>         scan-symbol-no to scan a user defined symbol in final elf file
> 
> BR,
> Tony
> 
> diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c b/gcc/testsuite/gcc.target/arm/size-
> optimization-ieee-1.c
> new file mode 100644
> index 0000000..46e9cdf
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> @@ -0,0 +1,30 @@
> +/* { dg-do link { target { arm_thumb2_ok } } } */
> +/* { dg-options "-Wl,--gc-sections" } */
> +int
> +foo ()
> +{
> +  volatile float a;
> +  volatile float b;
> +  volatile float c = a * b;
> +  return 0;
> +}
> +
> +int
> +bar ()
> +{
> +  volatile double a;
> +  volatile double b;
> +  volatile double c = a * b;
> +  return 0;
> +}
> +
> +int
> +main ()
> +{
> +  foo ();
> +  bar ();
> +  return 0;
> +}
> +/* { dg-final { scan-symbol-no "__aeabi_fdiv" } } */
> +/* { dg-final { scan-symbol-no "__aeabi_ddiv" } } */
> +
> diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c b/gcc/testsuite/gcc.target/arm/size-
> optimization-ieee-2.c
> new file mode 100644
> index 0000000..5007d62
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> @@ -0,0 +1,30 @@
> +/* { dg-do link { target { arm_thumb2_ok } } } */
> +/* { dg-options "-Wl,--gc-sections" } */
> +int
> +foo ()
> +{
> +  volatile float a;
> +  volatile float b;
> +  volatile float c = a / b;
> +  return 0;
> +}
> +
> +int
> +bar ()
> +{
> +  volatile double a;
> +  volatile double b;
> +  volatile double c = a / b;
> +  return 0;
> +}
> +
> +int
> +main ()
> +{
> +  foo ();
> +  bar ();
> +  return 0;
> +}
> +/* { dg-final { scan-symbol-yes "__aeabi_fmul" } } */
> +/* { dg-final { scan-symbol-yes "__aeabi_dmul" } } */
> +
> diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
> index 3390caa..0d52e95 100644
> --- a/gcc/testsuite/lib/gcc-dg.exp
> +++ b/gcc/testsuite/lib/gcc-dg.exp
> @@ -880,5 +880,57 @@ proc gdb-exists { args } {
>      return 0;
>  }
> 
> +# Scan the OUTPUT_FILE for a symbol. Return 1 if it present, or
> +# return 0 if it doesn't present
> +
> +proc scan-symbol-common { args } {
> +    global nm
> +    global base_dir
> +
> +    set testcase [testname-for-summary]
> +    set output_file "[file rootname [file tail $testcase]].exe"
> +
> +    # Find nm like we find g++ in g++.exp.
> +    if ![info exists nm]  {
> +        set nm [findfile $base_dir/../../../binutils/nm \
> +                $base_dir/../../../binutils/nm \
> +                [findfile $base_dir/../../nm $base_dir/../../nm \
> +                      [findfile $base_dir/nm $base_dir/nm \
> +                       [transform nm]]]]
> +        verbose -log "nm is $nm"
> +    }
> +
> +    if { $output_file == "" } {
> +        fail "scan-symbol-not $args: dump file does not exist"
> +        return
> +    }
> +
> +    set fd [open "| $nm $output_file" r]
> +    set text [read $fd]
> +    close $fd
> +
> +    if [regexp -- [lindex $args 0] $text] {
> +        return 1
> +    } else {
> +        return 0
> +    }
> +}
> +
> +proc scan-symbol-yes { args } {
> +    if { [scan-symbol-common $args] == 1 } {
> +	pass "scan-symbol-yes $args exists"
> +    } else {
> +	fail "scan-symbol-yes $args does not exist"
> +    }
> +}
> +
> +proc scan-symbol-no { args } {
> +    if { [scan-symbol-common $args] != 1 } {
> +        pass "scan-symbol-no $args does not exist"
> +    } else {
> +        fail "scan-symbol-no $args exists"
> +    }
> +}
> +
>  set additional_prunes ""
>  set dg_runtest_extra_prunes ""


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
@ 2014-09-26  2:11 Tony Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Wang @ 2014-09-26  2:11 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Earnshaw, Ramana Radhakrishnan

Ping?	

> -----Original Message-----
> From: Tony Wang [mailto:tony.wang@arm.com]
> Sent: Tuesday, September 16, 2014 11:01 AM
> To: 'gcc-patches@gcc.gnu.org'
> Cc: Richard Earnshaw; Ramana Radhakrishnan
> Subject: RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
> 
> Ping?
> 
> > -----Original Message-----
> > From: Tony Wang [mailto:tony.wang@arm.com]
> > Sent: Thursday, September 04, 2014 10:16 AM
> > To: 'gcc-patches@gcc.gnu.org'
> > Cc: Richard Earnshaw; Ramana Radhakrishnan
> > Subject: RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in
libgcc
> >
> > Ping 2?
> >
> > > -----Original Message-----
> > > From: Tony Wang [mailto:tony.wang@arm.com]
> > > Sent: Thursday, August 28, 2014 2:02 PM
> > > To: 'gcc-patches@gcc.gnu.org'
> > > Cc: Richard Earnshaw; Ramana Radhakrishnan
> > > Subject: RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in
libgcc
> > >
> > > Ping?
> > >
> > > > -----Original Message-----
> > > > From: Tony Wang [mailto:tony.wang@arm.com]
> > > > Sent: Thursday, August 21, 2014 2:15 PM
> > > > To: 'gcc-patches@gcc.gnu.org'
> > > > Subject: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in
libgcc
> > > >
> > > > Step 3: Test cases to verify the code size reduction.
> > > >
> > > > gcc/gcc/testsuite/ChangeLog:
> > > > 2014-08-21  Tony Wang  <tony.wang@arm.com>
> > > >
> > > >         * gcc.target/arm/size-optimization-ieee-1.c: New test case
> > > >         * gcc.target/arm/size-optimization-ieee-2.c: New test case
> > > >         * lib/gcc-dg.exp: Add new function scan-symbol-common, scan-symbol-yes,
> > > >         scan-symbol-no to scan a user defined symbol in final elf file
> > > >
> > > > BR,
> > > > Tony
> > > >
> > > > diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
b/gcc/testsuite/gcc.target/arm/size-
> > > > optimization-ieee-1.c
> > > > new file mode 100644
> > > > index 0000000..46e9cdf
> > > > --- /dev/null
> > > > +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> > > > @@ -0,0 +1,30 @@
> > > > +/* { dg-do link { target { arm_thumb2_ok } } } */
> > > > +/* { dg-options "-Wl,--gc-sections" } */
> > > > +int
> > > > +foo ()
> > > > +{
> > > > +  volatile float a;
> > > > +  volatile float b;
> > > > +  volatile float c = a * b;
> > > > +  return 0;
> > > > +}
> > > > +
> > > > +int
> > > > +bar ()
> > > > +{
> > > > +  volatile double a;
> > > > +  volatile double b;
> > > > +  volatile double c = a * b;
> > > > +  return 0;
> > > > +}
> > > > +
> > > > +int
> > > > +main ()
> > > > +{
> > > > +  foo ();
> > > > +  bar ();
> > > > +  return 0;
> > > > +}
> > > > +/* { dg-final { scan-symbol-no "__aeabi_fdiv" } } */
> > > > +/* { dg-final { scan-symbol-no "__aeabi_ddiv" } } */
> > > > +
> > > > diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
b/gcc/testsuite/gcc.target/arm/size-
> > > > optimization-ieee-2.c
> > > > new file mode 100644
> > > > index 0000000..5007d62
> > > > --- /dev/null
> > > > +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> > > > @@ -0,0 +1,30 @@
> > > > +/* { dg-do link { target { arm_thumb2_ok } } } */
> > > > +/* { dg-options "-Wl,--gc-sections" } */
> > > > +int
> > > > +foo ()
> > > > +{
> > > > +  volatile float a;
> > > > +  volatile float b;
> > > > +  volatile float c = a / b;
> > > > +  return 0;
> > > > +}
> > > > +
> > > > +int
> > > > +bar ()
> > > > +{
> > > > +  volatile double a;
> > > > +  volatile double b;
> > > > +  volatile double c = a / b;
> > > > +  return 0;
> > > > +}
> > > > +
> > > > +int
> > > > +main ()
> > > > +{
> > > > +  foo ();
> > > > +  bar ();
> > > > +  return 0;
> > > > +}
> > > > +/* { dg-final { scan-symbol-yes "__aeabi_fmul" } } */
> > > > +/* { dg-final { scan-symbol-yes "__aeabi_dmul" } } */
> > > > +
> > > > diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
> > > > index 3390caa..0d52e95 100644
> > > > --- a/gcc/testsuite/lib/gcc-dg.exp
> > > > +++ b/gcc/testsuite/lib/gcc-dg.exp
> > > > @@ -880,5 +880,57 @@ proc gdb-exists { args } {
> > > >      return 0;
> > > >  }
> > > >
> > > > +# Scan the OUTPUT_FILE for a symbol. Return 1 if it present, or
> > > > +# return 0 if it doesn't present
> > > > +
> > > > +proc scan-symbol-common { args } {
> > > > +    global nm
> > > > +    global base_dir
> > > > +
> > > > +    set testcase [testname-for-summary]
> > > > +    set output_file "[file rootname [file tail $testcase]].exe"
> > > > +
> > > > +    # Find nm like we find g++ in g++.exp.
> > > > +    if ![info exists nm]  {
> > > > +        set nm [findfile $base_dir/../../../binutils/nm \
> > > > +                $base_dir/../../../binutils/nm \
> > > > +                [findfile $base_dir/../../nm $base_dir/../../nm \
> > > > +                      [findfile $base_dir/nm $base_dir/nm \
> > > > +                       [transform nm]]]]
> > > > +        verbose -log "nm is $nm"
> > > > +    }
> > > > +
> > > > +    if { $output_file == "" } {
> > > > +        fail "scan-symbol-not $args: dump file does not exist"
> > > > +        return
> > > > +    }
> > > > +
> > > > +    set fd [open "| $nm $output_file" r]
> > > > +    set text [read $fd]
> > > > +    close $fd
> > > > +
> > > > +    if [regexp -- [lindex $args 0] $text] {
> > > > +        return 1
> > > > +    } else {
> > > > +        return 0
> > > > +    }
> > > > +}
> > > > +
> > > > +proc scan-symbol-yes { args } {
> > > > +    if { [scan-symbol-common $args] == 1 } {
> > > > +	pass "scan-symbol-yes $args exists"
> > > > +    } else {
> > > > +	fail "scan-symbol-yes $args does not exist"
> > > > +    }
> > > > +}
> > > > +
> > > > +proc scan-symbol-no { args } {
> > > > +    if { [scan-symbol-common $args] != 1 } {
> > > > +        pass "scan-symbol-no $args does not exist"
> > > > +    } else {
> > > > +        fail "scan-symbol-no $args exists"
> > > > +    }
> > > > +}
> > > > +
> > > >  set additional_prunes ""
> > > >  set dg_runtest_extra_prunes ""



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
@ 2014-09-16  3:00 Tony Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Wang @ 2014-09-16  3:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Earnshaw, Ramana Radhakrishnan

Ping?

> -----Original Message-----
> From: Tony Wang [mailto:tony.wang@arm.com]
> Sent: Thursday, September 04, 2014 10:16 AM
> To: 'gcc-patches@gcc.gnu.org'
> Cc: Richard Earnshaw; Ramana Radhakrishnan
> Subject: RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
> 
> Ping 2?
> 
> > -----Original Message-----
> > From: Tony Wang [mailto:tony.wang@arm.com]
> > Sent: Thursday, August 28, 2014 2:02 PM
> > To: 'gcc-patches@gcc.gnu.org'
> > Cc: Richard Earnshaw; Ramana Radhakrishnan
> > Subject: RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in
libgcc
> >
> > Ping?
> >
> > > -----Original Message-----
> > > From: Tony Wang [mailto:tony.wang@arm.com]
> > > Sent: Thursday, August 21, 2014 2:15 PM
> > > To: 'gcc-patches@gcc.gnu.org'
> > > Subject: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
> > >
> > > Step 3: Test cases to verify the code size reduction.
> > >
> > > gcc/gcc/testsuite/ChangeLog:
> > > 2014-08-21  Tony Wang  <tony.wang@arm.com>
> > >
> > >         * gcc.target/arm/size-optimization-ieee-1.c: New test case
> > >         * gcc.target/arm/size-optimization-ieee-2.c: New test case
> > >         * lib/gcc-dg.exp: Add new function scan-symbol-common, scan-symbol-yes,
> > >         scan-symbol-no to scan a user defined symbol in final elf file
> > >
> > > BR,
> > > Tony
> > >
> > > diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
b/gcc/testsuite/gcc.target/arm/size-
> > > optimization-ieee-1.c
> > > new file mode 100644
> > > index 0000000..46e9cdf
> > > --- /dev/null
> > > +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> > > @@ -0,0 +1,30 @@
> > > +/* { dg-do link { target { arm_thumb2_ok } } } */
> > > +/* { dg-options "-Wl,--gc-sections" } */
> > > +int
> > > +foo ()
> > > +{
> > > +  volatile float a;
> > > +  volatile float b;
> > > +  volatile float c = a * b;
> > > +  return 0;
> > > +}
> > > +
> > > +int
> > > +bar ()
> > > +{
> > > +  volatile double a;
> > > +  volatile double b;
> > > +  volatile double c = a * b;
> > > +  return 0;
> > > +}
> > > +
> > > +int
> > > +main ()
> > > +{
> > > +  foo ();
> > > +  bar ();
> > > +  return 0;
> > > +}
> > > +/* { dg-final { scan-symbol-no "__aeabi_fdiv" } } */
> > > +/* { dg-final { scan-symbol-no "__aeabi_ddiv" } } */
> > > +
> > > diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
b/gcc/testsuite/gcc.target/arm/size-
> > > optimization-ieee-2.c
> > > new file mode 100644
> > > index 0000000..5007d62
> > > --- /dev/null
> > > +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> > > @@ -0,0 +1,30 @@
> > > +/* { dg-do link { target { arm_thumb2_ok } } } */
> > > +/* { dg-options "-Wl,--gc-sections" } */
> > > +int
> > > +foo ()
> > > +{
> > > +  volatile float a;
> > > +  volatile float b;
> > > +  volatile float c = a / b;
> > > +  return 0;
> > > +}
> > > +
> > > +int
> > > +bar ()
> > > +{
> > > +  volatile double a;
> > > +  volatile double b;
> > > +  volatile double c = a / b;
> > > +  return 0;
> > > +}
> > > +
> > > +int
> > > +main ()
> > > +{
> > > +  foo ();
> > > +  bar ();
> > > +  return 0;
> > > +}
> > > +/* { dg-final { scan-symbol-yes "__aeabi_fmul" } } */
> > > +/* { dg-final { scan-symbol-yes "__aeabi_dmul" } } */
> > > +
> > > diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
> > > index 3390caa..0d52e95 100644
> > > --- a/gcc/testsuite/lib/gcc-dg.exp
> > > +++ b/gcc/testsuite/lib/gcc-dg.exp
> > > @@ -880,5 +880,57 @@ proc gdb-exists { args } {
> > >      return 0;
> > >  }
> > >
> > > +# Scan the OUTPUT_FILE for a symbol. Return 1 if it present, or
> > > +# return 0 if it doesn't present
> > > +
> > > +proc scan-symbol-common { args } {
> > > +    global nm
> > > +    global base_dir
> > > +
> > > +    set testcase [testname-for-summary]
> > > +    set output_file "[file rootname [file tail $testcase]].exe"
> > > +
> > > +    # Find nm like we find g++ in g++.exp.
> > > +    if ![info exists nm]  {
> > > +        set nm [findfile $base_dir/../../../binutils/nm \
> > > +                $base_dir/../../../binutils/nm \
> > > +                [findfile $base_dir/../../nm $base_dir/../../nm \
> > > +                      [findfile $base_dir/nm $base_dir/nm \
> > > +                       [transform nm]]]]
> > > +        verbose -log "nm is $nm"
> > > +    }
> > > +
> > > +    if { $output_file == "" } {
> > > +        fail "scan-symbol-not $args: dump file does not exist"
> > > +        return
> > > +    }
> > > +
> > > +    set fd [open "| $nm $output_file" r]
> > > +    set text [read $fd]
> > > +    close $fd
> > > +
> > > +    if [regexp -- [lindex $args 0] $text] {
> > > +        return 1
> > > +    } else {
> > > +        return 0
> > > +    }
> > > +}
> > > +
> > > +proc scan-symbol-yes { args } {
> > > +    if { [scan-symbol-common $args] == 1 } {
> > > +	pass "scan-symbol-yes $args exists"
> > > +    } else {
> > > +	fail "scan-symbol-yes $args does not exist"
> > > +    }
> > > +}
> > > +
> > > +proc scan-symbol-no { args } {
> > > +    if { [scan-symbol-common $args] != 1 } {
> > > +        pass "scan-symbol-no $args does not exist"
> > > +    } else {
> > > +        fail "scan-symbol-no $args exists"
> > > +    }
> > > +}
> > > +
> > >  set additional_prunes ""
> > >  set dg_runtest_extra_prunes ""



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
@ 2014-09-04  2:16 Tony Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Wang @ 2014-09-04  2:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Earnshaw, Ramana Radhakrishnan

Ping 2?

> -----Original Message-----
> From: Tony Wang [mailto:tony.wang@arm.com]
> Sent: Thursday, August 28, 2014 2:02 PM
> To: 'gcc-patches@gcc.gnu.org'
> Cc: Richard Earnshaw; Ramana Radhakrishnan
> Subject: RE: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
> 
> Ping?
> 
> > -----Original Message-----
> > From: Tony Wang [mailto:tony.wang@arm.com]
> > Sent: Thursday, August 21, 2014 2:15 PM
> > To: 'gcc-patches@gcc.gnu.org'
> > Subject: [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
> >
> > Step 3: Test cases to verify the code size reduction.
> >
> > gcc/gcc/testsuite/ChangeLog:
> > 2014-08-21  Tony Wang  <tony.wang@arm.com>
> >
> >         * gcc.target/arm/size-optimization-ieee-1.c: New test case
> >         * gcc.target/arm/size-optimization-ieee-2.c: New test case
> >         * lib/gcc-dg.exp: Add new function scan-symbol-common, scan-symbol-yes,
> >         scan-symbol-no to scan a user defined symbol in final elf file
> >
> > BR,
> > Tony
> >
> > diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c b/gcc/testsuite/gcc.target/arm/size-
> > optimization-ieee-1.c
> > new file mode 100644
> > index 0000000..46e9cdf
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
> > @@ -0,0 +1,30 @@
> > +/* { dg-do link { target { arm_thumb2_ok } } } */
> > +/* { dg-options "-Wl,--gc-sections" } */
> > +int
> > +foo ()
> > +{
> > +  volatile float a;
> > +  volatile float b;
> > +  volatile float c = a * b;
> > +  return 0;
> > +}
> > +
> > +int
> > +bar ()
> > +{
> > +  volatile double a;
> > +  volatile double b;
> > +  volatile double c = a * b;
> > +  return 0;
> > +}
> > +
> > +int
> > +main ()
> > +{
> > +  foo ();
> > +  bar ();
> > +  return 0;
> > +}
> > +/* { dg-final { scan-symbol-no "__aeabi_fdiv" } } */
> > +/* { dg-final { scan-symbol-no "__aeabi_ddiv" } } */
> > +
> > diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c b/gcc/testsuite/gcc.target/arm/size-
> > optimization-ieee-2.c
> > new file mode 100644
> > index 0000000..5007d62
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
> > @@ -0,0 +1,30 @@
> > +/* { dg-do link { target { arm_thumb2_ok } } } */
> > +/* { dg-options "-Wl,--gc-sections" } */
> > +int
> > +foo ()
> > +{
> > +  volatile float a;
> > +  volatile float b;
> > +  volatile float c = a / b;
> > +  return 0;
> > +}
> > +
> > +int
> > +bar ()
> > +{
> > +  volatile double a;
> > +  volatile double b;
> > +  volatile double c = a / b;
> > +  return 0;
> > +}
> > +
> > +int
> > +main ()
> > +{
> > +  foo ();
> > +  bar ();
> > +  return 0;
> > +}
> > +/* { dg-final { scan-symbol-yes "__aeabi_fmul" } } */
> > +/* { dg-final { scan-symbol-yes "__aeabi_dmul" } } */
> > +
> > diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
> > index 3390caa..0d52e95 100644
> > --- a/gcc/testsuite/lib/gcc-dg.exp
> > +++ b/gcc/testsuite/lib/gcc-dg.exp
> > @@ -880,5 +880,57 @@ proc gdb-exists { args } {
> >      return 0;
> >  }
> >
> > +# Scan the OUTPUT_FILE for a symbol. Return 1 if it present, or
> > +# return 0 if it doesn't present
> > +
> > +proc scan-symbol-common { args } {
> > +    global nm
> > +    global base_dir
> > +
> > +    set testcase [testname-for-summary]
> > +    set output_file "[file rootname [file tail $testcase]].exe"
> > +
> > +    # Find nm like we find g++ in g++.exp.
> > +    if ![info exists nm]  {
> > +        set nm [findfile $base_dir/../../../binutils/nm \
> > +                $base_dir/../../../binutils/nm \
> > +                [findfile $base_dir/../../nm $base_dir/../../nm \
> > +                      [findfile $base_dir/nm $base_dir/nm \
> > +                       [transform nm]]]]
> > +        verbose -log "nm is $nm"
> > +    }
> > +
> > +    if { $output_file == "" } {
> > +        fail "scan-symbol-not $args: dump file does not exist"
> > +        return
> > +    }
> > +
> > +    set fd [open "| $nm $output_file" r]
> > +    set text [read $fd]
> > +    close $fd
> > +
> > +    if [regexp -- [lindex $args 0] $text] {
> > +        return 1
> > +    } else {
> > +        return 0
> > +    }
> > +}
> > +
> > +proc scan-symbol-yes { args } {
> > +    if { [scan-symbol-common $args] == 1 } {
> > +	pass "scan-symbol-yes $args exists"
> > +    } else {
> > +	fail "scan-symbol-yes $args does not exist"
> > +    }
> > +}
> > +
> > +proc scan-symbol-no { args } {
> > +    if { [scan-symbol-common $args] != 1 } {
> > +        pass "scan-symbol-no $args does not exist"
> > +    } else {
> > +        fail "scan-symbol-no $args exists"
> > +    }
> > +}
> > +
> >  set additional_prunes ""
> >  set dg_runtest_extra_prunes ""



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc
@ 2014-08-21  6:14 Tony Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Wang @ 2014-08-21  6:14 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3723 bytes --]

Step 3: Test cases to verify the code size reduction.

gcc/gcc/testsuite/ChangeLog:
2014-08-21  Tony Wang  <tony.wang@arm.com>

        * gcc.target/arm/size-optimization-ieee-1.c: New test case
        * gcc.target/arm/size-optimization-ieee-2.c: New test case
        * lib/gcc-dg.exp: Add new function scan-symbol-common, scan-symbol-yes, 
        scan-symbol-no to scan a user defined symbol in final elf file

BR,
Tony

diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
new file mode 100644
index 0000000..46e9cdf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
@@ -0,0 +1,30 @@
+/* { dg-do link { target { arm_thumb2_ok } } } */
+/* { dg-options "-Wl,--gc-sections" } */
+int
+foo ()
+{
+  volatile float a;
+  volatile float b;
+  volatile float c = a * b;
+  return 0;
+}
+
+int
+bar ()
+{
+  volatile double a;
+  volatile double b;
+  volatile double c = a * b;
+  return 0;
+}
+
+int
+main ()
+{
+  foo ();
+  bar ();
+  return 0;
+}
+/* { dg-final { scan-symbol-no "__aeabi_fdiv" } } */
+/* { dg-final { scan-symbol-no "__aeabi_ddiv" } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
new file mode 100644
index 0000000..5007d62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
@@ -0,0 +1,30 @@
+/* { dg-do link { target { arm_thumb2_ok } } } */
+/* { dg-options "-Wl,--gc-sections" } */
+int
+foo ()
+{
+  volatile float a;
+  volatile float b;
+  volatile float c = a / b;
+  return 0;
+}
+
+int
+bar ()
+{
+  volatile double a;
+  volatile double b;
+  volatile double c = a / b;
+  return 0;
+}
+
+int
+main ()
+{
+  foo ();
+  bar ();
+  return 0;
+}
+/* { dg-final { scan-symbol-yes "__aeabi_fmul" } } */
+/* { dg-final { scan-symbol-yes "__aeabi_dmul" } } */
+
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 3390caa..0d52e95 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -880,5 +880,57 @@ proc gdb-exists { args } {
     return 0;
 }
 
+# Scan the OUTPUT_FILE for a symbol. Return 1 if it present, or
+# return 0 if it doesn't present
+
+proc scan-symbol-common { args } {
+    global nm
+    global base_dir
+
+    set testcase [testname-for-summary]
+    set output_file "[file rootname [file tail $testcase]].exe"
+
+    # Find nm like we find g++ in g++.exp.
+    if ![info exists nm]  {
+        set nm [findfile $base_dir/../../../binutils/nm \
+                $base_dir/../../../binutils/nm \
+                [findfile $base_dir/../../nm $base_dir/../../nm \
+                      [findfile $base_dir/nm $base_dir/nm \
+                       [transform nm]]]]
+        verbose -log "nm is $nm"
+    }
+
+    if { $output_file == "" } {
+        fail "scan-symbol-not $args: dump file does not exist"
+        return
+    }
+
+    set fd [open "| $nm $output_file" r]
+    set text [read $fd]
+    close $fd
+
+    if [regexp -- [lindex $args 0] $text] {
+        return 1
+    } else {
+        return 0
+    }
+}
+
+proc scan-symbol-yes { args } {
+    if { [scan-symbol-common $args] == 1 } {
+	pass "scan-symbol-yes $args exists"
+    } else {
+	fail "scan-symbol-yes $args does not exist"
+    }
+}
+
+proc scan-symbol-no { args } {
+    if { [scan-symbol-common $args] != 1 } {
+        pass "scan-symbol-no $args does not exist"
+    } else {
+        fail "scan-symbol-no $args exists"
+    }
+}
+
 set additional_prunes ""
 set dg_runtest_extra_prunes ""

[-- Attachment #2: libgcc_mul_div_code_size_reduction_3.diff --]
[-- Type: application/octet-stream, Size: 3151 bytes --]

diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
new file mode 100644
index 0000000..46e9cdf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
@@ -0,0 +1,30 @@
+/* { dg-do link { target { arm_thumb2_ok } } } */
+/* { dg-options "-Wl,--gc-sections" } */
+int
+foo ()
+{
+  volatile float a;
+  volatile float b;
+  volatile float c = a * b;
+  return 0;
+}
+
+int
+bar ()
+{
+  volatile double a;
+  volatile double b;
+  volatile double c = a * b;
+  return 0;
+}
+
+int
+main ()
+{
+  foo ();
+  bar ();
+  return 0;
+}
+/* { dg-final { scan-symbol-no "__aeabi_fdiv" } } */
+/* { dg-final { scan-symbol-no "__aeabi_ddiv" } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
new file mode 100644
index 0000000..5007d62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
@@ -0,0 +1,30 @@
+/* { dg-do link { target { arm_thumb2_ok } } } */
+/* { dg-options "-Wl,--gc-sections" } */
+int
+foo ()
+{
+  volatile float a;
+  volatile float b;
+  volatile float c = a / b;
+  return 0;
+}
+
+int
+bar ()
+{
+  volatile double a;
+  volatile double b;
+  volatile double c = a / b;
+  return 0;
+}
+
+int
+main ()
+{
+  foo ();
+  bar ();
+  return 0;
+}
+/* { dg-final { scan-symbol-yes "__aeabi_fmul" } } */
+/* { dg-final { scan-symbol-yes "__aeabi_dmul" } } */
+
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 3390caa..0d52e95 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -880,5 +880,57 @@ proc gdb-exists { args } {
     return 0;
 }
 
+# Scan the OUTPUT_FILE for a symbol. Return 1 if it present, or
+# return 0 if it doesn't present
+
+proc scan-symbol-common { args } {
+    global nm
+    global base_dir
+
+    set testcase [testname-for-summary]
+    set output_file "[file rootname [file tail $testcase]].exe"
+
+    # Find nm like we find g++ in g++.exp.
+    if ![info exists nm]  {
+        set nm [findfile $base_dir/../../../binutils/nm \
+                $base_dir/../../../binutils/nm \
+                [findfile $base_dir/../../nm $base_dir/../../nm \
+                      [findfile $base_dir/nm $base_dir/nm \
+                       [transform nm]]]]
+        verbose -log "nm is $nm"
+    }
+
+    if { $output_file == "" } {
+        fail "scan-symbol-not $args: dump file does not exist"
+        return
+    }
+
+    set fd [open "| $nm $output_file" r]
+    set text [read $fd]
+    close $fd
+
+    if [regexp -- [lindex $args 0] $text] {
+        return 1
+    } else {
+        return 0
+    }
+}
+
+proc scan-symbol-yes { args } {
+    if { [scan-symbol-common $args] == 1 } {
+	pass "scan-symbol-yes $args exists"
+    } else {
+	fail "scan-symbol-yes $args does not exist"
+    }
+}
+
+proc scan-symbol-no { args } {
+    if { [scan-symbol-common $args] != 1 } {
+        pass "scan-symbol-no $args does not exist"
+    } else {
+        fail "scan-symbol-no $args exists"
+    }
+}
+
 set additional_prunes ""
 set dg_runtest_extra_prunes ""

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-26  2:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28  6:02 [PATCH 3/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc Tony Wang
  -- strict thread matches above, loose matches on Subject: below --
2014-09-26  2:11 Tony Wang
2014-09-16  3:00 Tony Wang
2014-09-04  2:16 Tony Wang
2014-08-21  6:14 Tony Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).