[llvm] [RISCV][VSETVLI] Prefer VTYPE for immediate known to be less than VLMAX (PR #69759)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 13:51:47 PDT 2023


================
@@ -23,7 +23,7 @@ define void @extract_v2i8_v4i8_2(ptr %x, ptr %y) {
 ; CHECK-NEXT:    vle8.v v8, (a0)
 ; CHECK-NEXT:    vsetivli zero, 2, e8, mf4, ta, ma
 ; CHECK-NEXT:    vslidedown.vi v8, v8, 2
-; CHECK-NEXT:    vsetivli zero, 2, e8, mf8, ta, ma
+; CHECK-NEXT:    vsetvli zero, zero, e8, mf8, ta, ma
----------------
preames wrote:

I spent more time on this than was warranted, and end up deciding this wasn't worth it.  I can do stores specifically, but reasoning about when it's legal to increase and decrease LMUL gets into all kinds of cornercases since we have instructions which aren't regular in VL  (i.e. vrgather.vv can read past VL) and LMUL (i.e. widening operations write to a wider source than LMUL would lead you to believe.)  I ended up either having to do a very narrow special case, or have to write very subtle predicates for all instructions.  I ended up deciding this just isn't worth it for the moment.  

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


More information about the llvm-commits mailing list