Skip to content

Commit

Permalink
Fix fp16 related testcase failure for i686.
Browse files Browse the repository at this point in the history
> I see some regressions most likely with this change on i686-linux,
> in particular:
> +FAIL: gcc.dg/pr107547.c (test for excess errors)
> +FAIL: gcc.dg/torture/floatn-convert.c  -O0 (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O0 compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -O1 (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O1 compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -O2 (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O2 compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -O2 -flto (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O2 -flto compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -O2 -flto -flto-partition=none (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O2 -flto -flto-partition=none compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -O3 -g (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -O3 -g compilation failed to produce executable
> +FAIL: gcc.dg/torture/floatn-convert.c  -Os (test for excess errors)
> +UNRESOLVED: gcc.dg/torture/floatn-convert.c  -Os compilation failed to produce executable
> +FAIL: gcc.target/i386/float16-7.c (test for errors, line 7)
>

> Perhaps we need to tweak
> gcc/testsuite/lib/target-supports.exp (add_options_for_float16)
> so that it adds -msse2 for i?86-*-* x86_64-*-* (that would likely
> fix up floatn-convert) and for the others perhaps
> /* { dg-add-options float16 } */
> ?

I've verified the change fixed those failures.
Ready to push to trunk if there's no objections.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr107547.c: Add { dg-add-options float16 }.
	* gcc.target/i386/float16-7.c: Add -msse2 to dg-options.
	* lib/target-supports.exp (add_options_for_float16): Add
	-msse2 for i?86-*-* || x86_64-*-*.
  • Loading branch information
algebra84 authored and ouuleilei-bot committed Jul 20, 2023
1 parent c2d62cd commit 7d159c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions gcc/testsuite/gcc.dg/pr107547.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* PR tree-optimization/107547 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-add-options float16 } */

int x;

Expand Down
2 changes: 1 addition & 1 deletion gcc/testsuite/gcc.target/i386/float16-7.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mfpmath=387 -fexcess-precision=16" } */
/* { dg-options "-O2 -msse2 -mfpmath=387 -fexcess-precision=16" } */
/* { dg-excess-errors "'-fexcess-precision=16' is not compatible with '-mfpmath=387'" } */
_Float16
foo (_Float16 a, _Float16 b)
Expand Down
3 changes: 3 additions & 0 deletions gcc/testsuite/lib/target-supports.exp
Original file line number Diff line number Diff line change
Expand Up @@ -3426,6 +3426,9 @@ proc add_options_for_float16 { flags } {
if { [istarget arm*-*-*] } {
return "$flags -mfp16-format=ieee"
}
if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
return "$flags -msse2"
}
return "$flags"
}

Expand Down

0 comments on commit 7d159c2

Please sign in to comment.