void updateImmediate(vm::System* s, void* dst, int32_t src, unsigned size, bool address) { switch (size) { case 4: { int32_t* p = static_cast<int32_t*>(dst); int r = (vm::targetV4(p[1]) >> 21) & 31; if (address) { p[0] = vm::targetV4(lis(r, ha16(src))); p[1] |= vm::targetV4(src & 0xFFFF); } else { p[0] = vm::targetV4(lis(r, src >> 16)); p[1] = vm::targetV4(ori(r, r, src)); } } break; default: abort(s); } }
asm int fun1 () { int v; addis v,0,ha16(foo) lwz r3,lo16(foo)(v) }