On Fri, Jul 14, 2017 at 04:03:51PM +0100, Robin Murphy wrote: > On 14/07/17 15:39, Robin Murphy wrote: > > On 14/07/17 15:06, Mark Rutland wrote:
> >> add sp, sp, x0 // sp = orig_sp + orig_x0 > >> sub x0, sp, x0 // x0 = orig_sp > >> < check > > >> sub x0, sp, x0 // x0 = orig_x0 > > > > Haven't you now forcibly cleared the top bit of x0 thanks to overflow? > > ...or maybe not. I still can't quite see it, but I suppose it must > cancel out somewhere, since Mr. Helpful C Program[1] has apparently > proven me mistaken :( > > I guess that means I approve! > > Robin. > > [1]: > #include <assert.h> > #include <stdint.h> > > int main(void) { > for (int i = 0; i < 256; i++) { > for (int j = 0; j < 256; j++) { > uint8_t x = i; > uint8_t y = j; > y = y + x; > x = y - x; > x = y - x; > y = y - x; > assert(x == i && y == j); > } > } > } I guess we have our first Tested-by for this series. :) Thanks for taking a look! Mark.