[PATCH] D116574: [RISCV] Materializing constants with 'rori'
    Craig Topper via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jan  5 19:39:58 PST 2022
    
    
  
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:149
+  if (TrailingOnes > 0 && TrailingOnes < 64 &&
+      (LeadingOnes + TrailingOnes) > (64 - 12)) {
+    return 64 - TrailingOnes;
----------------
You can drop the curly braces
================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:156
+  if (UpperTrailingOnes < 32 &&
+      (UpperTrailingOnes + LowerLeadingOnes) > (64 - 12)) {
+    return 32 - UpperTrailingOnes;
----------------
Drop curly braces
================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:335
+  if (Res.size() > 2 && ActiveFeatures[RISCV::FeatureStdExtZbb]) {
+    if (int Rotate = extractRotateInfo(Val)) {
+      RISCVMatInt::InstSeq TmpSeq;
----------------
Use `unsigned` since the function returns `unsigned`
================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:337
+      RISCVMatInt::InstSeq TmpSeq;
+      int NegImm12 = (uint64_t)Val >> (64 - Rotate) | (uint64_t)Val << Rotate;
+      TmpSeq.push_back(RISCVMatInt::Inst(RISCV::ADDI, NegImm12));
----------------
Add an assert that verifies isInt<12>(NegImm12).
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116574/new/
https://reviews.llvm.org/D116574
    
    
More information about the llvm-commits
mailing list