diff options
author | Jason Gross <jgross@mit.edu> | 2017-09-12 21:43:50 -0400 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2017-09-12 21:43:50 -0400 |
commit | 01e9fc57b02d76006b252db449a5acb5265f04a0 (patch) | |
tree | 65135491fd6a48d5b304a199c9516f6478783aef /register-allocate.py | |
parent | 28b53daa3378c3a74451d541d31bf28acd88e555 (diff) |
Use imul (not sure if it's better...)
Diffstat (limited to 'register-allocate.py')
-rwxr-xr-x | register-allocate.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/register-allocate.py b/register-allocate.py index c517078bd..276deb46c 100755 --- a/register-allocate.py +++ b/register-allocate.py @@ -648,15 +648,27 @@ def print_mov_bucket(reg_out, reg_in, bucket): LAST_CARRY = None +def print_imul_constant(reg_out, reg_in, imm, src): + global LAST_CARRY + LAST_CARRY = None + ret = '' + assert(imm[:2] == '0x') + ret2, reg_in = print_load(reg_in, can_clobber=[reg_out]) + ret += ret2 + print_instr('imul', (reg_out, reg_in, imm), comment=src) + return ret + + def print_mul_by_constant(reg_out, reg_in, constant, src): #return '%s <- MULX %s, %s; // %s\n' % (ret_out, reg_in, constant, src) ret = '' - if constant == '0x13': - ret += ('// FIXME: lea for %s\n' % src) + #if constant == '0x13': + # ret += ('// FIXME: lea for %s\n' % src) assert(constant[:2] == '0x') + #return ret + \ + # print_load_constant('rdx', constant) + \ + # print_mulx(reg_out, 'rdx', 'rdx', reg_in, src) return ret + \ - print_load_constant('rdx', constant) + \ - print_mulx(reg_out, 'rdx', 'rdx', reg_in, src) + print_imul_constant(reg_out, reg_in, constant, src) def print_adx(reg_out, rx1, rx2, bucket): #return '%s <- ADX %s, %s; // bucket: %s\n' % (reg_out, rx1, rx2, bucket) |