From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15561 invoked by alias); 17 Dec 2013 12:25:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 15519 invoked by uid 48); 17 Dec 2013 12:25:52 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/53949] [SH] Add support for mac.w / mac.l instructions Date: Tue, 17 Dec 2013 12:25: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.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg01487.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53949 --- Comment #10 from Oleg Endo --- I was wondering whether it would make sense to convert sequences such as SH4 SH4A mov.l @r15,r3 LS/2 LS/2 mul.l r2,r3 CO/4 EX/3 sts macl,r3 CO/3 LS/2 add r1,r3 EX/1 EX/1 into mov r15,r0 MT/0 MT/1 mov.l r2,@-r15 LS/1 LS/1 lds r1,macl CO/3 LS/1 mac.l @r15+,@r0+ CO/4 CO/5 sts macl,r3 CO/3 LS/2 Looking simply at the issue cycles (the numbers above) would suggest that it's not worth doing it, at least not if the value has to be pulled out from the mac register immediately after the mac operation. Probably it's not beneficial to emit a single mac insn if the data is not already in place so that it can be reached easily with the post-inc addressing. On the other hand something like ... int test33 (int* x, int y, int z) { return x[0] * 40 + z; } currently compiles to: mov.l @r4,r2 mov #40,r1 mul.l r1,r2 sts macl,r0 rts add r6,r0 where this one maybe could be better: mova .L40,r0 lds r6,macl mac.l @r4+,r0+ rts sts macl,r0 .align 2 .L40: .long 40