From: "Andreas Geißler" <setjem@googlemail.com>
To: gcc-help@gcc.gnu.org
Subject: pr26180.c
Date: Wed, 14 Nov 2012 13:37:00 -0000 [thread overview]
Message-ID: <CAF-06ZXmZ0uZxrghNRghRxnTAbYQDNirdb1CRqkz9LbERuzixA@mail.gmail.com> (raw)
Hi.
I need your help again. I wrote my own backend for the gcc-4.6.2 and
it works nearly perfectly. But there is a problem with the test case
pr26180.c.
In this special case the register (r8), which is used for the
comparison, is not loaded. And i don't get why.
C-Code (pr26180.c):
...
x2 = ((x > 0)? (x): -(x));
...
Wrong translated assembler code:
...
;x > 0?
cmpi.l r8,-2147483648 <- r8 is not used in the hole function
and so it is not initialized with x
jmp C,_L2
xori.l r8,-1
addi.l r8,1
_L2:
...
If i only change the comparison integer from 0 to 1 all works fine:
C-Code:
...
x2 = (x > 1 ? x : (-x));
...
Translated assembler code:
...
;load r8
mov.l r8,fp
addi.l r8,4
mov.l r9,r8
ldr.l r8,r9
;x > 1?
cmpi.l r8,-1
jmpn N,_L2
;x2 = -x
mov.l r8,fp
addi.l r8,4
mov.l r9,r8
ldr.l r8,r9
xori.l r8,-1
addi.l r8,1
jmp T,_L3
_L2:
;x2 = x
mov.l r8,fp
addi.l r8,4
mov.l r9,r8
ldr.l r8,r9
_L3:
...
So i you would like to ask you, which special pattern (machine
description pattern (*.md))
is related to "x2 = ((x > 0)? (x): -(x));" or where should i search the problem.
next reply other threads:[~2012-11-14 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 13:37 Andreas Geißler [this message]
2012-11-14 14:54 ` pr26180.c Ian Lance Taylor
2012-11-14 15:06 ` pr26180.c Andreas Geißler
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=CAF-06ZXmZ0uZxrghNRghRxnTAbYQDNirdb1CRqkz9LbERuzixA@mail.gmail.com \
--to=setjem@googlemail.com \
--cc=gcc-help@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).