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 middle-end/51867] New: GCC generates inconsistent code for same sources calling builtin calls, like sqrtf Date: Mon, 16 Jan 2012 10:15:00 -0000 [thread overview] Message-ID: <bug-51867-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51867 Bug #: 51867 Summary: GCC generates inconsistent code for same sources calling builtin calls, like sqrtf Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: trivial Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: amker.cheng@gmail.com compile following program: ---------------------------------------------- #include <math.h> int a(float x) { return sqrtf(x); } int b(float x) { return sqrtf(x); } With command: arm-none-eabi-gcc -mthumb -mhard-float -mfpu=fpv4-sp-d16 -mcpu=cortex-m4 -O0 -S a.c -o a.S The generated assembly codes is like: ---------------------------------------------- a: @ args = 0, pretend = 0, frame = 8 @ frame_needed = 1, uses_anonymous_args = 0 push {r7, lr} sub sp, sp, #8 add r7, sp, #0 fsts s0, [r7, #4] flds s15, [r7, #4] fsqrts s15, s15 fcmps s15, s15 fmstat beq .L2 flds s0, [r7, #4] bl sqrtf fcpys s15, s0 .L2: ftosizs s15, s15 fmrs r3, s15 @ int mov r0, r3 add r7, r7, #8 mov sp, r7 pop {r7, pc} .size a, .-a .align 2 .global b .thumb .thumb_func .type b, %function b: @ args = 0, pretend = 0, frame = 8 @ frame_needed = 1, uses_anonymous_args = 0 push {r7, lr} sub sp, sp, #8 add r7, sp, #0 fsts s0, [r7, #4] flds s0, [r7, #4] bl sqrtf fcpys s15, s0 ftosizs s15, s15 fmrs r3, s15 @ int mov r0, r3 add r7, r7, #8 mov sp, r7 pop {r7, pc} .size b, .-b The problem exists on trunk and triggered only by O0 optimization. The problem stands for x86 target too.
next reply other threads:[~2012-01-16 10:12 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-01-16 10:15 amker.cheng at gmail dot com [this message] 2012-01-16 10:19 ` [Bug middle-end/51867] " amker.cheng at gmail dot com 2012-01-16 14:45 ` rguenth at gcc dot gnu.org 2012-01-17 10:43 ` amker.cheng at gmail dot com 2012-02-09 9:38 ` amker at gcc dot gnu.org 2012-06-18 2:03 ` amker.cheng at gmail dot com 2022-01-06 3:42 ` pinskia at gcc dot gnu.org
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-51867-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).