-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Implement RISCVTargetLowering::getRoundingControlRegisters #139864
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
Conversation
@llvm/pr-subscribers-backend-risc-v Author: Gergely Futo (futog) ChangesReadFRM should not be optimized out. Full diff: https://github.com/llvm/llvm-project/pull/139864.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
index e9bdeb88e4ca8..88ee311b51543 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
@@ -2006,7 +2006,9 @@ class SwapSysRegImm<SysReg SR, list<Register> Regs>
let Defs = Regs;
}
+let hasSideEffects = true in
def ReadFRM : ReadSysReg<SysRegFRM, [FRM]>;
+
let hasPostISelHook = 1 in {
def WriteFRM : WriteSysReg<SysRegFRM, [FRM]>;
def WriteFRMImm : WriteSysRegImm<SysRegFRM, [FRM]>;
|
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.
Do you have a case to show the miscompile?
Sure, here you go: https://godbolt.org/z/Kx1qsTeGY |
Then please add a .ll test and precommit it. |
240ec09
to
d2515dd
Compare
Does implementing |
No. As far as I understand, this is used in case of inline asm. |
Should we mark |
It's used to add FRM as an implicit def to calls.
I've tested locally that it does fix your test case. |
Oops I missed that if, sorry, but yes I also implemented |
Do you have a test case that shows machine-cse reordering things? |
Sure, the test in the precommit have this (#139921). This is the behavior without the patch:
|
The |
d2515dd
to
73b1089
Compare
updated the patch, thanks @topperc for your time and patience. |
73b1089
to
3d808a0
Compare
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.
LGTM
By adding FRM/FFLAGS as implicit defs, ReadFRM is not optimized out.
3d808a0
to
bc2e640
Compare
…lvm#139864) By adding FRM/FFLAGS as implicit defs, ReadFRM is not optimized out.
…lvm#139864) By adding FRM/FFLAGS as implicit defs, ReadFRM is not optimized out.
By adding FRM/FFLAGS as implicit defs, ReadFRM is not optimized out.