b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
new file mode 100644
@@ -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" } } */
+
b/gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
new file mode 100644
@@ -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" } } */
+
@@ -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 ""