       }
     }
     blen = SHFL0(blen);
-    if (t < blen) { s->q.buf[(pos + t) & (PREFETCH_SIZE - 1)] = base[pos + t]; }
+    if (blen == PREFETCH_SECTORS * 32u) {
+      uint8_t vals[PREFETCH_SECTORS];
+      for(int i = 0; i < PREFETCH_SECTORS; ++i)
+        vals[i] = base[pos + t + i * 32u];
+      for(int i = 0; i < PREFETCH_SECTORS; ++i)
+        s->q.buf[(pos + t + i * 32u) & (PREFETCH_SIZE - 1)] = vals[i];
+    } else {
+#pragma unroll 1
+      for(int elem = t; elem < blen; elem += 32) {
+        s->q.buf[(pos + elem) & (PREFETCH_SIZE - 1)] = base[pos + elem];
+      }
+    }
     pos += blen;
   } while (blen > 0);
 }

    if (!t) {
      uint32_t minrdpos;
      s->q.prefetch_wrpos = pos;
      minrdpos            = pos - min(pos, PREFETCH_SIZE - 32u);
      blen                = (int)min(32u, end - pos);
      for (;;) {
        uint32_t rdpos = s->q.prefetch_rdpos;
        if (rdpos >= minrdpos) break;

#define BATCH_SIZE (1 << LOG2_BATCH_SIZE)
#define LOG2_BATCH_COUNT 2
#define BATCH_COUNT (1 << LOG2_BATCH_COUNT)
#define LOG2_PREFETCH_SIZE 10
#define PREFETCH_SIZE (1 << LOG2_PREFETCH_SIZE)  // 512B, in 32B chunks
#define PREFETCH_SECTORS 8
#define LITERAL_SECTORS 8

#define LOG_CYCLECOUNT 0

