[aarch64-port-dev ] Remove cmp(reg, imm) altogether?

Joshua Zhu Joshua.Zhu at arm.com
Fri May 25 07:25:37 UTC 2018

How about below implementation?
	void cmp(Register Rd, char imm) 
imm is changed into type "char", has only one byte.
When engineers look into this function, they will wonder why imm has size limitation.
Then comments are added here to emphasize immediate operand has 12 bits limitation.
// If imm fits in 1 byte range, directly use this function.
// If imm is larger, but engineer is sure that imm fits operand_valid_for_add_sub_immediate(), directly use subs(zr, reg, imm).
// Otherwise find an available temp register, use subs(temp, reg, imm);

What's your opinion?

> I'm thinking of removing cmp(reg, imm) altogether.  It's horribly error- prone
> and has resulted in several cycles of bug reports.  Anyone who really is sure
> that their immediate will fit can use subs(zr, reg, imm).
> What do you think?

More information about the aarch64-port-dev mailing list