zanmato1984 commented on code in PR #45336:
URL: https://github.com/apache/arrow/pull/45336#discussion_r1927372076


##########
cpp/src/arrow/compute/row/compare_internal_avx2.cc:
##########
@@ -64,14 +66,21 @@ uint32_t KeyCompare::NullUpdateColumnToRowImp_avx2(
         irow_right =
             _mm256_loadu_si256(reinterpret_cast<const 
__m256i*>(left_to_right_map) + i);
       }
-      __m256i bitid =
-          _mm256_mullo_epi32(irow_right, _mm256_set1_epi32(null_mask_num_bytes 
* 8));
-      bitid = _mm256_add_epi32(bitid, _mm256_set1_epi32(null_bit_id));
-      __m256i right =
-          _mm256_i32gather_epi32((const int*)null_masks, 
_mm256_srli_epi32(bitid, 3), 1);
-      right = _mm256_and_si256(
-          _mm256_set1_epi32(1),
-          _mm256_srlv_epi32(right, _mm256_and_si256(bitid, 
_mm256_set1_epi32(7))));
+      __m256i irow_right_lo = 
_mm256_cvtepi32_epi64(_mm256_castsi256_si128(irow_right));
+      __m256i irow_right_hi =
+          _mm256_cvtepi32_epi64(_mm256_extracti128_si256(irow_right, 1));
+      __m256i bit_id_lo =
+          _mm256_mul_epi32(irow_right_lo, 
_mm256_set1_epi64x(null_mask_num_bytes * 8));
+      __m256i bit_id_hi =
+          _mm256_mul_epi32(irow_right_hi, 
_mm256_set1_epi64x(null_mask_num_bytes * 8));
+      bit_id_lo = _mm256_add_epi64(bit_id_lo, pos_after_encoding);
+      bit_id_hi = _mm256_add_epi64(bit_id_hi, pos_after_encoding);

Review Comment:
   I found a lot of legacy code can take advantage of these helpers. But they 
might be too much to put into this PR. Can I do it in another PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to