* MIPS PATCH: additional mips16 hard float library support
@ 2007-08-01 2:37 Sandra Loosemore
2007-08-01 5:26 ` Richard Sandiford
0 siblings, 1 reply; 3+ messages in thread
From: Sandra Loosemore @ 2007-08-01 2:37 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 194 bytes --]
This patch adds mips16 library support for unordered float/double comparisons
and conversions to float/double from unsigned. Tests clean on both mips32r2 and
mips64. OK to commit?
-Sandra
[-- Attachment #2: 23-mips16-float.log --]
[-- Type: text/x-log, Size: 458 bytes --]
2007-07-31 Sandra Loosemore <sandra@codesourcery.com>
David Ung <davidu@mips.com>
gcc/
* config/mips/mips16.S (__mips16_unordsf2, __mips16_floatunsisf): New.
(__mips16_unorddf2, __mips16_floatunsidf): New.
* config/mips/mips.c (mips_init_libfuncs): Add optab entries for
above functions.
* config/mips/t-elf (LIB1ASMFUNCS): Add new functions.
* config/mips/t-isa3264 (LIB1ASMFUNCS): Likewise.
* config/mips/t-r3900 (LIB1ASMFUNCS): Likewise.
[-- Attachment #3: 23-mips16-float.patch --]
[-- Type: text/x-patch, Size: 7292 bytes --]
Index: gcc/config/mips/mips16.S
===================================================================
*** gcc/config/mips/mips16.S (revision 127069)
--- gcc/config/mips/mips16.S (working copy)
*************** CMPSF (__mips16_lesf2, c.le.s, 0, 1)
*** 286,291 ****
--- 286,295 ----
#ifdef L_m16ltsf2
CMPSF (__mips16_ltsf2, c.lt.s, -1, 0)
#endif
+ #ifdef L_m16unordsf2
+ CMPSF(__mips16_unordsf2, c.un.s, 1, 0)
+ #endif
+
/* Single-precision conversions. */
*************** STARTFN (__mips16_floatsisf)
*** 297,302 ****
--- 301,321 ----
ENDFN (__mips16_floatsisf)
#endif
+ #ifdef L_m16fltunsisf
+ STARTFN (__mips16_floatunsisf)
+ bltz $4,1f
+ j __mips16_floatsisf
+ 1:
+ and $2,$4,1
+ srl $3,$4,1
+ or $2,$2,$3
+ mtc1 $2,RET
+ cvt.s.w RET,RET
+ add.s RET,RET,RET
+ MOVE_SF_RET (f, $31)
+ ENDFN (__mips16_floatunsisf)
+ #endif
+
#ifdef L_m16fix_truncsfsi
STARTFN (__mips16_fix_truncsfsi)
MOVE_SF_BYTE0 (t)
*************** CMPDF (__mips16_ledf2, c.le.d, 0, 1)
*** 420,425 ****
--- 439,447 ----
#ifdef L_m16ltdf2
CMPDF (__mips16_ltdf2, c.lt.d, -1, 0)
#endif
+ #ifdef L_m16unorddf2
+ CMPDF(__mips16_unorddf2, c.un.d, 1, 0)
+ #endif
/* Double-precision conversions. */
*************** STARTFN (__mips16_floatsidf)
*** 430,436 ****
MOVE_DF_RET (f, $31)
ENDFN (__mips16_floatsidf)
#endif
!
#ifdef L_m16fix_truncdfsi
STARTFN (__mips16_fix_truncdfsi)
MOVE_DF_BYTE0 (t)
--- 452,469 ----
MOVE_DF_RET (f, $31)
ENDFN (__mips16_floatsidf)
#endif
!
! #ifdef L_m16fltunsidf
! STARTFN (__mips16_floatunsidf)
! MOVE_SI_BYTE0 (t)
! cvt.d.w RET,ARG1
! bgez $4,1f
! li.d ARG1, 4.294967296e+9
! add.d RET, RET, ARG1
! 1: MOVE_DF_RET (f, $31)
! ENDFN (__mips16_floatunsidf)
! #endif
!
#ifdef L_m16fix_truncdfsi
STARTFN (__mips16_fix_truncdfsi)
MOVE_DF_BYTE0 (t)
Index: gcc/config/mips/mips.c
===================================================================
*** gcc/config/mips/mips.c (revision 127069)
--- gcc/config/mips/mips.c (working copy)
*************** mips_init_libfuncs (void)
*** 10115,10123 ****
--- 10115,10125 ----
set_optab_libfunc (ge_optab, SFmode, "__mips16_gesf2");
set_optab_libfunc (lt_optab, SFmode, "__mips16_ltsf2");
set_optab_libfunc (le_optab, SFmode, "__mips16_lesf2");
+ set_optab_libfunc (unord_optab, SFmode, "__mips16_unordsf2");
set_conv_libfunc (sfix_optab, SImode, SFmode, "__mips16_fix_truncsfsi");
set_conv_libfunc (sfloat_optab, SFmode, SImode, "__mips16_floatsisf");
+ set_conv_libfunc (ufloat_optab, SFmode, SImode, "__mips16_floatunsisf");
if (TARGET_DOUBLE_FLOAT)
{
*************** mips_init_libfuncs (void)
*** 10132,10143 ****
--- 10134,10147 ----
set_optab_libfunc (ge_optab, DFmode, "__mips16_gedf2");
set_optab_libfunc (lt_optab, DFmode, "__mips16_ltdf2");
set_optab_libfunc (le_optab, DFmode, "__mips16_ledf2");
+ set_optab_libfunc (unord_optab, DFmode, "__mips16_unorddf2");
set_conv_libfunc (sext_optab, DFmode, SFmode, "__mips16_extendsfdf2");
set_conv_libfunc (trunc_optab, SFmode, DFmode, "__mips16_truncdfsf2");
set_conv_libfunc (sfix_optab, SImode, DFmode, "__mips16_fix_truncdfsi");
set_conv_libfunc (sfloat_optab, DFmode, SImode, "__mips16_floatsidf");
+ set_conv_libfunc (ufloat_optab, DFmode, SImode, "__mips16_floatunsidf");
}
}
else
Index: gcc/config/mips/t-elf
===================================================================
*** gcc/config/mips/t-elf (revision 127069)
--- gcc/config/mips/t-elf (working copy)
*************** $(T)crtn.o: $(srcdir)/config/mips/crtn.a
*** 13,23 ****
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16fltsisf _m16fix_truncsfsi \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16fltsidf _m16fix_truncdfsi \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
--- 13,25 ----
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16unordsf2 \
! _m16fltsisf _m16fix_truncsfsi _m16fltunsisf \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16unorddf2 \
! _m16fltsidf _m16fix_truncdfsi _m16fltunsidf \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
Index: gcc/config/mips/t-isa3264
===================================================================
*** gcc/config/mips/t-isa3264 (revision 127069)
--- gcc/config/mips/t-isa3264 (working copy)
*************** $(T)crtn.o: $(srcdir)/config/mips/crtn.a
*** 13,23 ****
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16fltsisf _m16fix_truncsfsi \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16fltsidf _m16fix_truncdfsi \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
--- 13,25 ----
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16unordsf2 \
! _m16fltsisf _m16fix_truncsfsi _m16fltunsisf \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16unorddf2 \
! _m16fltsidf _m16fix_truncdfsi _m16fltunsidf \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
Index: gcc/config/mips/t-r3900
===================================================================
*** gcc/config/mips/t-r3900 (revision 127069)
--- gcc/config/mips/t-r3900 (working copy)
***************
*** 1,11 ****
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16fltsisf _m16fix_truncsfsi \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16fltsidf _m16fix_truncdfsi \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
--- 1,13 ----
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16unordsf2 \
! _m16fltsisf _m16fix_truncsfsi _m16fltunsisf \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16unorddf2 \
! _m16fltsidf _m16fix_truncdfsi _m16fltunsidf \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: MIPS PATCH: additional mips16 hard float library support
2007-08-01 2:37 MIPS PATCH: additional mips16 hard float library support Sandra Loosemore
@ 2007-08-01 5:26 ` Richard Sandiford
2007-08-01 16:29 ` Sandra Loosemore
0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2007-08-01 5:26 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: GCC Patches
Sandra Loosemore <sandra@codesourcery.com> writes:
> This patch adds mips16 library support for unordered float/double
> comparisons and conversions to float/double from unsigned.
In case anyone's wondering, this library support is just an optimisation
rather than new functionality. The default libgcc implementation is far
less efficient, since it uses mips16 calls to non-mips16 hard-float
functions.
> 2007-07-31 Sandra Loosemore <sandra@codesourcery.com>
> David Ung <davidu@mips.com>
>
> gcc/
> * config/mips/mips16.S (__mips16_unordsf2, __mips16_floatunsisf): New.
> (__mips16_unorddf2, __mips16_floatunsidf): New.
> * config/mips/mips.c (mips_init_libfuncs): Add optab entries for
> above functions.
> * config/mips/t-elf (LIB1ASMFUNCS): Add new functions.
> * config/mips/t-isa3264 (LIB1ASMFUNCS): Likewise.
> * config/mips/t-r3900 (LIB1ASMFUNCS): Likewise.
OK, thanks.
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: MIPS PATCH: additional mips16 hard float library support
2007-08-01 5:26 ` Richard Sandiford
@ 2007-08-01 16:29 ` Sandra Loosemore
0 siblings, 0 replies; 3+ messages in thread
From: Sandra Loosemore @ 2007-08-01 16:29 UTC (permalink / raw)
To: GCC Patches, richard
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
Richard Sandiford wrote:
> Sandra Loosemore <sandra@codesourcery.com> writes:
>> This patch adds mips16 library support for unordered float/double
>> comparisons and conversions to float/double from unsigned.
>
> In case anyone's wondering, this library support is just an optimisation
> rather than new functionality. The default libgcc implementation is far
> less efficient, since it uses mips16 calls to non-mips16 hard-float
> functions.
Yes, sorry for not making that more clear. :-P
> OK, thanks.
I had to tweak the patch a bit for the recent MIPS makefile changes. Here's the
final version I committed.
-Sandra
[-- Attachment #2: 23-mips16-float.log --]
[-- Type: text/x-log, Size: 368 bytes --]
2007-08-01 Sandra Loosemore <sandra@codesourcery.com>
David Ung <davidu@mips.com>
gcc/
* config/mips/mips16.S (__mips16_unordsf2, __mips16_floatunsisf): New.
(__mips16_unorddf2, __mips16_floatunsidf): New.
* config/mips/mips.c (mips_init_libfuncs): Add optab entries for
above functions.
* config/mips/t-libgcc-mips16 (LIB1ASMFUNCS): Add new functions.
[-- Attachment #3: 23-mips16-float.patch --]
[-- Type: text/x-patch, Size: 4690 bytes --]
Index: gcc/config/mips/t-libgcc-mips16
===================================================================
*** gcc/config/mips/t-libgcc-mips16 (revision 127126)
--- gcc/config/mips/t-libgcc-mips16 (working copy)
***************
*** 1,11 ****
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16fltsisf _m16fix_truncsfsi \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16fltsidf _m16fix_truncdfsi \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
--- 1,13 ----
LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
! _m16unordsf2 \
! _m16fltsisf _m16fix_truncsfsi _m16fltunsisf \
_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
_m16extsfdf2 _m16trdfsf2 \
_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
! _m16unorddf2 \
! _m16fltsidf _m16fix_truncdfsi _m16fltunsidf \
_m16retsf _m16retdf \
_m16retsc _m16retdc \
_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
Index: gcc/config/mips/mips16.S
===================================================================
*** gcc/config/mips/mips16.S (revision 127126)
--- gcc/config/mips/mips16.S (working copy)
*************** CMPSF (__mips16_lesf2, c.le.s, 0, 1)
*** 286,291 ****
--- 286,295 ----
#ifdef L_m16ltsf2
CMPSF (__mips16_ltsf2, c.lt.s, -1, 0)
#endif
+ #ifdef L_m16unordsf2
+ CMPSF(__mips16_unordsf2, c.un.s, 1, 0)
+ #endif
+
/* Single-precision conversions. */
*************** STARTFN (__mips16_floatsisf)
*** 297,302 ****
--- 301,321 ----
ENDFN (__mips16_floatsisf)
#endif
+ #ifdef L_m16fltunsisf
+ STARTFN (__mips16_floatunsisf)
+ bltz $4,1f
+ j __mips16_floatsisf
+ 1:
+ and $2,$4,1
+ srl $3,$4,1
+ or $2,$2,$3
+ mtc1 $2,RET
+ cvt.s.w RET,RET
+ add.s RET,RET,RET
+ MOVE_SF_RET (f, $31)
+ ENDFN (__mips16_floatunsisf)
+ #endif
+
#ifdef L_m16fix_truncsfsi
STARTFN (__mips16_fix_truncsfsi)
MOVE_SF_BYTE0 (t)
*************** CMPDF (__mips16_ledf2, c.le.d, 0, 1)
*** 420,425 ****
--- 439,447 ----
#ifdef L_m16ltdf2
CMPDF (__mips16_ltdf2, c.lt.d, -1, 0)
#endif
+ #ifdef L_m16unorddf2
+ CMPDF(__mips16_unorddf2, c.un.d, 1, 0)
+ #endif
/* Double-precision conversions. */
*************** STARTFN (__mips16_floatsidf)
*** 430,436 ****
MOVE_DF_RET (f, $31)
ENDFN (__mips16_floatsidf)
#endif
!
#ifdef L_m16fix_truncdfsi
STARTFN (__mips16_fix_truncdfsi)
MOVE_DF_BYTE0 (t)
--- 452,469 ----
MOVE_DF_RET (f, $31)
ENDFN (__mips16_floatsidf)
#endif
!
! #ifdef L_m16fltunsidf
! STARTFN (__mips16_floatunsidf)
! MOVE_SI_BYTE0 (t)
! cvt.d.w RET,ARG1
! bgez $4,1f
! li.d ARG1, 4.294967296e+9
! add.d RET, RET, ARG1
! 1: MOVE_DF_RET (f, $31)
! ENDFN (__mips16_floatunsidf)
! #endif
!
#ifdef L_m16fix_truncdfsi
STARTFN (__mips16_fix_truncdfsi)
MOVE_DF_BYTE0 (t)
Index: gcc/config/mips/mips.c
===================================================================
*** gcc/config/mips/mips.c (revision 127126)
--- gcc/config/mips/mips.c (working copy)
*************** mips_init_libfuncs (void)
*** 10115,10123 ****
--- 10115,10125 ----
set_optab_libfunc (ge_optab, SFmode, "__mips16_gesf2");
set_optab_libfunc (lt_optab, SFmode, "__mips16_ltsf2");
set_optab_libfunc (le_optab, SFmode, "__mips16_lesf2");
+ set_optab_libfunc (unord_optab, SFmode, "__mips16_unordsf2");
set_conv_libfunc (sfix_optab, SImode, SFmode, "__mips16_fix_truncsfsi");
set_conv_libfunc (sfloat_optab, SFmode, SImode, "__mips16_floatsisf");
+ set_conv_libfunc (ufloat_optab, SFmode, SImode, "__mips16_floatunsisf");
if (TARGET_DOUBLE_FLOAT)
{
*************** mips_init_libfuncs (void)
*** 10132,10143 ****
--- 10134,10147 ----
set_optab_libfunc (ge_optab, DFmode, "__mips16_gedf2");
set_optab_libfunc (lt_optab, DFmode, "__mips16_ltdf2");
set_optab_libfunc (le_optab, DFmode, "__mips16_ledf2");
+ set_optab_libfunc (unord_optab, DFmode, "__mips16_unorddf2");
set_conv_libfunc (sext_optab, DFmode, SFmode, "__mips16_extendsfdf2");
set_conv_libfunc (trunc_optab, SFmode, DFmode, "__mips16_truncdfsf2");
set_conv_libfunc (sfix_optab, SImode, DFmode, "__mips16_fix_truncdfsi");
set_conv_libfunc (sfloat_optab, DFmode, SImode, "__mips16_floatsidf");
+ set_conv_libfunc (ufloat_optab, DFmode, SImode, "__mips16_floatunsidf");
}
}
else
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-01 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-01 2:37 MIPS PATCH: additional mips16 hard float library support Sandra Loosemore
2007-08-01 5:26 ` Richard Sandiford
2007-08-01 16:29 ` Sandra Loosemore
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).