Last active
November 19, 2017 16:56
-
-
Save inolen/8ee108ab7fdaf140f8affaf8719f5b99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void x64_backend_mov_value(struct x64_backend *backend, const Xbyak::Reg &rd, | |
const struct ir_value *v) { | |
auto &e = *backend->codegen; | |
if (ir_is_constant(v)) { | |
e.mov(rd, ir_zext_constant(v)); | |
return; | |
} | |
Xbyak::Reg ra = x64_backend_reg(backend, v); | |
if (rd.isBit(64) && ra.isBit(64)) { | |
e.mov(rd, ra); | |
} else if (rd.isBit(64) && ra.isBit(32)) { | |
/* mov will automatically zero fill the upper 32-bits */ | |
e.mov(rd.cvt32(), ra); | |
} else { | |
e.movzx(rd, ra); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment