Bug 82964 - gfortran.dg/class_array_1.f03 regression since r254388
Summary: gfortran.dg/class_array_1.f03 regression since r254388
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Wilco
URL:
Keywords:
: 82974 83632 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-13 13:53 UTC by Christophe Lyon
Modified: 2018-01-18 16:38 UTC (History)
2 users (show)

See Also:
Host:
Target: aarch64
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-12-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Lyon 2017-11-13 13:53:57 UTC
As already reported in https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00286.html ,
a few fortran tests now ICE since r254388 on aarch64:

    gfortran.dg/class_array_1.f03   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler error)
    gfortran.dg/type_to_class_3.f03   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler error)
    gfortran.dg/type_to_class_3.f03   -O3 -g  (internal compiler error)
    gfortran.dg/widechar_intrinsics_5.f90   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler error)
    gfortran.dg/widechar_intrinsics_5.f90   -O3 -g  (internal compiler error)
Comment 1 Wilco 2017-12-05 14:33:20 UTC
*** Bug 82974 has been marked as a duplicate of this bug. ***
Comment 2 Wilco 2018-01-17 16:32:13 UTC
Author: wilco
Date: Wed Jan 17 16:31:42 2018
New Revision: 256800

URL: https://gcc.gnu.org/viewcvs?rev=256800&root=gcc&view=rev
Log:
[AArch64] PR82964: Fix 128-bit immediate ICEs

This fixes PR82964 which reports ICEs for some CONST_WIDE_INT immediates.
It turns out decimal floating point CONST_DOUBLE get changed into
CONST_WIDE_INT without checking the constraint on the operand, which 
results in failures.  Avoid this by only allowing SF/DF/TF mode floating
point constants in aarch64_legitimate_constant_p.  A similar issue can
occur with 128-bit immediates which may be emitted even when disallowed
in aarch64_legitimate_constant_p, and the constraints in movti_aarch64
don't match.  Fix this with a new constraint and allowing valid immediates
in aarch64_legitimate_constant_p.

Rather than allowing all 128-bit immediates and expanding in up to 8
MOV/MOVK instructions, limit them to 4 instructions and use a literal
load for other cases.  Improve a few TImode tests to use a literal and
ensure they are skipped with -fpic.

This fixes all reported failures.

    gcc/
	PR target/82964
	* config/aarch64/aarch64.md (movti_aarch64): Use Uti constraint.
	* config/aarch64/aarch64.c (aarch64_mov128_immediate): New function.
	(aarch64_legitimate_constant_p): Just support CONST_DOUBLE 
	SF/DF/TF mode to avoid creating illegal CONST_WIDE_INT immediates.
	* config/aarch64/aarch64-protos.h (aarch64_mov128_immediate):
	Add declaration.
	* config/aarch64/constraints.md (aarch64_movti_operand):
	Limit immediates.
	* config/aarch64/predicates.md (Uti): Add new constraint.

    gcc/testsuite/
	PR target/79041
	PR target/82964
	* gcc.target/aarch64/pr79041-2.c: Improve test, disable with fpic.
	* gcc.target/aarch64/pr78733.c: Improve test, disable with fpic.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64-protos.h
    trunk/gcc/config/aarch64/aarch64.c
    trunk/gcc/config/aarch64/aarch64.md
    trunk/gcc/config/aarch64/constraints.md
    trunk/gcc/config/aarch64/predicates.md
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/aarch64/pr78733.c
    trunk/gcc/testsuite/gcc.target/aarch64/pr79041-2.c
Comment 3 Wilco 2018-01-17 16:53:39 UTC
Fixed
Comment 4 Andreas Schwab 2018-01-17 18:11:39 UTC
*** Bug 83632 has been marked as a duplicate of this bug. ***
Comment 5 Wilco 2018-01-18 16:38:16 UTC
Author: wilco
Date: Thu Jan 18 16:37:44 2018
New Revision: 256854

URL: https://gcc.gnu.org/viewcvs?rev=256854&root=gcc&view=rev
Log:
[AArch64] Fix fp16 test failures after PR82964 fix

This fixes test failures in gcc.target/aarch64/f16_mov_immediate_*.c
after fixing PR82964.  The check for a scalar floating point constant
didn't include 16-bit floating point modes, so use GET_MODE_CLASS
instead.

    gcc/
	PR target/82964
	* config/aarch64/aarch64.c (aarch64_legitimate_constant_p):
	Use GET_MODE_CLASS for scalar floating point.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.c