public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fei.yang0953 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/63742] New: arm *movhi_insn_arch4 pattern may emit ldrh which is wrong for big-endian Date: Wed, 05 Nov 2014 06:49:00 -0000 [thread overview] Message-ID: <bug-63742-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63742 Bug ID: 63742 Summary: arm *movhi_insn_arch4 pattern may emit ldrh which is wrong for big-endian Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: fei.yang0953 at gmail dot com CC: ramana.radhakrishnan at arm dot com Host: x86_64-suse-linux Target: armeb-linux-gnueabi-gcc Build: x86_64-suse-linux Simple testcase (test.c): unsigned short v; int i; int j = 0; int *ptr = &j; unsigned short func() { for (i = 0; i < 1; ++i) { *ptr = -1; v = 0x1234; } return v; } Compile option: armeb-linux-gnueabi-gcc -S -O1 test.c Assembly code snippet: func: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 str lr, [sp, #-4]! movw r3, #:lower16:i movt r3, #:upper16:i mov r2, #0 str r2, [r3] movw r0, #:lower16:.LANCHOR0 movt r0, #:upper16:.LANCHOR0 mvn lr, #0 movw r1, #:lower16:v movt r1, #:upper16:v ldrh ip, .L5 @ movhi mov r2, r3 .L2: ldr r3, [r0] str lr, [r3] strh ip, [r1] @ movhi ldr r3, [r2] add r3, r3, #1 str r3, [r2] cmp r3, #0 ble .L2 movw r3, #:lower16:v movt r3, #:upper16:v ldrh r0, [r3] ldr pc, [sp], #4 .L6: .align 2 .L5: .word 4660 Issue under big-endian: The ldrh loads the wrong value as immediate 4660 is in big-endian form. GCC version: gcc version 5.0.0 20141026 (experimental)
next reply other threads:[~2014-11-05 6:49 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-05 6:49 fei.yang0953 at gmail dot com [this message] 2014-11-05 7:14 ` [Bug target/63742] " fei.yang0953 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-63742-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: 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).