From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5F9D3858D20; Tue, 30 May 2023 12:42:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5F9D3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685450522; bh=2o9VWRsKXTGJoiiq4frf/FRdk3+srf/8uEwu3mqKqAg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kMK9HopymRXKCm1K5zm0Q8crGEEKoX1kSCFf6UZ3pfXOngs69DFp0FYl8b9OuB5CD 4nI0Uhm1hWdMD/CTmiW5HQ7wFdHbAYQzIv60vqWi3iqUINYZowiyNufIYZJHk5qw9I AKipsK6fwx71IIVnkDl1nx5JsmoKDN3KzV0Rb78A= From: "klepikov.alex+bugs at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/49263] SH Target: underutilized "TST #imm, R0" instruction Date: Tue, 30 May 2023 12:42:00 +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: 4.6.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: klepikov.alex+bugs at gmail dot com X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: olegendo 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D49263 --- Comment #48 from Alexander Klepikov --- I made tests (including *.c files from GCC testsuite) and everything looks = fine for now. But I'm still afraid that pattern for 'ashrsi3_libcall_expand' is = too wide. It is possible to narrow it down as much as possible by adding distin= ct attribute and set when emitting 'ashrsi3_libcall_collapsed' and then check = it and fail if not set: (define_attr "libcall_collapsed" "ashrsi3,nil" (const_string "nil")) (define_insn "ashrsi3_libcall_collapsed" [(set (match_operand:SI 0 "arith_reg_dest" "=3Dr") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand"))) (clobber (reg:SI T_REG)) (clobber (reg:SI PR_REG))] "TARGET_SH1" "OOPS" [(set_attr "type" "dyn_shift") (set_attr "libcall_collapsed" "ashrsi3") (set_attr "needs_delay_slot" "yes")]) if (get_attr_libcall_collapsed(insn) !=3D LIBCALL_COLLAPSED_ASHRSI3) return false; It will be super safe then but ugly a little bit.=