public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org Subject: target/7374: __builtin_fabsl broken on alpha Date: Mon, 22 Jul 2002 09:26:00 -0000 [thread overview] Message-ID: <200207221617.g6MGHSf11484@karma.fnal.gov> (raw) >Number: 7374 >Category: target >Synopsis: __builtin_fabsl broken on alpha >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Jul 22 09:26:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: >Release: 3.2 20020718 (experimental) >Organization: >Environment: System: OSF1 d0ola.fnal.gov V5.1 732 alpha Machine: alpha host: alpha-dec-osf5.1 build: alpha-dec-osf5.1 target: alpha-dec-osf5.1 configured with: ../gcc/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long : (reconfigured) ../gcc/configure --prefix=/scratch/snyder/gcc/inst --enable-threads=posix --enable-long-long : (reconfigured) ../gcc/configure --prefix=/scratch/snyder/gcc/inst --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 >Description: On the alpha, the program below is miscompiled --- it prints -1 instead of 1: $ gcc -o x x.c $ ./x -1.000000 $ Here's the generated code for foo(). It looks to me like this code is negating the argument, rather than taking the absolute value. .ent foo $foo..ng: foo: .frame $15,16,$26,0 .mask 0x4008000,-16 lda $30,-16($30) stq $26,0($30) stq $15,8($30) bis $31,$30,$15 .prologue 0 bis $31,$16,$0 bis $31,$17,$1 ldq $2,0($1) ldq $3,8($1) lda $1,-1($31) sll $1,63,$1 xor $1,$3,$3 bis $31,$2,$1 bis $31,$3,$2 stq $1,0($0) stq $2,8($0) bis $31,$15,$30 ldq $26,0($30) ldq $15,8($30) lda $30,16($30) ret $31,($26),1 .end foo Indeed, in alpha.md, i find this: (define_expand "abstf2" [(parallel [(set (match_operand:TF 0 "register_operand" "") (neg:TF (match_operand:TF 1 "reg_or_0_operand" ""))) (use (match_dup 2))])] "TARGET_HAS_XFLOATING_LIBS" { #if HOST_BITS_PER_WIDE_INT >= 64 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63)); #else operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode)); #endif }) Note the `neg' here. If i change this to `abs' (patch below), then i get the correct results from this test program. >How-To-Repeat: ------------------------------------------------------------------------ long double foo (long double xx) { return __builtin_fabsl (xx); } int main() { long double xx = 1.0; long double yy = foo (xx); printf ("%f\n", (float) (yy)); return 0; } ------------------------------------------------------------------------ >Fix: 2002-07-22 scott snyder <snyder@fnal.gov> * config/alpha/alpha.md (abstf2): Fix typo: `neg' for `abs'. Index: config/alpha/alpha.md =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/alpha/alpha.md,v retrieving revision 1.194 diff -u -c -r1.194 alpha.md *** config/alpha/alpha.md 14 Jun 2002 20:26:23 -0000 1.194 --- config/alpha/alpha.md 22 Jul 2002 16:15:23 -0000 *************** *** 2134,2140 **** (define_expand "abstf2" [(parallel [(set (match_operand:TF 0 "register_operand" "") ! (neg:TF (match_operand:TF 1 "reg_or_0_operand" ""))) (use (match_dup 2))])] "TARGET_HAS_XFLOATING_LIBS" { --- 2134,2140 ---- (define_expand "abstf2" [(parallel [(set (match_operand:TF 0 "register_operand" "") ! (abs:TF (match_operand:TF 1 "reg_or_0_operand" ""))) (use (match_dup 2))])] "TARGET_HAS_XFLOATING_LIBS" { >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-07-22 16:26 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-07-22 9:26 snyder [this message] 2002-09-07 23:03 sayle
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=200207221617.g6MGHSf11484@karma.fnal.gov \ --to=snyder@fnal.gov \ --cc=gcc-gnats@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).