public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67317] [x86] Silly code generation for _addcarry_u32/_addcarry_u64 Date: Tue, 25 Aug 2015 16:48:00 -0000 [thread overview] Message-ID: <bug-67317-4-ujfSP87XkR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-67317-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67317 --- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Segher Boessenkool from comment #3) > Does this need to be an unspec at all? Of course not. We are looking to replace unspecs with standard RTXes. Do you have any recommendation on how we can represent this carry-setting insn to satisfy combine? >From gcc-bugs-return-495631-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 25 17:33:31 2015 Return-Path: <gcc-bugs-return-495631-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 9716 invoked by alias); 25 Aug 2015 17:33:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 9672 invoked by uid 48); 25 Aug 2015 17:33:27 -0000 From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67351] Missed optimisation on 64-bit field compared to 32-bit Date: Tue, 25 Aug 2015 17:33: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: 5.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: cc Message-ID: <bug-67351-4-I4go9XcoD2@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-67351-4@http.gcc.gnu.org/bugzilla/> References: <bug-67351-4@http.gcc.gnu.org/bugzilla/> 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-SW-Source: 2015-08/txt/msg01773.txt.bz2 Content-length: 2221 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67351 Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org, | |ubizjak at gmail dot com --- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Uroš Bizjak from comment #2) > (In reply to Allan Jensen from comment #0) > > > Gcc will expand and detect field setting on 32-bit integers, but for some > > reason miss the opportunity on 64-bit. > > The immediates for 64bit logic insns are limited to sign-extended 32bit > values, so this probably limits combine to combine several insns into one. One example is: (insn 8 6 9 2 (parallel [ (set (reg:DI 100) (lshiftrt:DI (reg/v:DI 98 [ a ]) (const_int 48 [0x30]))) (clobber (reg:CC 17 flags)) ]) test.cpp:63 538 {*lshrdi3_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (nil))) (insn 9 8 10 2 (parallel [ (set (reg:DI 101) (ashift:DI (reg:DI 100) (const_int 48 [0x30]))) (clobber (reg:CC 17 flags)) ]) test.cpp:63 504 {*ashldi3_1} (expr_list:REG_DEAD (reg:DI 100) (expr_list:REG_UNUSED (reg:CC 17 flags) (nil)))) combine tries to: Trying 8 -> 9: Failed to match this instruction: (parallel [ (set (reg:DI 101) (and:DI (reg/v:DI 98 [ a ]) (const_int -281474976710656 [0xffff000000000000]))) (clobber (reg:CC 17 flags)) ]) However, tree optimizers pass to expand the following sequence: a = giveMe64 (); a$rgba_5 = MEM[(struct MyRgba64 *)&a]; _6 = a$rgba_5 >> 16; _7 = a$rgba_5 >> 48; _8 = _7 << 48; _10 = _6 << 16; _11 = _10 & 4294967295; _13 = a$rgba_5 & 65535; _15 = _13 | 264913582817280; _16 = _8 | _15; _14 = _11 | _16; MEM[(struct MyRgba64 *)&D.2451] = _14; return D.2451; Richi, can these shifts be converted to equivalent masking in tree optimizers? >From gcc-bugs-return-495632-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 25 17:41:41 2015 Return-Path: <gcc-bugs-return-495632-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 58479 invoked by alias); 25 Aug 2015 17:41:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 58441 invoked by uid 48); 25 Aug 2015 17:41:37 -0000 From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67351] Missed optimisation on 64-bit field compared to 32-bit Date: Tue, 25 Aug 2015 17:41: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: 5.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: <bug-67351-4-8dxuiMJJrZ@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-67351-4@http.gcc.gnu.org/bugzilla/> References: <bug-67351-4@http.gcc.gnu.org/bugzilla/> 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-SW-Source: 2015-08/txt/msg01774.txt.bz2 Content-length: 2225 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67351 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Uroš Bizjak from comment #3) > (In reply to Uroš Bizjak from comment #2) > > (In reply to Allan Jensen from comment #0) > > > > > Gcc will expand and detect field setting on 32-bit integers, but for some > > > reason miss the opportunity on 64-bit. > > > > The immediates for 64bit logic insns are limited to sign-extended 32bit > > values, so this probably limits combine to combine several insns into one. > > One example is: > > (insn 8 6 9 2 (parallel [ > (set (reg:DI 100) > (lshiftrt:DI (reg/v:DI 98 [ a ]) > (const_int 48 [0x30]))) > (clobber (reg:CC 17 flags)) > ]) test.cpp:63 538 {*lshrdi3_1} > (expr_list:REG_UNUSED (reg:CC 17 flags) > (nil))) > (insn 9 8 10 2 (parallel [ > (set (reg:DI 101) > (ashift:DI (reg:DI 100) > (const_int 48 [0x30]))) > (clobber (reg:CC 17 flags)) > ]) test.cpp:63 504 {*ashldi3_1} > (expr_list:REG_DEAD (reg:DI 100) > (expr_list:REG_UNUSED (reg:CC 17 flags) > (nil)))) > > combine tries to: > > Trying 8 -> 9: > Failed to match this instruction: > (parallel [ > (set (reg:DI 101) > (and:DI (reg/v:DI 98 [ a ]) > (const_int -281474976710656 [0xffff000000000000]))) > (clobber (reg:CC 17 flags)) > ]) > > However, tree optimizers pass to expand the following sequence: > > a = giveMe64 (); > a$rgba_5 = MEM[(struct MyRgba64 *)&a]; > _6 = a$rgba_5 >> 16; > _7 = a$rgba_5 >> 48; > _8 = _7 << 48; > _10 = _6 << 16; > _11 = _10 & 4294967295; > _13 = a$rgba_5 & 65535; > _15 = _13 | 264913582817280; > _16 = _8 | _15; > _14 = _11 | _16; > MEM[(struct MyRgba64 *)&D.2451] = _14; > return D.2451; > > Richi, can these shifts be converted to equivalent masking in tree > optimizers? They should be or at least Naveen's patches should handle them. There is an open bug filed doing a >> N << N and one filed for a << N >> N already (I filed it). >From gcc-bugs-return-495633-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 25 18:03:25 2015 Return-Path: <gcc-bugs-return-495633-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 7311 invoked by alias); 25 Aug 2015 18:03:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 7216 invoked by uid 48); 25 Aug 2015 18:03:16 -0000 From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67351] Missed optimisation on 64-bit field compared to 32-bit Date: Tue, 25 Aug 2015 18:03: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: 5.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: <bug-67351-4-rtjPKYl8dd@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-67351-4@http.gcc.gnu.org/bugzilla/> References: <bug-67351-4@http.gcc.gnu.org/bugzilla/> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg01775.txt.bz2 Content-length: 263 https://gcc.gnu.org/bugzilla/show_bug.cgi?idg351 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Oh his patch only handled multiplies/divide and not shifts. But it should be easy to add them to match.pd to simplify this at the tree level.
next prev parent reply other threads:[~2015-08-25 16:48 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-08-22 4:59 [Bug inline-asm/67317] New: " myriachan at gmail dot com 2015-08-22 6:14 ` [Bug inline-asm/67317] " pinskia at gcc dot gnu.org 2015-08-25 8:24 ` rguenth at gcc dot gnu.org 2015-08-25 11:10 ` [Bug target/67317] " glisse at gcc dot gnu.org 2015-08-25 12:58 ` segher at gcc dot gnu.org 2015-08-25 16:48 ` ubizjak at gmail dot com [this message] 2015-08-25 19:26 ` segher at gcc dot gnu.org 2015-08-27 8:53 ` ubizjak at gmail dot com 2015-08-27 18:30 ` uros at gcc dot gnu.org 2015-09-02 15:07 ` uros at gcc dot gnu.org 2015-09-02 15:08 ` ubizjak at gmail dot com
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-67317-4-ujfSP87XkR@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).