public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104976] New: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE
@ 2022-03-18  8:04 crazylht at gmail dot com
  2022-03-18  8:05 ` [Bug target/104976] " crazylht at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2022-03-18  8:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104976

            Bug ID: 104976
           Summary: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

void
foo (int a, float b, double* c)
{
  union {
    _Float16 f[2];
    int i;} x;
  x.i = a;
  c[0] = x.f[0] * 0.2;
  c[1] = x.f[1] * 0.2;
}

 7165(define_expand "extendv2hfv2df2"
 7166  [(set (match_operand:V2DF 0 "register_operand")
 7167        (float_extend:V2DF
 7168          (match_operand:V2HF 1 "nonimmediate_operand")))]
 7169  "TARGET_AVX512FP16 && TARGET_AVX512VL"
 7170{
 7171  if (!MEM_P (operands[1]))
 7172    {
 7173      operands[1] = lowpart_subreg (V8HFmode, operands[1], V2HFmode);
 7174      emit_insn (gen_avx512fp16_float_extend_phv2df2
 7175                 (operands[0], operands[1]));
 7176      DONE;
 7177    }
 7178})

here operands[1] is (subreg:V2HF (reg:SI) 0) which is valid, but not for
(subreg:v8hf (reg:SI 0) and return NULL cause invalid rtl.

101(insn 8 7 9 (set (reg:V2DF 88 [ vect__1.3 ])
102        (float_extend:V2DF (vec_select:V2HF (nil)
103                (parallel [
104                        (const_int 0 [0])
105                        (const_int 1 [0x1])
106                    ])))) "test3.c":8:13 -1
107     (nil))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/104976] [avx512fp16] lowpart_subreg return NULL_RTX cause ICE
  2022-03-18  8:04 [Bug target/104976] New: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE crazylht at gmail dot com
@ 2022-03-18  8:05 ` crazylht at gmail dot com
  2022-03-18  8:08 ` crazylht at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2022-03-18  8:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104976

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-* i?86-*-*
           Keywords|                            |ice-on-valid-code

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
The walkround in the backend is force_reg operand[1] before lowpart_subreg to
avoid NULL_RTX.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/104976] [avx512fp16] lowpart_subreg return NULL_RTX cause ICE
  2022-03-18  8:04 [Bug target/104976] New: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE crazylht at gmail dot com
  2022-03-18  8:05 ` [Bug target/104976] " crazylht at gmail dot com
