public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Fariborz Jahanian <fjahanian@apple.com>
To: gcc-patches@gcc.gnu.org
Cc: Fariborz Jahanian <fjahanian@apple.com>,
	Geoffrey Keating <geoffk@apple.com>
Subject: PATCH [mainline] Fix for long double (TARGET_LONG_DOUBLE_128) on ppc-darwin
Date: Sun, 25 Jul 2004 14:08:00 -0000	[thread overview]
Message-ID: <ECF25605-DDA1-11D8-85BB-000A2789A51E@apple.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3003 bytes --]

This is formal patch for an RFC I sent earlier.

Following test case fails with gcc3.5 on apple-ppc-darwin where 'long 
double' is 128 bits (TARGET_LONG_DOUBLE_128).

extern long double JUNK(long double ld);
long double xdivcl()
{
     return JUNK(0.0L);
}

Following pattern is generated to load 'long double' literal into two 
registers, using DImode:

(insn 8 26 27 0 (set (reg:DI 33 f1)
  (mem/u/c:DI (lo_sum:SI (reg:SI 2 r2)
  (const:SI (minus:SI (symbol_ref/u:SI ("*LC0") [flags 0x2])
  (symbol_ref:SI ("<pic base>"))))) [0 S8 A64])) 327 {*movdi_internal32} 
(nil)
  (nil))

...

(insn 9 27 10 0 (set (reg:DI 34 f2 [orig:33+8 ] [33])
  (mem/u/c:DI (lo_sum:SI (reg:SI 2 r2)
  (const:SI (minus:SI (symbol_ref/u:SI ("*LC0") [flags 0x2])
  (symbol_ref:SI ("<pic base>"))))) [0 S8 A64])) 327 {*movdi_internal32} 
(nil)
  (nil))

Above pattern is generated in routine rs6000_emit_move and rejected in 
legitimate_lo_sum_address_p(...).

Attached patch bootstrapped and dejagnu tested on
apple-ppc-darwin fixes the problem.

OK for FSF mainline?
- Thanks, Fariborz (fjahanian@apple.com)

ChangeLog:

2004-07-24  Fariborz Jahanian <fjahanian@apple.com>
         * config/rs6000/rs6000.c (legitimate_lo_sum_address_p):
         DImode is legit.  mode with lo_sum pic address and when
         long double is 128 bits.
         (rs6000_split_multireg_move): Added case of LO_SUM when
         register node is being obtained.

