From 84df580f073debc208187d1ff2e5cec49989e5a9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 11 Jan 2019 00:20:19 +0100 Subject: [PATCH] re PR target/88785 (ICE in as_a, at machmode.h:353) PR target/88785 * config/i386/sse.md (floatv2div2sf2): Turn into define_expand. (*floatv2div2sf2): New define_insn. (floatv2div2sf2_mask): Turn into define_expand. (*floatv2div2sf2_mask): New define_insn. (*floatv2div2sf2_mask_1): Replace subrtxes (const_vector:V2SF [(const_int 0) (const_int 0)]) with match_operands with "const0_operand" "C". * g++.target/i386/pr88785.C: New test. From-SVN: r267825 --- gcc/ChangeLog | 12 ++ gcc/config/i386/sse.md | 35 ++++- gcc/testsuite/ChangeLog | 5 + gcc/testsuite/g++.target/i386/pr88785.C | 197 ++++++++++++++++++++++++ 4 files changed, 242 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/pr88785.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60a1ab3c6f8..8a83f4e376c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-01-10 Jakub Jelinek + + PR target/88785 + * config/i386/sse.md (floatv2div2sf2): Turn into + define_expand. + (*floatv2div2sf2): New define_insn. + (floatv2div2sf2_mask): Turn into define_expand. + (*floatv2div2sf2_mask): New define_insn. + (*floatv2div2sf2_mask_1): Replace + subrtxes (const_vector:V2SF [(const_int 0) (const_int 0)]) with + match_operands with "const0_operand" "C". + 2019-01-10 Tamar Christina * config/aarch64/aarch64-builtins.c diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index b5e3cd82eea..c9ec74b6aa1 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -5222,11 +5222,19 @@ (set_attr "prefix" "evex") (set_attr "mode" "")]) -(define_insn "floatv2div2sf2" +(define_expand "floatv2div2sf2" [(set (match_operand:V4SF 0 "register_operand" "=v") (vec_concat:V4SF (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm")) - (const_vector:V2SF [(const_int 0) (const_int 0)])))] + (match_dup 2)))] + "TARGET_AVX512DQ && TARGET_AVX512VL" + "operands[2] = CONST0_RTX (V2SFmode);") + +(define_insn "*floatv2div2sf2" + [(set (match_operand:V4SF 0 "register_operand" "=v") + (vec_concat:V4SF + (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm")) + (match_operand:V2SF 2 "const0_operand" "C")))] "TARGET_AVX512DQ && TARGET_AVX512VL" "vcvtqq2ps{x}\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") @@ -5260,16 +5268,29 @@ DONE; }) -(define_insn "floatv2div2sf2_mask" +(define_expand "floatv2div2sf2_mask" + [(set (match_operand:V4SF 0 "register_operand" "=v") + (vec_concat:V4SF + (vec_merge:V2SF + (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm")) + (vec_select:V2SF + (match_operand:V4SF 2 "nonimm_or_0_operand" "0C") + (parallel [(const_int 0) (const_int 1)])) + (match_operand:QI 3 "register_operand" "Yk")) + (match_dup 4)))] + "TARGET_AVX512DQ && TARGET_AVX512VL" + "operands[4] = CONST0_RTX (V2SFmode);") + +(define_insn "*floatv2div2sf2_mask" [(set (match_operand:V4SF 0 "register_operand" "=v") (vec_concat:V4SF (vec_merge:V2SF - (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm")) + (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm")) (vec_select:V2SF (match_operand:V4SF 2 "nonimm_or_0_operand" "0C") (parallel [(const_int 0) (const_int 1)])) (match_operand:QI 3 "register_operand" "Yk")) - (const_vector:V2SF [(const_int 0) (const_int 0)])))] + (match_operand:V2SF 4 "const0_operand" "C")))] "TARGET_AVX512DQ && TARGET_AVX512VL" "vcvtqq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}" [(set_attr "type" "ssecvt") @@ -5282,9 +5303,9 @@ (vec_merge:V2SF (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm")) - (const_vector:V2SF [(const_int 0) (const_int 0)]) + (match_operand:V2SF 3 "const0_operand" "C") (match_operand:QI 2 "register_operand" "Yk")) - (const_vector:V2SF [(const_int 0) (const_int 0)])))] + (match_operand:V2SF 4 "const0_operand" "C")))] "TARGET_AVX512DQ && TARGET_AVX512VL" "vcvtqq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}" [(set_attr "type" "ssecvt") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 33dd6300d84..018fa7675a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-10 Jakub Jelinek + + PR target/88785 + * g++.target/i386/pr88785.C: New test. + 2019-01-10 Vladimir Makarov PR rtl-optimization/87305 diff --git a/gcc/testsuite/g++.target/i386/pr88785.C b/gcc/testsuite/g++.target/i386/pr88785.C new file mode 100644 index 00000000000..026528656ad --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr88785.C @@ -0,0 +1,197 @@ +// PR target/88785 +// { dg-do compile } +// { dg-options "-O2 -g -std=c++17 -mavx512vl -mavx512dq" } + +namespace a { +template class b; +template class d; +} +template struct g { static constexpr int e = f; }; +template struct aa; +template struct o; +template struct o : aa::ac {}; +template struct j; +template struct j : aa::ac {}; +template constexpr bool l = o::e; +template struct r : g {}; +template struct r : g {}; +template struct aa { typedef ad ac; }; +template using ae = ad; +template using af = void; +typedef float ag __attribute__((__vector_size__(16))); +ag ah; +ag ai(__attribute__((__vector_size__(2 * sizeof(long long)))) long long z) { + ah = ag{}; + __attribute__((__vector_size__(4 * sizeof(float)))) float aj = ah; + return __builtin_ia32_cvtqq2ps128_mask(z, aj, 1); +} +namespace a { +int ak; +int al; +template int am; +template struct an; +template struct ao; +template using ap = typename ao::ac; +template > struct aq; +template using ar = aq; +template as au(at); +template struct av; +template using aw = typename av::ac; +template struct ay { + static constexpr long az = ax * sizeof(int); + using ac [[gnu::__vector_size__(az)]] = m; +}; +template using bb = typename ay::ac; +template struct p { + using bc = decltype(m()[0]); + static constexpr int bd = sizeof(bc); +}; +template > as be(m); +template as bf(at... z) { return be(z...); } +template > bg bh(aq) { + return bg(); +} +template <> struct av { + using ac [[gnu::__vector_size__(16)]] = float; +}; +template struct av { + using ac [[gnu::__vector_size__(16)]] = long long; +}; +template struct aq {}; +template , + bool = l, aw>, r>> +struct bk; +template struct bk { + bj bl; + bk(bb z) : bl(z) {} +}; +template struct bk {}; +template struct aq : bk { + using bm = bb; + static constexpr long bd = bi; + aq(); + template aq(bn z) : bk(z) {} + m operator[](long); +}; +template constexpr long bo = g<0>::e; +template struct ao { using ac = typename an::br; }; +template class bq { + using bu = m; + bp bs; + m bt; + +public: + template void q(bn z, bv bw) { + auto s = bx(bt), by = bx(bs); + ap::bz(s, z, bw, by); + } +}; +class ca { +public: + template void cb(bn, bv); +}; +template ca cc(typename b::cd, m &); +template bq, b> cc(typename b::cd, const m &); +struct ce; +template struct cf { + using br = typename t::br; + using cg = aq; + using ch = aq; +}; +struct ci { + template static constexpr long cj = sizeof(m); + struct ck : j> {}; + template static constexpr bool cl = ck::e; + using br = ce; + template using cn = ae, cf>, int>; +}; +template struct an : ci::cn {}; +template class d : an { + using cm = ch; + +public: + cm bl; +}; +template auto bx(m z) { return z.bl; } +template class b : an { + using cm = cg; + +public: + using cd = d; + static long cu(); + b(); + template b(bn, bv) {} + cm bl; +}; +template auto bx(b z) { return z.bl; } +template void cq(ar, co, aq::bd>); +template as be(bu z) { + using cs = typename cp::bc; + constexpr long ax = cp::bd; + auto cr = bh(z); + aq f; + using bn = typename p::bc; + constexpr bool cy = sizeof(f), ct = sizeof(bn); + if (ct) + if (cy) { + ag cw = ai(cr); + return cw; + } +} +template auto cv(at z) { return bf(z); } +struct G { + template using ch = typename ci::cn::ch; + template + static void bz(aq z, bn *, co, ch cx) { + using da = aq; + using bu = typename da::bm; + using bp = aq, da::bd>; + auto cz = cv(z); + cq(da(cz), ae<0, int, co>(), au(cx)); + } +}; +struct ce : G {}; +} +class D { +public: + D(...); + template void operator<<(db); +}; +template dc dd; +struct de { + long cu(); +}; +template void dg() { + using db = long; + auto df = dd>; + using a::ak; + using a::al; + constexpr long di = 1, alignment = a::bo>; + using dh = ae; + dh dk, am = a::am; + const a::b dj; + de u; + auto dm = 0 ? u.cu() : 0; + float dl[dm]; + db reference; + a::b x; + auto compare = [&](long) { + int n; + a::b(reference, ak); + for (auto i = 0; 0; ++i) + [] { + auto v = 0, w = 0; + return D(w, v); + }() << n; + }; + compare(0); + using c = a::b::cd; + c dn; + a::b y = df; + auto v(y); + cc(dn, x).cb(dl, am); + long i; + cc(dn, dj).q(&dl[dc::cu()], dk); + ++i; +} +void test() { dg>(); } -- 2.30.2