This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Support for targets with widths other than 2^x (Power of 2)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Ramon Wirsch <ramon dot wirsch at stud dot tu-darmstadt dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 15 Oct 2015 08:54:18 -0500
- Subject: Re: Support for targets with widths other than 2^x (Power of 2)
- Authentication-results: sourceware.org; auth=none
- References: <CAOiws6vVqJzNg+eRMDrqXG_OQvr_eqAwxsc5b7nKp+dRR=1Gww at mail dot gmail dot com>
On Thu, Oct 15, 2015 at 02:34:06PM +0200, Ramon Wirsch wrote:
> The SpartanMC architecture poses a few additional difficulties as it
> is 18 Bits wide.
> Our investigations have shown that GCC is on principle capable of that
> (it is working right now, although with several limitations). The main
> problems are posed by code optimizations that are only applicable for
> 2^x values such as
>
> ... & (obj_align - 1);
> or
> d_int.lshift (BITS_PER_UNIT_LOG)
>
> Until now, every bug or crash we experienced was caused by such
> implementations that can very well be rewritten to have correct
> results no matter the actual value.
Patches welcome :-)
> Also, the current codebase does not seem to be unified in this and
> already mixes general implementations and ones that only work for
> powers of 2.
>
> Our question now is, whether or not compatibility with our 18 bit
> architecture and others is something you desire GCC to be capable of
> in the long term.
If it is not a big maintenance burden (and you say it isn't), I don't
see why we wouldn't want to support this.
The flip side is that there also needs to be constant maintenance from
"your" side (i.e., people testing with interesting word lengths), to
prevent things from regressing -- many people will just not consider
the possibility of non-power-of-two word lengths.
Do you already have patches for this separated out? If you post those
people can more clearly see what the actual impact is.
Segher