@ 2022-03-18  8:08 ` crazylht at gmail dot com
  2022-03-23  7:59 ` cvs-commit at gcc dot gnu.org
  2022-03-23  8:02 ` crazylht at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2022-03-18  8:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104976

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #1)
> The walkround in the backend is force_reg operand[1] before lowpart_subreg
> to avoid NULL_RTX.

It would be nice if we extend validate_subreg to avoid wired situation which
allows (subreg:V8HF (reg:V2HF ) 0) and (subreg:V2HF (reg:SI) 0) but not
(subreg:V8HF (reg:SI) 0)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/104976] [avx512fp16] lowpart_subreg return NULL_RTX cause ICE
  2022-03-18  8:04 [Bug target/104976] New: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE crazylht at gmail dot com
  2022-03-18  8:05 ` [Bug target/104976] " crazylht at gmail dot com
  2022-03-18  8:08 ` crazylht at gmail dot com
@ 2022-03-23  7:59 ` cvs-commit at gcc dot gnu.org
  2022-03-23  8:02 ` crazylht at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-23  7:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104976

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:8fa7216ae0d8a15aaa1a54e1d8e308f791e65d97

commit r12-7775-g8fa7216ae0d8a15aaa1a54e1d8e308f791e65d97
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Mar 21 09:10:50 2022 +0800

    Fix ICE caused by NULL_RTX returned by lowpart_subreg.

    In validate_subreg, both (subreg:V2HF (reg:SI) 0)
    and (subreg:V8HF (reg:V2HF) 0) are valid, but not
    for (subreg:V8HF (reg:SI) 0) which causes ICE.

    Ideally it should be handled in validate_subreg to support
    subreg for all modes available in TARGET_CAN_CHANGE_MODE_CLASS, but
    that would be too risky in stage4, so the patch is a walkround in the
    backend to force_reg operands before lowpart_subreg for expanders or
    pre_reload splitters.

    gcc/ChangeLog:

            PR target/104976
            * config/i386/sse.md (ssePSmodelower): New.
            (*avx_cmp<mode>3_ltint_not): Force_reg operand before
            lowpart_subreg to avoid NULL_RTX.
            (<avx512>_fmaddc_<mode>_mask1<round_expand_name>,
            <avx512>_fcmaddc_<mode>_mask1<round_expand_name>,
            fma_<mode>_fmaddc_bcst, fma_<mode>_fcmaddc_bcst,
            <avx512>_<complexopname>_<mode>_mask<round_name>,
            avx512fp16_fcmaddcsh_v8hf_mask1<round_expand_name>,
            avx512fp16_fcmaddcsh_v8hf_mask3<round_expand_name>,
            avx512fp16_fmaddcsh_v8hf_mask3<round_expand_name>,
            avx512fp16_fmaddcsh_v8hf_mask3<round_expand_name>,
            float<floatunssuffix><mode>v4hf2,
            float<floatunssuffix>v2div2hf2,
            fix<fixunssuffix>_truncv4hf<mode>2,
            fix<fixunssuffix>_truncv2hfv2di2, extendv4hf<mode>2,
            extendv2hfv2df2,
            trunc<mode>v4hf2,truncv2dfv2hf2,
            *avx512bw_permvar_truncv16siv16hi_1,
            *avx512bw_permvar_truncv16siv16hi_1_hf,
            *avx512f_permvar_truncv8siv8hi_1,
            *avx512f_permvar_truncv8siv8hi_1_hf,
            *avx512f_vpermvar_truncv8div8si_1,
            *avx512f_permvar_truncv32hiv32qi_1,
            *avx512f_permvar_truncv16hiv16qi_1,
            *avx512f_permvar_truncv4div4si_1,
            *avx512f_pshufb_truncv8hiv8qi_1,
            *avx512f_pshufb_truncv4siv4hi_1,
            *avx512f_pshufd_truncv2div2si_1,
            sdot_prod<mode>, avx2_pblend<ssemodesuffix>_1,
            ashrv2di3,ashrv2di3,usdot_prod<mode>): Ditto.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr104976.c: New test.
            * gcc.target/i386/avx512fp16-vfcmaddcph-1a.c: Scan either
            vblendps or masked vmovaps.
            * gcc.target/i386/avx512fp16-vfmaddcph-1a.c: Ditto
            * gcc.target/i386/avx512fp16vl-vfcmaddcph-1a.c: Ditto.
            * gcc.target/i386/avx512fp16vl-vfmaddcph-1a.c: Ditto.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/104976] [avx512fp16] lowpart_subreg return NULL_RTX cause ICE
  2022-03-18  8:04 [Bug target/104976] New: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE crazylht at gmail dot com
                   ` (2 preceding siblings ...)
  2022-03-23  7:59 ` cvs-commit at gcc dot gnu.org
@ 2022-03-23  8:02 ` crazylht at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2022-03-23  8:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104976

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
ICE is fixed in GCC12, and I'd like to keep this PR open for refining
validate_subreg in GCC13.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-23  8:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18  8:04 [Bug target/104976] New: [avx512fp16] lowpart_subreg return NULL_RTX cause ICE crazylht at gmail dot com
2022-03-18  8:05 ` [Bug target/104976] " crazylht at gmail dot com
2022-03-18  8:08 ` crazylht at gmail dot com
2022-03-23  7:59 ` cvs-commit at gcc dot gnu.org
2022-03-23  8:02 ` crazylht at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).