[llvm-bugs] [Bug 51796] New: [X86][AVX] _mm256_loadu2* intrinsic wrappers contain unnecessary bitcasts
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 8 11:44:53 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51796
Bug ID: 51796
Summary: [X86][AVX] _mm256_loadu2* intrinsic wrappers contain
unnecessary bitcasts
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Headers
Assignee: unassignedclangbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: craig.topper at gmail.com, lebedev.ri at gmail.com,
llvm-bugs at lists.llvm.org, pengfei.wang at intel.com,
richard-llvm at metafoo.co.uk,
spatel+llvm at rotateright.com
__m256 _mm256_loadu2_m128 (float const* hiaddr, float const* loaddr)
__m256d _mm256_loadu2_m128d (double const* hiaddr, double const* loaddr)
__m256i _mm256_loadu2_m128i (__m128i const* hiaddr, __m128i const* loaddr)
https://simd.godbolt.org/z/rG5s6M9bW
The _mm256_loadu2 load-concatenate wrappers end up with bitcasts between
various vector types. This makes it trickier for various vector combines -
using the _mm256_set_m128/_mm256_setr_m128* concatenation wrappers instead
seems to avoid this.
__m256i load2(const __m128i *lo, const __m128i *hi) {
return _mm256_loadu2_m128i(hi, lo);
}
__m256i load2x(const __m128i *lo, const __m128i *hi) {
return _mm256_setr_m128i(_mm_loadu_si128(lo), _mm_loadu_si128(hi));
}
define <4 x i64> @load2(<2 x i64>* %lo, <2 x i64>* %hi) {
entry:
%0 = bitcast <2 x i64>* %hi to <4 x i32>*
%hi.val1 = load <4 x i32>, <4 x i32>* %0, align 1
%lo.val = load <2 x i64>, <2 x i64>* %lo, align 1
%shuffle.i.i = shufflevector <2 x i64> %lo.val, <2 x i64> undef, <4 x i32>
<i32 0, i32 1, i32 undef, i32 undef>
%1 = bitcast <4 x i64> %shuffle.i.i to <8 x i32>
%widen.i = shufflevector <4 x i32> %hi.val1, <4 x i32> poison, <8 x i32> <i32
0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
%insert.i = shufflevector <8 x i32> %1, <8 x i32> %widen.i, <8 x i32> <i32 0,
i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
%2 = bitcast <8 x i32> %insert.i to <4 x i64>
ret <4 x i64> %2
}
define <4 x i64> @load2x(<2 x i64>* %lo, <2 x i64>* %hi) {
entry:
%lo.val = load <2 x i64>, <2 x i64>* %lo, align 1
%hi.val = load <2 x i64>, <2 x i64>* %hi, align 1
%shuffle.i.i = shufflevector <2 x i64> %lo.val, <2 x i64> %hi.val, <4 x i32>
<i32 0, i32 1, i32 2, i32 3>
ret <4 x i64> %shuffle.i.i
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210908/490f21a4/attachment.html>
More information about the llvm-bugs
mailing list