public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch libgcc] Enable HCmode multiply and divide (mulhc3/divhc3)
@ 2016-09-07 17:03 James Greenhalgh
  2016-09-07 17:59 ` Joseph Myers
  2016-09-07 23:21 ` Bernd Schmidt
  0 siblings, 2 replies; 3+ messages in thread
From: James Greenhalgh @ 2016-09-07 17:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, ian

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


Hi,

This patch arranges for half-precision complex multiply and divide
routines to be built if __LIBGCC_HAS_HF_MODE__.  This will be true
if the target supports the _Float16 type.

OK?

Thanks,
James

---

libgcc/

2016-09-07  James Greenhalgh  <james.greenhalgh@arm.com>

	*  Makefile.in (lib2funcs): Build _mulhc3 and _divhc3.
	* libgcc2.h (LIBGCC_HAS_HF_MODE): Conditionally define.
	(HFtype): Likewise.
	(HCtype): Likewise.
	(__divhc3): Likewise.
	(__mulhc3): Likewise.
	* libgcc2.c: Support _mulhc3 and _divhc3.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Patch-libgcc-Enable-HCmode-multiply-and-divide-mulhc.patch --]
[-- Type: text/x-patch;  name=0001-Patch-libgcc-Enable-HCmode-multiply-and-divide-mulhc.patch, Size: 3816 bytes --]

diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index ba37c65..53e3ea2 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -414,8 +414,9 @@ lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2	   \
 	    _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2  \
 	    _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2	   \
 	    _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2	   \
-	    _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3	   \
-	    _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 _clrsbdi2
+	    _mulhc3 _mulsc3 _muldc3 _mulxc3 _multc3 _divhc3 _divsc3	   \
+	    _divdc3 _divxc3 _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2	   \
+	    _clrsbdi2
 
 # The floating-point conversion routines that involve a single-word integer.
 # XX stands for the integer mode.
diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c
index 0a716bf..ec3b21f 100644
--- a/libgcc/libgcc2.c
+++ b/libgcc/libgcc2.c
@@ -1852,7 +1852,8 @@ NAME (TYPE x, int m)
 
 #endif
 \f
-#if ((defined(L_mulsc3) || defined(L_divsc3)) && LIBGCC2_HAS_SF_MODE) \
+#if((defined(L_mulhc3) || defined(L_divhc3)) && LIBGCC2_HAS_HF_MODE) \
+    || ((defined(L_mulsc3) || defined(L_divsc3)) && LIBGCC2_HAS_SF_MODE) \
     || ((defined(L_muldc3) || defined(L_divdc3)) && LIBGCC2_HAS_DF_MODE) \
     || ((defined(L_mulxc3) || defined(L_divxc3)) && LIBGCC2_HAS_XF_MODE) \
     || ((defined(L_multc3) || defined(L_divtc3)) && LIBGCC2_HAS_TF_MODE)
@@ -1861,7 +1862,13 @@ NAME (TYPE x, int m)
 #undef double
 #undef long
 
-#if defined(L_mulsc3) || defined(L_divsc3)
+#if defined(L_mulhc3) || defined(L_divhc3)
+# define MTYPE	HFtype
+# define CTYPE	HCtype
+# define MODE	hc
+# define CEXT	__LIBGCC_HF_FUNC_EXT__
+# define NOTRUNC __LIBGCC_HF_EXCESS_PRECISION__
+#elif defined(L_mulsc3) || defined(L_divsc3)
 # define MTYPE	SFtype
 # define CTYPE	SCtype
 # define MODE	sc
@@ -1922,7 +1929,7 @@ extern void *compile_type_assert[sizeof(INFINITY) == sizeof(MTYPE) ? 1 : -1];
 # define TRUNC(x)	__asm__ ("" : "=m"(x) : "m"(x))
 #endif
 
-#if defined(L_mulsc3) || defined(L_muldc3) \
+#if defined(L_mulhc3) || defined(L_mulsc3) || defined(L_muldc3) \
     || defined(L_mulxc3) || defined(L_multc3)
 
 CTYPE
