public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "guihaoc at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/93453] PPC: rldimi not taken into account to avoid shift+or Date: Tue, 16 Nov 2021 02:58:51 +0000 [thread overview] Message-ID: <bug-93453-4-zn2vMs5Lzg@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-93453-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93453 --- Comment #4 from HaoChen Gui <guihaoc at gcc dot gnu.org> --- For the second issue, I drafted following insn_and_split pattern. It tries to combine the shift and ior when the nonzero_bits of operands[3] matches the condition. (define_insn_and_split "*rotl<mode>3_insert_8" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (plus_ior_xor:GPR (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:GPR 3 "gpc_reg_operand" "0")))] "INTVAL (operands[2]) > 0 && (nonzero_bits (operands[3], <MODE>mode) < HOST_WIDE_INT_1U << INTVAL (operands[2]))" { if (<MODE>mode == SImode) return "rlwimi %0,%1,%h2,0,31-%h2"; else return "rldimi %0,%1,%H2,0"; } "&& 1" [(set (match_dup 0) (ior:GPR (and:GPR (match_dup 3) (match_dup 4)) (ashift:GPR (match_dup 1) (match_dup 2))))] { operands[4] = GEN_INT ((HOST_WIDE_INT_1U << INTVAL (operands[2])) - 1); } [(set_attr "type" "insert")]) But I found that nonzero_bits can't return an exact value except in combine pass. So the pattern finally can't be split to pattern of 'rotl<mode>3_insert_3'. Also if the pass after combine changes the insn, it can't be recognized as the nonzero_bits doesn't return exact value in that pass. I am thinking if we can convert third operand to "reg and a mask" when the nonzero_bits is known in combine pass. Thus the pattern can be directly combined to 'rotl<mode>3_insert_3'. (set (reg:DI 123) (ior:DI (ashift:DI (reg:DI 125) (const_int 32 [0x20])) (reg:DI 126))) (set (reg:DI 123) (ior:DI (ashift:DI (reg:DI 125) (const_int 32 [0x20])) (and:DI (reg:DI 126) (const_int 4294967295 [0xfffffff]))))
next prev parent reply other threads:[~2021-11-16 2:58 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-93453-4@http.gcc.gnu.org/bugzilla/> 2021-11-09 2:38 ` guihaoc at gcc dot gnu.org 2021-11-09 11:56 ` segher at gcc dot gnu.org 2021-11-16 2:58 ` guihaoc at gcc dot gnu.org [this message] 2021-11-22 19:51 ` segher at gcc dot gnu.org 2021-11-23 2:46 ` guihaoc at gcc dot gnu.org 2021-11-23 19:44 ` segher at gcc dot gnu.org 2021-11-25 3:31 ` guihaoc at gcc dot gnu.org 2021-11-25 17:40 ` segher 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-93453-4-zn2vMs5Lzg@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).