public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/10242: ARM: peephole for effective use of plus and minus operators
@ 2003-03-27 14:56 Gábor Lóki
  0 siblings, 0 replies; 2+ messages in thread
From: Gábor Lóki @ 2003-03-27 14:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

The following reply was made to PR target/10242; it has been noted by GNATS.

From: =?ISO-8859-2?Q?G=E1bor_L=F3ki?= <alga@rgai.hu>
To: gcc-gnats@gcc.gnu.org,  gcc-bugs@gcc.gnu.org,  alga@rgai.hu, 
 nobody@gcc.gnu.org,  gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: target/10242: ARM: peephole for effective use of plus and minus
 operators
Date: Thu, 27 Mar 2003 15:45:45 +0100

 Sorry, I submited this PR with a wrong Synopsis!
 
 The correct Synopsis:    ARM: subsequent use of plus and minus operators 
 could be improved
 
 May I ask somebody to fix it for me, please?
 
 Regards,
     Gábor Lóki
 
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* target/10242: ARM: peephole for effective use of plus and minus operators
@ 2003-03-27 14:01 alga
  0 siblings, 0 replies; 2+ messages in thread
From: alga @ 2003-03-27 14:01 UTC (permalink / raw)
  To: gcc-gnats

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]


>Number:         10242
>Category:       target
>Synopsis:       ARM: peephole for effective use of plus and minus operators
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 27 13:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Gábor Lóki
>Release:        GCC: (GNU) 3.3 20030324 (prerelease)
>Organization:
>Environment:
BUILD & HOST: Linux 2.4.20 i686 unknown
TARGET: arm-unknown-elf
>Description:
In some cases the generated code contains (for arm target) a plus operator with positive constant which is followed by another plus operator with a negative constant and both operate on the same register (eg: "add rD, rB, #c0" and "sub rD, rD, #c1" ).
This makes an opportunity for effective use of these operators if c0+c1 can be stored in the Immediate Operand filed. Specifically, in this case "add rD, rB, #c2" where c2 = c0 + c1 and c2 >= 0, or "sub rD, rB, #c2" where c2 = -(c0 + c1) and c2 < 0.
This problem generally occurs when storing local variables on the stack.
The same can be applied for all four combinations of plus and minus operators.
In the example attached, in function foo there is a "sub r0,r0,#12" and "sub r0,r0,#4" which can be replaced by "sub r0,r0,#16".
>How-To-Repeat:
arm-elf-gcc -S -g0 -Os plus-minus.c

void func(char*);
void foo()
{
  char buf[1028];
  func(buf);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-compressed; name="plus-minus.tgz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="plus-minus.tgz"

H4sICIjTgj4AAHBsdXMtbWludXMudGFyAO1VwWrcMBDNVYL8w3RDYLfYRrZlb0goFHLIrT2UnkoJ
Wlt2DLJsJDs0Dfn3juQtu7SBHMpuIfED45mnsWY0+I16NdqwbfRoo+LkQGCM5ZzDc7xHzNgJW+ec
ZVmcpdzHrzm+D1XQPkY7CAN/F/dGcN81JVSjLpbFnTDvV1d0YrpuuaKPFMDRsBmrbzFLLr5fIeOj
kcHYJ/q/65/xb+h3+reHyvGS/vMk2+k/Z5P+1+tZ/0cAiapGSbLY+w+KBSXRIH8M+BKqqTVJ0KpV
txGK4GBwqw+9dGYA524aDE2nKbqXlHwEYWoLH4AF0Bs5SF1OTmVEK9F0Y8SFef9WS1lKFxEHMFpp
b4Xu9EPbjWht96Gk7e5J0wdge0rs0FYlsf27AB4r5ByvDOYqnnBx3JDf5BmffONyOx8Tbynr93qe
2vvKPWdx8geBARtsA56aElW2UviMvha3ga8jss3PbX+icOpYU0o9kMXN9fUlLG8+fV1BGqWQMJay
NOGwxF4ZqaSwcrU45lA1UuAhDpvjJf0zvtN/nPj7P8v5rP9jQJg2lKoK66KA8AuENYPws4X9cXA6
X/IzZrxO/AIEvCdTAA4AAA==


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-27 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 14:56 target/10242: ARM: peephole for effective use of plus and minus operators Gábor Lóki
  -- strict thread matches above, loose matches on Subject: below --
2003-03-27 14:01 alga

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).