-
Notifications
You must be signed in to change notification settings - Fork 57
Soloninko Andrey. Lab 3, opt 1 #118
Soloninko Andrey. Lab 3, opt 1 #118
Conversation
MBIter != MachineBlock.end(); ++MBIter) { | ||
if (MBIter->getOpcode() != llvm::X86::MULPDrr) { | ||
continue; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
} |
|
||
# __m128d foo(__m128d a, __m128d b, __m128d c, __m128d d) { | ||
# __m128d tmp = a * b; | ||
# d = tmp + c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please provide more tests?
Like:
tmp = ab;
tmp2 = cd;
tmp3 = tmp + tmp2;
tmp = ab;
tmp2 = cd;
tmp3 = tmp2 + tmp;
tmp4 = tmp2 + tmp3;
} else { | ||
break; | ||
} | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue; |
llvm::MachineBasicBlock::iterator MulInstr = MBIter; | ||
++MBIter; | ||
while (MBIter != MachineBlock.end()) { | ||
if (MBIter->getOpcode() == llvm::X86::ADDPDrr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (MBIter->getOpcode() == llvm::X86::ADDPDrr) { | |
if (MBIter->getOpcode() != llvm::X86::ADDPDrr) { | |
break; | |
} |
llvm/lib/Target/X86/X86.h
Outdated
@@ -167,6 +167,7 @@ FunctionPass *createX86LoadValueInjectionRetHardeningPass(); | |||
FunctionPass *createX86SpeculativeLoadHardeningPass(); | |||
FunctionPass *createX86SpeculativeExecutionSideEffectSuppression(); | |||
FunctionPass *createX86ArgumentStackSlotPass(); | |||
FunctionPass *createX86SoloninkoOptsPass(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make a pass as dynamic plugin.
Implemented an optimization pass that replaces multiplication and addition operation:
tmp = a * b;
d = tmp + c;
with muladd instruction:
d = muladd(a, b, c);