Bug 49964 - Bootstrap failed with AVX turned on
Summary: Bootstrap failed with AVX turned on
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Richard Henderson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-03 14:27 UTC by Yukhin Kirill
Modified: 2011-08-04 19:09 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-08-03 17:37:53


Attachments
A patch (986 bytes, patch)
2011-08-03 20:51 UTC, H.J. Lu
Details | Diff
full patch (2.05 KB, patch)
2011-08-03 21:43 UTC, Richard Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yukhin Kirill 2011-08-03 14:27:03 UTC
Revision 177268 failed to bootstrap with AVX enabled.
Comment 1 Yukhin Kirill 2011-08-03 14:28:55 UTC
Started from here
http://gcc.gnu.org/ml/gcc-regression/2011-08/msg00051.html
Comment 2 H.J. Lu 2011-08-03 17:37:53 UTC
It is caused by revision 177218:

http://gcc.gnu.org/ml/gcc-cvs/2011-08/msg00228.html

On Linux/ia32, adding -march=corei7-avx caused:

[hjl@gnu-snb-1 src]$ /export/gnu/import/rrs-bootstrap/177218/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/rrs-bootstrap/177218/bld/./gcc -nostdinc++ -L/export/gnu/import/rrs-bootstrap/177218/bld/x86_64-unknown-linux-gnu/32/libstdc++-v3/src -L/export/gnu/import/rrs-bootstrap/177218/bld/x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs -B/export/gnu/import/rrs-bootstrap/177218/usr/x86_64-unknown-linux-gnu/bin/ -B/export/gnu/import/rrs-bootstrap/177218/usr/x86_64-unknown-linux-gnu/lib/ -isystem /export/gnu/import/rrs-bootstrap/177218/usr/x86_64-unknown-linux-gnu/include -isystem /export/gnu/import/rrs-bootstrap/177218/usr/x86_64-unknown-linux-gnu/sys-include -m32 -I/export/gnu/import/rrs-bootstrap/177218/bld/x86_64-unknown-linux-gnu/32/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/export/gnu/import/rrs-bootstrap/177218/bld/x86_64-unknown-linux-gnu/32/libstdc++-v3/include -I/export/gnu/import/rrs-bootstrap/177218/src/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=functexcept.lo -g -O2 -D_GNU_SOURCE -m32 -std=gnu++0x -c ../../../../../src/libstdc++-v3/src/functexcept.cc  -fPIC -DPIC -S -march=corei7-avx
../../../../../src/libstdc++-v3/src/functexcept.cc: In function ‘void std::__throw_system_error(int)’:
../../../../../src/libstdc++-v3/src/functexcept.cc:106:62: internal compiler error: in fixup_args_size_notes, at expr.c:3586
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-snb-1 src]$
Comment 3 Richard Henderson 2011-08-03 18:02:43 UTC
Mine.
Comment 4 Richard Henderson 2011-08-03 19:11:48 UTC
It's a bug in the i386 backend:

(call_insn 28 27 136 2 (parallel [
            (parallel [
                    (call (mem:QI (mem/f:SI (plus:SI (reg/f:SI 73 [ __ec$_M_cat_2->_vptr.error_category ])
                                    (const_int 12 [0xc])) [3 MEM[(int (*__vtbl_ptr_type) () *)D.126512_12 + 12B]+0 S4 A32]) [0 *OBJ_TYPE_REF(D.126513_13;__ec$_M_cat_2->3) S1 A8])
                        (const_int 12 [0xc]))
                    (set (reg/f:SI 7 sp)
                        (plus:SI (reg/f:SI 7 sp)
                            (const_int 4 [0x4])))
                ])
            (unspec [
                    (const_int 2 [0x2])
                ] UNSPEC_CALL_NEEDS_VZEROUPPER)
        ]) /home/rth/work/gcc/bld/i686-linux/libstdc++-v3/include/system_error:158 480 {*call_pop_vzeroupper}

Note the nested PARALLEL.
Comment 5 H.J. Lu 2011-08-03 20:51:22 UTC
Created attachment 24910 [details]
A patch

I am testing this.
Comment 6 Richard Henderson 2011-08-03 21:43:53 UTC
Created attachment 24911 [details]
full patch

Your patch misses several patterns.

This bootstraps, but I don't have an avx cpu locally.
Comment 7 H.J. Lu 2011-08-03 21:46:22 UTC
(In reply to comment #6)
> Created attachment 24911 [details]
> full patch
> 
> Your patch misses several patterns.
> 
> This bootstraps, but I don't have an avx cpu locally.

I am testing it now.  Thanks.
Comment 8 H.J. Lu 2011-08-04 00:18:27 UTC
(In reply to comment #6)
> Created attachment 24911 [details]
> full patch
> 
> Your patch misses several patterns.
> 
> This bootstraps, but I don't have an avx cpu locally.

It works:

http://gcc.gnu.org/ml/gcc-testresults/2011-08/msg00355.html
Comment 9 Richard Henderson 2011-08-04 15:47:50 UTC
Author: rth
Date: Thu Aug  4 15:47:42 2011
New Revision: 177408

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177408
Log:
PR target/49964
        * config/i386/i386.c (ix86_expand_call): Don't create nested
        PARALLELs for TARGET_VZEROUPPER.
        (ix86_split_call_vzeroupper): Fix extraction of the original call.
        * config/i386/i386.md (*call_rex64_ms_sysv_vzeroupper): Don't
        recognize nested PARALLELs.
        (*call_pop_vzeroupper, *sibcall_pop_vzeroupper,
        *call_value_rex64_ms_sysv_vzeroupper, *call_value_pop_vzeroupper,
        *sibcall_value_pop_vzeroupper): Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
Comment 10 Richard Henderson 2011-08-04 19:09:42 UTC
Fixed.