public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109907] Missed optimization for bit extraction (uses shift instead of single bit-test) Date: Sun, 11 Jun 2023 09:22:40 +0000 [thread overview] Message-ID: <bug-109907-4-nxn2WCwlm0@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109907-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109907 --- Comment #30 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>: https://gcc.gnu.org/g:20643513b8dd34c07f2b0fccf119153a30735f66 commit r14-1694-g20643513b8dd34c07f2b0fccf119153a30735f66 Author: Georg-Johann Lay <avr@gjlay.de> Date: Sat Jun 10 23:21:13 2023 +0200 target/19907: Overhaul bit extractions. o Logical right shift that shifts the MSB to position 0 can be performed in such a way that the input operand constraint can be relaxed from "0" to "r". This results in less register pressure. Moreover, no scratch register is required in that case. o The deprecated "extzv" pattern is replaced by "extzv<mode>" that allows inputs of scalar integer modes of different sizes (1 up to 4 bytes). o Existing patterns are adjusted to the more generic "extzv<mode>" pattern. Some patterns are added as the middle-end has been reworked to spot more bit-extraction opportunities. o A C function is used to print the asm for bit extractions, which is more convenient for complex output logic. The generated code is still not optimal because RTL optimizers might still prefer arithmetic like shift over bit-extractions. For test cases see also PR36884 and PR55181. gcc/ PR target/109907 * config/avr/avr.md (adjust_len) [extr, extr_not]: New elements. (MSB, SIZE): New mode attributes. (any_shift): New code iterator. (*lshr<mode>3_split, *lshr<mode>3, lshr<mode>3) (*lshr<mode>3_const_split): Add constraint alternative for the case of shift-offset = MSB. Ditch "length" attribute. (extzv<mode): New. replaces extzv. Adjust following patterns. Use avr_out_extr, avr_out_extr_not to print asm. (*extzv.subreg.<mode>, *extzv.<mode>.subreg, *extzv.xor) (*extzv<mode>.ge, *neg.ashiftrt<mode>.msb, *extzv.io.lsr7): New. * config/avr/constraints.md (C15, C23, C31, Yil): New * config/avr/predicates.md (reg_or_low_io_operand) (const7_operand, reg_or_low_io_operand) (const15_operand, const_0_to_15_operand) (const23_operand, const_0_to_23_operand) (const31_operand, const_0_to_31_operand): New. * config/avr/avr-protos.h (avr_out_extr, avr_out_extr_not): New. * config/avr/avr.cc (avr_out_extr, avr_out_extr_not): New funcs. (lshrqi3_out, lshrhi3_out, lshrpsi3_out, lshrsi3_out): Adjust MSB case to new insn constraint "r" for operands[1]. (avr_adjust_insn_length) [ADJUST_LEN_EXTR_NOT, ADJUST_LEN_EXTR]: Handle these cases. (avr_rtx_costs_1): Adjust cost for a new pattern. gcc/testsuite/ PR target/109907 * gcc.target/avr/pr109907.c: New test. * gcc.target/avr/torture/pr109907-1.c: New test. * gcc.target/avr/torture/pr109907-2.c: New test.
next prev parent reply other threads:[~2023-06-11 9:22 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-19 10:10 [Bug middle-end/109907] New: [avr] " gjl at gcc dot gnu.org 2023-05-19 14:14 ` [Bug middle-end/109907] " pinskia at gcc dot gnu.org 2023-05-19 15:42 ` [Bug middle-end/109907] " pinskia at gcc dot gnu.org 2023-05-19 15:45 ` pinskia at gcc dot gnu.org 2023-05-19 20:03 ` pinskia at gcc dot gnu.org 2023-05-19 20:12 ` pinskia at gcc dot gnu.org 2023-05-19 20:41 ` gjl at gcc dot gnu.org 2023-05-19 20:55 ` pinskia at gcc dot gnu.org 2023-05-19 20:59 ` gjl at gcc dot gnu.org 2023-05-20 0:46 ` pinskia at gcc dot gnu.org 2023-05-20 5:09 ` pinskia at gcc dot gnu.org 2023-05-20 7:36 ` gjl at gcc dot gnu.org 2023-05-20 7:50 ` gjl at gcc dot gnu.org 2023-05-20 22:23 ` pinskia at gcc dot gnu.org 2023-05-20 22:40 ` pinskia at gcc dot gnu.org 2023-05-21 5:15 ` pinskia at gcc dot gnu.org 2023-05-21 5:36 ` pinskia at gcc dot gnu.org 2023-05-21 9:09 ` gjl at gcc dot gnu.org 2023-05-21 9:55 ` gjl at gcc dot gnu.org 2023-05-23 9:58 ` gjl at gcc dot gnu.org 2023-05-26 8:49 ` gjl at gcc dot gnu.org 2023-05-26 11:14 ` gjl at gcc dot gnu.org 2023-05-26 15:21 ` pinskia at gcc dot gnu.org 2023-05-26 16:08 ` gjl at gcc dot gnu.org 2023-05-26 23:11 ` pinskia at gcc dot gnu.org 2023-05-26 23:34 ` pinskia at gcc dot gnu.org 2023-05-26 23:49 ` pinskia at gcc dot gnu.org 2023-05-27 0:36 ` pinskia at gcc dot gnu.org 2023-05-27 4:02 ` pinskia at gcc dot gnu.org 2023-05-27 20:09 ` pinskia at gcc dot gnu.org 2023-06-11 9:22 ` cvs-commit at gcc dot gnu.org [this message] 2023-06-11 9:26 ` gjl at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109907-4-nxn2WCwlm0@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).