[llvm] [RISCV] Remove redundant sign extensions from BEXT indices (PR #228398)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 08:55:41 PDT 2026


================
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc -mtriple=riscv64 -mattr=+zbs -verify-machineinstrs < %s | FileCheck %s
+
+; The index operand only reads log2(XLEN) bits, while the data operand can
+; still read any bit selected by the index.
+; These unmasked IR shifts are poison for actual shift amounts >= 64.
+; The MIR test also covers unknown register values without that IR constraint.
+
+define i64 @bext_index(i64 %data, i64 %index, i1 %condition) {
----------------
topperc wrote:

I would expect these tests to be handled by `RISCVDAGToDAGISel::hasAllNBitUsers`, but it looks like its missing from there too.

https://github.com/llvm/llvm-project/pull/228398


More information about the llvm-commits mailing list