Problem in supporting char addition
Prashant Purohit
prashantpurohit025@gmail.com
Fri Jan 29 11:45:00 GMT 2010
Hi,
I am trying to port gcc-4.3.0 to a custom architecture. The high level
language selected is C.
The processor is a RISC processor and all the registers are of 32-bits wide.
The integer data type (SImode) is set as 32-bits.
I have already completed implementation to support integer data type and it
works fine. Now I am trying to support other data types such as char
(8-bits), short int (16-bits).
I have defined the following things:
1. macros in the .h file:
#define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
if (GET_MODE_CLASS (MODE) == MODE_INT \
&& GET_MODE_SIZE (MODE) < 4) \
{ \
(MODE) = SImode; \
}
#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
if ((GET_MODE_CLASS (MODE) == MODE_INT \
|| GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \
&& GET_MODE_SIZE (MODE) < 4) \
(MODE) = SImode;
2. md patterns for zero_extend and extend patterns, movqi, addsi and movhi.
With the above mentioned things, assignment of works for all datatype
combinations like
char var = immediate value
char var = char var
int = char
short int = char etc
But for addition, like,
char = char + immediate
We get the following error :
test.c: In function ‘main’:
test.c:36: error: unrecognizable insn:
(insn 10 9 11 3 test.c:26 (set (reg:SI 24 [ D.1181 ])
(zero_extend:SI (subreg:SI (reg:QI 28) 0))) -1 (expr_list:REG_EQUAL
(zero_extend:SI (mem/c/i:QI (plus:SI (reg/f:SI 20 virtual-stack-vars)
(const_int -16 [0xfffffff0])) [0 a+0 S1 A32]))
(nil)))
test.c:36: internal compiler error: in extract_insn, at recog.c:1992
--
View this message in context: http://old.nabble.com/Problem-in-supporting-char-addition-tp27370844p27370844.html
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list