From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 139223858D34; Fri, 27 Aug 2021 07:34:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 139223858D34 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/101796] Miss optimization to optimized (vashl op0, (op1: const_duplicate_vector)) to (ashl op0 op1_inner) Date: Fri, 27 Aug 2021 07:34:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2021 07:34:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101796 --- Comment #4 from Hongtao.liu --- (In reply to Andrew Pinski from comment #3) > Combine is able to do the combine but it fails as it does not match: > Trying 10, 9 -> 14: > 10: r92:HI=3D0x3 > 9: r91:V32HI=3Dvec_duplicate(r92:HI) > REG_DEAD r92:HI > REG_EQUAL const_vector > 14: r88:V32HI=3Dr96:V8DI#0 0>>r91:V32HI > REG_DEAD r96:V8DI > REG_DEAD r91:V32HI > Failed to match this instruction: > (set (reg:V32HI 88) > (lshiftrt:V32HI (subreg:V32HI (reg:V8DI 96) 0) > (const_vector:V32HI [ > (const_int 3 [0x3]) repeated x32 > ]))) >=20 > This instruction does not have alt for the dup/const_vect case I think: > (define_insn "_v" > [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=3Dv") > (any_lshift:VI2_AVX512VL > (match_operand:VI2_AVX512VL 1 "register_operand" "v") > (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))] > "TARGET_AVX512BW" > "vpv\t{%2, %1, %0|%0, > %1, %2}" > [(set_attr "type" "sseishft") > (set_attr "prefix" "maybe_evex") > (set_attr "mode" "")]) >=20 > Note I don't think simplify-rtx will change const_vector to just 3 though. Yes, it's rejected at https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576837.html=