Mohamed Shafi <shafi...@gmail.com> 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? Yes. > 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. Ian