Patch:

Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.671
diff -c -p -r1.671 rs6000.c
*** rs6000.c    23 Jul 2004 04:35:17 -0000      1.671
--- rs6000.c    24 Jul 2004 18:32:19 -0000
*************** legitimate_lo_sum_address_p (enum machin
*** 3162,3168 ****
         if (GET_MODE_NUNITS (mode) != 1)
         return false;
         if (GET_MODE_BITSIZE (mode) > 32
!         && !(TARGET_HARD_FLOAT && TARGET_FPRS && mode == DFmode))
         return false;

         return CONSTANT_P (x);
--- 3162,3170 ----
         if (GET_MODE_NUNITS (mode) != 1)
         return false;
         if (GET_MODE_BITSIZE (mode) > 32
!           && !(TARGET_HARD_FLOAT && TARGET_FPRS
!                && (mode == DFmode ||
!                    (TARGET_LONG_DOUBLE_128 && mode == DImode))))
         return false;

         return CONSTANT_P (x);
*************** rs6000_split_multireg_move (rtx dst, rtx
*** 11077,11084 ****
              we have change that register last.  */

           breg = (GET_CODE (XEXP (src, 0)) == PLUS
                   ? XEXP (XEXP (src, 0), 0)
!                 : XEXP (src, 0));

           if (!REG_P (breg))
               abort();
--- 11079,11087 ----
              we have change that register last.  */

           breg = (GET_CODE (XEXP (src, 0)) == PLUS
+                 || GET_CODE (XEXP (src, 0)) == LO_SUM)
                   ? XEXP (XEXP (src, 0), 0)
!                 : XEXP (src, 0);

           if (!REG_P (breg))
               abort();


[-- Attachment #2: Type: text/enriched, Size: 3117 bytes --]

This is formal patch for an RFC I sent earlier.


<fontfamily><param>Courier</param><x-tad-bigger>Following test case
fails with gcc3.5 on apple-ppc-darwin where 'long double' is 128 bits
(TARGET_LONG_DOUBLE_128).


extern long double JUNK(long double ld);

long double xdivcl()

{

    return JUNK(0.0L);

}


Following pattern is generated to load 'long double' literal into two
registers, using DImode:


(insn 8 26 27 0 (set (reg:DI 33 f1)

 (mem/u/c:DI (lo_sum:SI (reg:SI 2 r2)

 (const:SI (minus:SI (symbol_ref/u:SI ("*LC0") [flags 0x2])

 (symbol_ref:SI ("<<pic base>"))))) [0 S8 A64])) 327
{*movdi_internal32} (nil)

 (nil))


...


(insn 9 27 10 0 (set (reg:DI 34 f2 [orig:33+8 ] [33])

 (mem/u/c:DI (lo_sum:SI (reg:SI 2 r2)

 (const:SI (minus:SI (symbol_ref/u:SI ("*LC0") [flags 0x2])

 (symbol_ref:SI ("<<pic base>"))))) [0 S8 A64])) 327
{*movdi_internal32} (nil)

 (nil))


Above pattern is generated in routine rs6000_emit_move and rejected in
legitimate_lo_sum_address_p(...).


Attached patch bootstrapped and dejagnu tested on 

apple-ppc-darwin fixes the problem.


OK for FSF mainline?

- Thanks, Fariborz (fjahanian@apple.com)


ChangeLog:


2004-07-24  Fariborz Jahanian <<fjahanian@apple.com>

        * config/rs6000/rs6000.c (legitimate_lo_sum_address_p):

        DImode is legit.  mode with lo_sum pic address and when

        long double is 128 bits.

        (rs6000_split_multireg_move): Added case of LO_SUM when

        register node is being obtained.


Patch:


Index: rs6000.c

===================================================================

RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v

retrieving revision 1.671

diff -c -p -r1.671 rs6000.c

*** rs6000.c    23 Jul 2004 04:35:17 -0000      1.671

--- rs6000.c    24 Jul 2004 18:32:19 -0000

*************** legitimate_lo_sum_address_p (enum machin

*** 3162,3168 ****

        if (GET_MODE_NUNITS (mode) != 1)

        return false;

        if (GET_MODE_BITSIZE (mode) > 32

!         && !(TARGET_HARD_FLOAT && TARGET_FPRS && mode == DFmode))

        return false;


        return CONSTANT_P (x);

--- 3162,3170 ----

        if (GET_MODE_NUNITS (mode) != 1)

        return false;

        if (GET_MODE_BITSIZE (mode) > 32

!           && !(TARGET_HARD_FLOAT && TARGET_FPRS

!                && (mode == DFmode ||

!                    (TARGET_LONG_DOUBLE_128 && mode == DImode))))

        return false;


        return CONSTANT_P (x);

*************** rs6000_split_multireg_move (rtx dst, rtx

*** 11077,11084 ****

             we have change that register last.  */


          breg = (GET_CODE (XEXP (src, 0)) == PLUS

                  ? XEXP (XEXP (src, 0), 0)

!                 : XEXP (src, 0));


          if (!REG_P (breg))

              abort();

--- 11079,11087 ----

             we have change that register last.  */


          breg = (GET_CODE (XEXP (src, 0)) == PLUS

+                 || GET_CODE (XEXP (src, 0)) == LO_SUM)

                  ? XEXP (XEXP (src, 0), 0)

!                 : XEXP (src, 0);


          if (!REG_P (breg))

              abort();

</x-tad-bigger></fontfamily>


             reply	other threads:[~2004-07-24 18:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-25 14:08 Fariborz Jahanian [this message]
2004-07-31 19:24 ` Geoffrey Keating

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=ECF25605-DDA1-11D8-85BB-000A2789A51E@apple.com \
    --to=fjahanian@apple.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=geoffk@apple.com \
    /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).