Fixes strided vector stores.

As per RiscV Vector documentation the stride is a byte stride, and therefore
should not be scaled by the element size. This is the case for vector load
strided. However, vector store strided erroneously scaled the stride. This has
been fixed, and the test has been updated accordingly.

PiperOrigin-RevId: 660523446
Change-Id: I151b70fab8c240256620cf117f0e1e021474b666
diff --git a/riscv/riscv_vector_memory_instructions.cc b/riscv/riscv_vector_memory_instructions.cc
index fb2731a..36a2da6 100644
--- a/riscv/riscv_vector_memory_instructions.cc
+++ b/riscv/riscv_vector_memory_instructions.cc
@@ -805,7 +805,7 @@
   for (int i = vstart; i < num_elements; i++) {
     int mask_index = i >> 3;
     int mask_offset = i & 0b111;
-    addresses[i - vstart] = base + i * stride;
+    addresses[i - vstart] = base + i * stride * sizeof(T);
     masks[i - vstart] = ((src_masks[mask_index] >> mask_offset) & 0b1) != 0;
     store_data[i - vstart] = GetInstructionSource<T>(inst, 0, i);
   }
diff --git a/riscv/test/riscv_vector_memory_instructions_test.cc b/riscv/test/riscv_vector_memory_instructions_test.cc
index 98270f5..58d6899 100644
--- a/riscv/test/riscv_vector_memory_instructions_test.cc
+++ b/riscv/test/riscv_vector_memory_instructions_test.cc
@@ -812,7 +812,7 @@
     for (int lmul_index = 0; lmul_index < 7; lmul_index++) {
       // Try different strides.
       for (int s = 0; s < 5; s++) {
-        int32_t stride = strides[s] * sizeof(T);
+        int32_t stride = strides[s];
         SetRegisterValues<int32_t>({{kRs2Name, stride}});
         // Configure vector unit.
         uint32_t vtype = (kSewSettingsByByteSize[sizeof(T)] << 3) |
@@ -840,7 +840,7 @@
           } else {
             EXPECT_EQ(data_db->template Get<T>(0), 0) << "index: " << i;
           }
-          base += stride;
+          base += stride * sizeof(T);
           value++;
         }
         data_db->DecRef();