@@ -1992,7 +1999,7 @@ CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
 }
 #endif /* complex multiply */
 
-#if defined(L_divsc3) || defined(L_divdc3) \
+#if defined(L_divhc3) || defined(L_divsc3) || defined(L_divdc3) \
     || defined(L_divxc3) || defined(L_divtc3)
 
 CTYPE
diff --git a/libgcc/libgcc2.h b/libgcc/libgcc2.h
index 72bb873..c46fb77 100644
--- a/libgcc/libgcc2.h
+++ b/libgcc/libgcc2.h
@@ -34,6 +34,12 @@ extern void __clear_cache (char *, char *);
 extern void __eprintf (const char *, const char *, unsigned int, const char *)
   __attribute__ ((__noreturn__));
 
+#ifdef __LIBGCC_HAS_HF_MODE__
+#define LIBGCC2_HAS_HF_MODE 1
+#else
+#define LIBGCC2_HAS_HF_MODE 0
+#endif
+
 #ifdef __LIBGCC_HAS_SF_MODE__
 #define LIBGCC2_HAS_SF_MODE 1
 #else
@@ -133,6 +139,10 @@ typedef unsigned int UTItype	__attribute__ ((mode (TI)));
 #endif
 #endif
 
+#if LIBGCC2_HAS_HF_MODE
+typedef		float HFtype	__attribute__ ((mode (HF)));
+typedef _Complex float HCtype	__attribute__ ((mode (HC)));
+#endif
 #if LIBGCC2_HAS_SF_MODE
 typedef 	float SFtype	__attribute__ ((mode (SF)));
 typedef _Complex float SCtype	__attribute__ ((mode (SC)));
@@ -424,6 +434,10 @@ extern SItype __negvsi2 (SItype);
 #endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
 
 #undef int
+#if LIBGCC2_HAS_HF_MODE
+extern HCtype __divhc3 (HFtype, HFtype, HFtype, HFtype);
+extern HCtype __mulhc3 (HFtype, HFtype, HFtype, HFtype);
+#endif
 #if LIBGCC2_HAS_SF_MODE
 extern DWtype __fixsfdi (SFtype);
 extern SFtype __floatdisf (DWtype);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch libgcc] Enable HCmode multiply and divide (mulhc3/divhc3)
  2016-09-07 17:03 [Patch libgcc] Enable HCmode multiply and divide (mulhc3/divhc3) James Greenhalgh
@ 2016-09-07 17:59 ` Joseph Myers
  2016-09-07 23:21 ` Bernd Schmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Joseph Myers @ 2016-09-07 17:59 UTC (permalink / raw)
  To: James Greenhalgh; +Cc: gcc-patches, nd, ian

On Wed, 7 Sep 2016, James Greenhalgh wrote:

> 2016-09-07  James Greenhalgh  <james.greenhalgh@arm.com>
> 

I'd think this should say

	PR target/63250

as being part of fixing that bug (although not a fix by itself).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch libgcc] Enable HCmode multiply and divide (mulhc3/divhc3)
  2016-09-07 17:03 [Patch libgcc] Enable HCmode multiply and divide (mulhc3/divhc3) James Greenhalgh
  2016-09-07 17:59 ` Joseph Myers
@ 2016-09-07 23:21 ` Bernd Schmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Bernd Schmidt @ 2016-09-07 23:21 UTC (permalink / raw)
  To: James Greenhalgh, gcc-patches; +Cc: nd, ian

On 09/07/2016 06:05 PM, James Greenhalgh wrote:
>
> Hi,
>
> This patch arranges for half-precision complex multiply and divide
> routines to be built if __LIBGCC_HAS_HF_MODE__.  This will be true
> if the target supports the _Float16 type.
>
> OK?

Ok, but please see Joseph's patch from today: I think you probably want 
to invert the NOTRUNC case here as well.


Bernd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-07 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 17:03 [Patch libgcc] Enable HCmode multiply and divide (mulhc3/divhc3) James Greenhalgh
2016-09-07 17:59 ` Joseph Myers
2016-09-07 23:21 ` Bernd Schmidt

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).