[llvm] [LoongArch] Add patterns for vstelm instructions (PR #139201)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 21:30:27 PDT 2025


================
@@ -1760,6 +1760,14 @@ def : Pat<(lasxsplatf32 FPR32:$fj),
 def : Pat<(lasxsplatf64 FPR64:$fj),
           (XVREPLVE0_D (SUBREG_TO_REG (i64 0), FPR64:$fj, sub_64))>;
 
+// VSTELM
+defm : VstelmPat<truncstorei8, v32i8, XVSTELM_B, simm12_addlike, uimm5>;
+defm : VstelmPat<truncstorei16, v16i16, XVSTELM_H, simm11_lsl1, uimm4>;
+defm : VstelmPat<truncstorei32, v8i32, XVSTELM_W, simm10_lsl2, uimm3>;
+defm : VstelmPat<store, v4i64, XVSTELM_D, simm9_lsl3, uimm2>;
+defm : VstelmPat<store, v8f32, XVSTELM_W, simm10_lsl2, uimm3, f32>;
+defm : VstelmPat<store, v4f64, XVSTELM_D, simm9_lsl3, uimm2, f64>;
+
----------------
heiher wrote:

The `[x]vstelm.{b,h,w,d}` instructions all use signed 8-bit immediate offsets, with `{h,w,d}` variants applying a left-shift. Including test cases that cover a range of offset encodings would improve our chances of catching edge cases and potential issues.

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


More information about the llvm-commits mailing list