D20468: [X86][AVX] Ensure zero-extension of _mm256_extract_epi8 and _mm256_extract_epi16
Romanova, Katya via cfe-commits
cfe-commits at lists.llvm.org
Fri May 20 11:22:55 PDT 2016
Hi Simon,
Thank you for the patch and for fixing the doxygen comments. There is no need to update Sony's intrinsics document. Very soon our documentation team is planning to release the documentation based on the doxygen headers in the upstream headers, so your change will funnel through automatically.
Thank you !
Katya.
> -----Original Message-----
> From: Simon Pilgrim [mailto:llvm-dev at redking.me.uk]
> Sent: Friday, May 20, 2016 6:17 AM
> To: llvm-dev at redking.me.uk; mkuper at google.com;
> craig.topper at gmail.com; Romanova, Katya; spatel at rotateright.com
> Cc: cfe-commits at lists.llvm.org
> Subject: [PATCH] D20468: [X86][AVX] Ensure zero-extension of
> _mm256_extract_epi8 and _mm256_extract_epi16
>
> RKSimon created this revision.
> RKSimon added reviewers: mkuper, craig.topper, kromanova, spatel.
> RKSimon added a subscriber: cfe-commits.
> RKSimon set the repository for this revision to rL LLVM.
>
> Ensure _mm256_extract_epi8 and _mm256_extract_epi16 zero extend their
> i8/i16 result to i32. This matches _mm_extract_epi8 and _mm_extract_epi16.
>
> Fix for PR27594
>
> Katya - I've updated the doxygen comments for _mm256_extract_epi8 and
> _mm256_extract_epi16, I guess this will need to be updated in Sony's
> intrinsics document for the next regeneration?
>
> Repository:
> rL LLVM
>
> http://reviews.llvm.org/D20468
>
> Files:
> lib/Headers/avxintrin.h
> test/CodeGen/avx-builtins.c
>
> Index: test/CodeGen/avx-builtins.c
> ===================================================================
> --- test/CodeGen/avx-builtins.c
> +++ test/CodeGen/avx-builtins.c
> @@ -314,21 +314,19 @@
> return _mm256_dp_ps(A, B, 7);
> }
>
> -// FIXME: ZEXT instead of SEXT
> int test_mm256_extract_epi8(__m256i A) {
> // CHECK-LABEL: test_mm256_extract_epi8
> // CHECK: and i32 %{{.*}}, 31
> // CHECK: extractelement <32 x i8> %{{.*}}, i32 %{{.*}}
> - // CHECK: ext i8 %{{.*}} to i32
> + // CHECK: zext i8 %{{.*}} to i32
> return _mm256_extract_epi8(A, 32);
> }
>
> -// FIXME: ZEXT instead of SEXT
> int test_mm256_extract_epi16(__m256i A) {
> // CHECK-LABEL: test_mm256_extract_epi16
> // CHECK: and i32 %{{.*}}, 15
> // CHECK: extractelement <16 x i16> %{{.*}}, i32 %{{.*}}
> - // CHECK: ext i16 %{{.*}} to i32
> + // CHECK: zext i16 %{{.*}} to i32
> return _mm256_extract_epi16(A, 16);
> }
>
> Index: lib/Headers/avxintrin.h
> ===================================================================
> --- lib/Headers/avxintrin.h
> +++ lib/Headers/avxintrin.h
> @@ -1875,13 +1875,13 @@
> /// \param __imm
> /// An immediate integer operand with bits [3:0] determining which
> vector
> /// element is extracted and returned.
> -/// \returns A 32-bit integer containing the extracted 16 bits of extended
> +/// \returns A 32-bit integer containing the extracted 16 bits of zero
> +extended
> /// packed data.
> static __inline int __DEFAULT_FN_ATTRS
> _mm256_extract_epi16(__m256i __a, const int __imm) {
> __v16hi __b = (__v16hi)__a;
> - return __b[__imm & 15];
> + return (unsigned short)__b[__imm & 15];
> }
>
> /// \brief Takes a [32 x i8] vector and returns the vector element value @@
> -1897,13 +1897,13 @@ /// \param __imm
> /// An immediate integer operand with bits [4:0] determining which
> vector
> /// element is extracted and returned.
> -/// \returns A 32-bit integer containing the extracted 8 bits of extended
> packed
> -/// data.
> +/// \returns A 32-bit integer containing the extracted 8 bits of zero
> extended
> +/// packed data.
> static __inline int __DEFAULT_FN_ATTRS
> _mm256_extract_epi8(__m256i __a, const int __imm) {
> __v32qi __b = (__v32qi)__a;
> - return __b[__imm & 31];
> + return (unsigned char)__b[__imm & 31];
> }
>
> #ifdef __x86_64__
>
More information about the cfe-commits
mailing list