-
Notifications
You must be signed in to change notification settings - Fork 54
Ополин Дмитрий. Лабораторная работа 3. Backend. Вариант 1. #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: course-spring-2025
Are you sure you want to change the base?
Ополин Дмитрий. Лабораторная работа 3. Backend. Вариант 1. #145
Conversation
BuildMI(MBB, it, dlDef, TII->get(scalarToAVX[opc1]), tmp) | ||
.addReg(defMI->getOperand(1).getReg()) | ||
.addReg(defMI->getOperand(2).getReg()); | ||
|
||
BuildMI(MBB, it, dlUse, TII->get(scalarToAVX[opc2]), | ||
useMI.getOperand(0).getReg()) | ||
.addReg(tmp) | ||
.addReg(useMI.getOperand(2).getReg()); |
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.
Technically, this is not a fusing. This is the same as tryUpgradeSingle
, but for two dependent instructions.
Could you please select any Boolean algebra rule and apply for optimization here?
|
||
|
||
# Source files | ||
# test.cpp | ||
|
||
# include <emmintrin.h> | ||
# include <immintrin.h> | ||
|
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.
# Source files | |
# test.cpp | |
# include <emmintrin.h> | |
# include <immintrin.h> |
class AVXLogicCombinerPass : public MachineFunctionPass { | ||
const X86InstrInfo *TII = nullptr; | ||
MachineRegisterInfo *RegInfo = nullptr; | ||
DenseMap<unsigned, unsigned> scalarToAVX; |
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.
I guess you can use static const DenseMap<unsigned, unsigned> scalarToAVX = { ... }
Этот LLVM Pass выполняет оптимизацию логических операций (AND, OR, XOR и их комбинаций) для архитектуры X86, заменяя скалярные SSE-инструкции на более эффективные векторные AVX-инструкции.