-
Notifications
You must be signed in to change notification settings - Fork 29
[AIEX] Refactor Set/GetControlRegister and UPS instruction selection to share common code #712
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: aie-public
Are you sure you want to change the base?
Conversation
| case AIE2::crF2FMask: | ||
| case AIE2::crF2IMask: | ||
| case AIE2::crFPMask: | ||
| return SrcConstVal % (1 << 5); |
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.
Perhaps we can generalize this using getRegSizeInBits(Reg, MRI)
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.
Hmm. It looks as if their size is 32 bit...
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.
Yes, you're right getRegSizeInBits would return 32. However, this function needs the semantic bit width.
| // the register according to register width. | ||
| switch (CtrlReg) { | ||
| case AIE2::crSat: | ||
| return SrcConstVal % (1 << 2); |
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.
CHECK: this is mimicking the hardware when it would move it from a register source. To be frank, I would prefer a frontend error on writing an out of bound constant value.
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.
Where should the valid range constraints for control registers be enforced, at the intrinsic definition in headers?
| // Check if the argument is constant for register map index. | ||
| const auto Idx = getIConstantVRegValWithLookThrough(IdxReg, MRI); | ||
| if (!Idx) | ||
| llvm_unreachable("Expected const value for control register map index."); |
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.
getIConstantVRegValWithLookThroughOrFail() could encapsulate the llvm_unreachable.
Also support get/set_status_reg in instruction selection for AIE2P