[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2019-12-08 Thread crazylht at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

Hongtao.liu  changed:

   What|Removed |Added

 CC||crazylht at gmail dot com

--- Comment #8 from Hongtao.liu  ---
ICE in r279107, I think my patch trigger some potential bug.

/export/users/liuhongt/gcc/gnu-toolchain/gcc/gcc/testsuite/gcc.target/i386/pr80969-1.c:
In function ‘main’:
/export/users/liuhongt/gcc/gnu-toolchain/gcc/gcc/testsuite/gcc.target/i386/pr80969-1.c:16:1:
internal compiler error: in sp_valid_at, at config/i386/i386.c:6160
0x747bd7 sp_valid_at
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.c:6160
0x10ded88 choose_basereg
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.c:6196
0x10df115 choose_baseaddr
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.c:6309
0x10df1b6 ix86_emit_save_reg_using_mov
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.c:6358
0x10f450e ix86_emit_save_sse_regs_using_mov
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.c:6447
0x10f55b0 ix86_expand_prologue()
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.c:8248
0x14368ba gen_prologue()
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.md:13130
0x10e5988 target_gen_prologue
../../../gcc/gnu-toolchain/gcc/gcc/config/i386/i386.md:19667
0xabcdb7 make_prologue_seq
../../../gcc/gnu-toolchain/gcc/gcc/function.c:5779
0xabcf82 thread_prologue_and_epilogue_insns()
../../../gcc/gnu-toolchain/gcc/gcc/function.c:5896
0xabd672 rest_of_handle_thread_prologue_and_epilogue
../../../gcc/gnu-toolchain/gcc/gcc/function.c:6387
0xabd672 execute
../../../gcc/gnu-toolchain/gcc/gcc/function.c:6463
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

Same error for pr80969-4.c.

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-10-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||jakub at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #7 from Jakub Jelinek  ---
I believe this is fixed (but there are regressions caused by that change,
tracked separately).

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-09-13 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

--- Comment #6 from Aldy Hernandez  ---
Author: aldyh
Date: Wed Sep 13 17:25:11 2017
New Revision: 252554

URL: https://gcc.gnu.org/viewcvs?rev=252554=gcc=rev
Log:
PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when
realigning stack.

2017-08-23  Daniel Santos  

* config/i386/i386.h (ix86_frame::stack_realign_allocate_offset):
Remove field.
(ix86_frame::stack_realign_allocate): New field.
(struct machine_frame_state): Modify comments.
(machine_frame_state::sp_realigned_fp_end): New field.
* config/i386/i386.c (ix86_compute_frame_layout): Rework stack frame
layout calculation.
(sp_valid_at): Add assertion to assure no attempt to access invalid
offset of a realigned stack.
(fp_valid_at): Likewise.
(choose_baseaddr): Modify comments.
(ix86_emit_outlined_ms2sysv_save): Adjust to changes in
ix86_expand_prologue.
(ix86_expand_prologue): Modify stack realignment and allocation.
(ix86_expand_epilogue): Modify comments.
* doc/sourcebuild.texi: Add documentation for target selectors avx2,
avx2_runtime, avx512f, and avx512f_runtime.

2017-08-23  Daniel Santos  

* gcc.target/i386/pr80969-1.c: New testcase.
* gcc.target/i386/pr80969-2a.c: Likewise.
* gcc.target/i386/pr80969-2.c: Likewise.
* gcc.target/i386/pr80969-3.c: Likewise.
* gcc.target/i386/pr80969-4a.c: Likewise.
* gcc.target/i386/pr80969-4b.c: Likewise.
* gcc.target/i386/pr80969-4.c: Likewise.
* gcc.target/i386/pr80969-4.h: New header common to pr80969-4*.c
* lib/target-supports.exp (check_avx512_os_support_available,
check_avx512f_hw_available, check_effective_target_avx512f_runtime):
New proceedures for target avx512f and avx512f_runtime selectors.
(check_avx2_hw_available): Fix breakage due NULL being undefined.

Added:
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-1.c
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-2.c
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-2a.c
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-3.c
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-4.c
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-4.h
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-4a.c
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr80969-4b.c
Modified:
branches/range-gen2/gcc/ChangeLog
branches/range-gen2/gcc/config/i386/i386.c
branches/range-gen2/gcc/config/i386/i386.h
branches/range-gen2/gcc/doc/sourcebuild.texi
branches/range-gen2/gcc/testsuite/ChangeLog
branches/range-gen2/gcc/testsuite/lib/target-supports.exp

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-08-23 Thread dansan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

--- Comment #5 from dansan at gcc dot gnu.org ---
Author: dansan
Date: Wed Aug 23 21:46:14 2017
New Revision: 251321

URL: https://gcc.gnu.org/viewcvs?rev=251321=gcc=rev
Log:
PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when
realigning stack.

2017-08-23  Daniel Santos  

* config/i386/i386.h (ix86_frame::stack_realign_allocate_offset):
Remove field.
(ix86_frame::stack_realign_allocate): New field.
(struct machine_frame_state): Modify comments.
(machine_frame_state::sp_realigned_fp_end): New field.
* config/i386/i386.c (ix86_compute_frame_layout): Rework stack frame
layout calculation.
(sp_valid_at): Add assertion to assure no attempt to access invalid
offset of a realigned stack.
(fp_valid_at): Likewise.
(choose_baseaddr): Modify comments.
(ix86_emit_outlined_ms2sysv_save): Adjust to changes in
ix86_expand_prologue.
(ix86_expand_prologue): Modify stack realignment and allocation.
(ix86_expand_epilogue): Modify comments.
* doc/sourcebuild.texi: Add documentation for target selectors avx2,
avx2_runtime, avx512f, and avx512f_runtime.

2017-08-23  Daniel Santos  

* gcc.target/i386/pr80969-1.c: New testcase.
* gcc.target/i386/pr80969-2a.c: Likewise.
* gcc.target/i386/pr80969-2.c: Likewise.
* gcc.target/i386/pr80969-3.c: Likewise.
* gcc.target/i386/pr80969-4a.c: Likewise.
* gcc.target/i386/pr80969-4b.c: Likewise.
* gcc.target/i386/pr80969-4.c: Likewise.
* gcc.target/i386/pr80969-4.h: New header common to pr80969-4*.c
* lib/target-supports.exp (check_avx512_os_support_available,
check_avx512f_hw_available, check_effective_target_avx512f_runtime):
New proceedures for target avx512f and avx512f_runtime selectors.
(check_avx2_hw_available): Fix breakage due NULL being undefined.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr80969-1.c
trunk/gcc/testsuite/gcc.target/i386/pr80969-2.c
trunk/gcc/testsuite/gcc.target/i386/pr80969-2a.c
trunk/gcc/testsuite/gcc.target/i386/pr80969-3.c
trunk/gcc/testsuite/gcc.target/i386/pr80969-4.c
trunk/gcc/testsuite/gcc.target/i386/pr80969-4.h
trunk/gcc/testsuite/gcc.target/i386/pr80969-4a.c
trunk/gcc/testsuite/gcc.target/i386/pr80969-4b.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.h
trunk/gcc/doc/sourcebuild.texi
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/lib/target-supports.exp

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-07-19 Thread daniel.santos at pobox dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

--- Comment #4 from Daniel Santos  ---
Created attachment 41794
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41794=edit
proposed fix (still needs cleanup and tests)

This still needs cleanup and tests as well as some explanations, but it appears
to fix the problem and passes regression tests.  I haven't tested on a machine
with avx512f, however.  So there is still work and testing to be done.

This re-works the way the realigned stack is calculated and also reduces wasted
stack space due to realignment in some cases.  One drawback is that I have some
code some-what duplicated in ix86_compute_frame_layout and I would like to
spend some more time with it to see if I can refactor it.

I will better document the changes when I have some more time.

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-07-02 Thread daniel.santos at pobox dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

--- Comment #3 from Daniel Santos  ---
Thank you for the report Martin.  I apologize for my slow start on this, I've
been a bit under the weather.  So when I wrote the code for using aligned SSE
saves with realigned (non-DRAP) stack pointer and the -mcall-ms2sysv-xlogues
feature, I had failed to anticipate the need for a stack alignment greater than
16 bytes for the function body.  This ICE is actually occurring from the
realigned stack changes, but this problem also exists with the
-mcall-ms2sysv-xlogues feature and both need to be fixed.

For the sake of the ABI, we only need to save the XMM portion of each SIMD
register (https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx) and we only
need a 16-byte alignment to for those, but this function body needs its locals
64-byte aligned.

On a side note, with the introduction of AVX-512, I wonder if there are some
opportunities to make more efficient (compact) use of the stack with holes
upwards of 56 bytes in the save area.  I should probably learn AVX/2/512
better.

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-06-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
Version|7.0 |8.0

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-06-04 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

Uroš Bizjak  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #2 from Uroš Bizjak  ---
Confirmed, testcase ICEs in:

(gdb) up
#2  0x010ccb96 in ix86_expand_prologue () at
/home/uros/gcc-svn/trunk/gcc/config/i386/i386.c:14562
14562 gcc_assert (m->fs.sp_realigned_offset ==
frame.stack_realign_offset);
(gdb) list
14557below m->fs.sp_realigned_offset and the frame pointer cannot
be
14558used for anything at or above.  */
14559 m->fs.sp_offset = ROUND_UP (m->fs.sp_offset, align_bytes);
14560 m->fs.sp_realigned = true;
14561 m->fs.sp_realigned_offset = m->fs.sp_offset - frame.nsseregs *
16;
14562 gcc_assert (m->fs.sp_realigned_offset ==
frame.stack_realign_offset);
14563 /* SEH unwind emit doesn't currently support REG_CFA_EXPRESSION,
which
14564is needed to describe where a register is saved using a
realigned
14565stack pointer, so we need to invalidate the stack pointer for
that
14566target.  */

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-06-04 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

Uroš Bizjak  changed:

   What|Removed |Added

 CC||daniel.santos at pobox dot com

--- Comment #1 from Uroš Bizjak  ---
CC author.

[Bug target/80969] [8 Regression] ICE in ix86_expand_prologue, at config/i386/i386.c:14606

2017-06-04 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80969

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2017-6-4
 CC||uros at gcc dot gnu.org
   Target Milestone|--- |8.0
  Known to fail||8.0