This is the mail archive of the
mailing list for the GCC project.
Re: Need help in deciding the instruction set for a new target.
- From: Ian Lance Taylor <iant at google dot com>
- To: Mohamed Shafi <shafitvm at gmail dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Mon, 23 Aug 2010 11:32:25 -0700
- Subject: Re: Need help in deciding the instruction set for a new target.
- References: <AANLkTimKoa7xNV4dgqQdysJGB6bc2_O7bQrKruiMXhEL@mail.gmail.com>
Mohamed Shafi <firstname.lastname@example.org> writes:
> I want to know if it is good to have both sign and zero extension for
> 16bit immediate.
Hard to say. It really depends on the kind of constants you expect your
programs to use. It's generally a good idea to have an efficient way to
load small constants which many programs use, such as 0, 1, -1. The
latter implies that you will want sign extending immediate operations.
Whether your programs will benefit from an efficient way to load 0xffff,
I don't know.
> Will it be of any use with a configuration where char == short == int == 32bit?
Yes, the size of supported immediate constants is really orthogonal to
the size of the data types. Your programs are certainly going to refer
to numbers like 0, 1, and -1. Efficient ways of using those constants
will generally pay off, though of course it is a tradeoff like
everything else in architecture design.
> Will I be able to support these kinds of instructions in a GCC port?
> Or will it good to have a separate sign and zero extension
> instruction, which the current instruction set doesnât have.
> Do I need a separate sign and zero ext instructions along with the
> above instructions?
When char is 32 bits, you don't really need sign and zero extension of
unknown values. So the question is whether you need them for immediate
constants. As I mention above, it will probably pay off to have
instructions which support sign extending immediate constants. Whether
that is done via operands to add, etc., or via a load-immediate
instruction, really depends on other characteristics of your
architecture and of the programs you expect to write.
Hope this helps.