Remove some x86-64 addressing modes of IMUL and ADD instructions

Hello everyone,

For some project, I need to remove some addressing modes of operands in IMUL and ADD instructions. More specifically, I do not want LLVM to generate instruction like:

imull (%r9,%r11), %r15d

Instead I will like LLVM to generate code which first loads address into a register and then multiply it, i.e., something like:

movl (%r9, %r11), %r10d
imull %r10d, %r15d

I have remove all IMUL64rm and IMUL64rmi instructions in Target/X86/X86InstrArithmetic.td, but still imull instruction with memory operand is generated. Can anyone please point me to the write place?

I will prefer a solution related to llvm6.0, however, solution for any llvm version is welcome.

Thank You,

Abhinav Jangda

Did you also remove IMUL32rm and IMUL32rmi? The example assembly you provides look to be 32-bit multiplies since they use %r15d and %r10d.