public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amker.cheng at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/56102] New: Wrong rtx cost calculated for Thumb1
Date: Fri, 25 Jan 2013 03:40:00 -0000	[thread overview]
Message-ID: <bug-56102-4@http.gcc.gnu.org/bugzilla/> (raw)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56102

             Bug #: 56102
           Summary: Wrong rtx cost calculated for Thumb1
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amker.cheng@gmail.com


For below program:

double g = 1.0;
double func(int a, double d)
{
    if (a > 0)
    return 0.0 + g;
    else
    return 2.0 + d;
}

compiling with:
./arm-none-eabi-gcc -mthumb -mcpu=cortex-m0 -Os test.c -S -o test.S

The assembly code is:
    .cpu cortex-m0
    .fpu softvfp
    .eabi_attribute 20, 1
    .eabi_attribute 21, 1
    .eabi_attribute 23, 3
    .eabi_attribute 24, 1
    .eabi_attribute 25, 1
    .eabi_attribute 26, 1
    .eabi_attribute 30, 4
    .eabi_attribute 34, 0
    .eabi_attribute 18, 4
    .code    16
    .file    "main.c"
    .global    __aeabi_dadd
    .text
    .align    1
    .global    func
    .code    16
    .thumb_func
    .type    func, %function
func:
    push    {r3, lr}
    cmp    r0, #0
    ble    .L2
    ldr    r3, .L6+16
    ldr    r0, [r3]
    ldr    r1, [r3, #4]
    ldr    r3, .L6+4
    ldr    r2, .L6
    b    .L4
.L2:
    mov    r0, r2
    mov    r1, r3
    ldr    r2, .L6+8
    ldr    r3, .L6+12
.L4:
    bl    __aeabi_dadd
    @ sp needed
    pop    {r3, pc}
.L7:
    .align    3
.L6:
    .word    0
    .word    0
    .word    0
    .word    1073741824
    .word    .LANCHOR0
    .size    func, .-func
    .global    g
    .data
    .align    3
    .set    .LANCHOR0,. + 0
    .type    g, %object
    .size    g, 8
g:
    .word    0
    .word    1072693248
    .ident    "GCC: (GNU) 4.8.0 20130122 (experimental)"

The problem is double word constant isn't split by GCC, causing bigger code
size.


             reply	other threads:[~2013-01-25  3:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25  3:40 amker.cheng at gmail dot com [this message]
2013-01-25  3:47 ` [Bug target/56102] " amker.cheng at gmail dot com
2013-01-25  7:25 ` amker.cheng at gmail dot com
2013-08-05 19:35 ` ramana at gcc dot gnu.org
2013-08-07  2:03 ` amker.cheng 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-56102-4@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: link
Be 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).