A89: Rotate with carry in TIGCC


[Prev][Next][Index][Thread]

A89: Rotate with carry in TIGCC




I am trying to perform the following task:
In the array of words data[], shift elements the right by one bit, and copy
the lowest bit of the next element into the highest bit of the current
element. I use the following code for that:

	WORD data[]; //filled with values later
	for(i = starting_index; i < ending_index; i++)
		data[i] = (data[i] >> 1) | (data[i + 1] << 15);

However, the performance of this piece of code is unsatisfactory. If I were
writing in C for Intel processor, I would rewrite the code in inline asm
using RCR instruction (Rotate Carry Right), so I wouldn't have to deal with
all that shifting and ORing. Unfortunately, I know no M-68K assembly, so the
question is: Is there a way to do similar thing in TIGCC?

Thank you very much.

Alex Astashyn




Follow-Ups: