[PATCH] D52977: [RISCV] Introduce codegen patterns for instructions introduced in RV64I

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 30 14:39:17 PST 2018


efriedma added inline comments.


================
Comment at: llvm/trunk/lib/Target/RISCV/RISCVInstrInfo.td:916
+def : Pat<(sra (sext_inreg GPR:$rs1, i32), GPR:$rs2),
+          (SRAW GPR:$rs1, GPR:$rs2)>;
+def : Pat<(sra (sext_inreg GPR:$rs1, i32), (and GPR:$rs2, immshifti32)),
----------------
These shift-right patterns are sort of suspicious.  In particular, what happens if the shift amount is >= 32?  For example, consider the following function:

  long long x(long long y, int s) {
    return ((long long)(int)y)>>s;
  }

`x(1, 32)` should return 0.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52977/new/

https://reviews.llvm.org/D52977





More information about the llvm-commits mailing list