* Send a `mov %r64,%r64' instruction. */
| 1162 | * Send a `mov %r64,%r64' instruction. |
| 1163 | */ |
| 1164 | bool sendMovFromR64ToR64(FILE *out, int srcno, int dstno) |
| 1165 | { |
| 1166 | if (srcno == dstno) |
| 1167 | return false; |
| 1168 | const uint8_t REX_MASK[] = |
| 1169 | {0, 0, 0, 0, 1, 1, 0, |
| 1170 | 0, 1, 1, 0, 0, 1, 1, 1, 1, 0}; |
| 1171 | const uint8_t REX[] = {0x48, 0x4c, 0x49, 0x4d}; |
| 1172 | const uint8_t REG[] = |
| 1173 | {0x07, 0x06, 0x02, 0x01, 0x00, 0x01, 0x00, |
| 1174 | 0x00, 0x02, 0x03, 0x03, 0x05, 0x04, 0x05, 0x06, 0x07, 0x04}; |
| 1175 | |
| 1176 | uint8_t rex = REX[(REX_MASK[dstno] << 1) | REX_MASK[srcno]]; |
| 1177 | uint8_t modrm = (0x03 << 6) | (REG[srcno] << 3) | REG[dstno]; |
| 1178 | fprintf(out, "%u,%u,%u,", rex, 0x89, modrm); |
| 1179 | return true; |
| 1180 | } |
| 1181 | |
| 1182 | /* |
| 1183 | * Send a `movslq %r32,%r64' instruction. |
no test coverage detected