This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [wide-int] Add fast path for hosts with HWI widening multiplication
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: <ramrad01 at arm dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, <zadeck at naturalbridge dot com>, Mike Stump <mikestump at comcast dot net>, Richard Henderson <rth at redhat dot com>
- Date: Thu, 08 May 2014 19:31:17 +0100
- Subject: Re: [wide-int] Add fast path for hosts with HWI widening multiplication
- Authentication-results: sourceware.org; auth=none
- References: <8761r8kgph dot fsf at talisman dot default> <871u1sdbb6 dot fsf at talisman dot default> <CAJA7tRa8sMQbg==u8srmfRGKpbjA2+cF5c466xAHvpjZB+8_4w at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1405081636260 dot 4990 at digraph dot polyomino dot org dot uk>
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Thu, 8 May 2014, Ramana Radhakrishnan wrote:
>
>> <DATE> Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
>>
>> * wide-int.cc (UTItype): Define.
>> (UDWtype): Define for appropriate W_TYPE_SIZE.
>
> This breaks builds for 32-bit hosts, where TImode isn't supported. You
> can only use TImode on the host if it's 64-bit.
>
> wide-int.cc:37:56: error: unable to emulate 'TI'
The longlong.h interface seems to be designed to be as difficult to use
as possible :-( So maybe we really do need to limit it to hosts that are
known to work and benefit from it.
How about the following? I tested that it produces identical
wide-int.o .text for x86_64.
I think additions to or removals from the list should be treated as
pre-approved.
Thanks,
Richard
gcc/
* wide-int.cc: Only include longlong.h for certain targets.
Index: gcc/wide-int.cc
===================================================================
--- gcc/wide-int.cc 2014-05-08 19:13:15.782158808 +0100
+++ gcc/wide-int.cc 2014-05-08 19:28:52.880742385 +0100
@@ -27,19 +27,20 @@ along with GCC; see the file COPYING3.
#include "tree.h"
#include "dumpfile.h"
-#if GCC_VERSION >= 3000
+#if (GCC_VERSION >= 3000 \
+ && (defined __aarch64 \
+ || defined __alpha \
+ || defined __ia64 \
+ || defined __powerpc64__ \
+ || defined __sparcv9 \
+ || defined __x86_64__))
#define W_TYPE_SIZE HOST_BITS_PER_WIDE_INT
-typedef unsigned HOST_HALF_WIDE_INT UHWtype;
-typedef unsigned HOST_WIDE_INT UWtype;
typedef unsigned int UQItype __attribute__ ((mode (QI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
typedef unsigned int UDItype __attribute__ ((mode (DI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-#if W_TYPE_SIZE == 32
-# define UDWtype UDItype
-#elif W_TYPE_SIZE == 64
-# define UDWtype UTItype
-#endif
+typedef unsigned HOST_HALF_WIDE_INT UHWtype;
+typedef unsigned HOST_WIDE_INT UWtype;
+typedef unsigned int UDWtype __attribute__ ((mode (TI)));
#include "longlong.h"
#endif