https://bugs.llvm.org/show_bug.cgi?id=50971
Bug ID: 50971
Summary: Messy code for insertelement on AVX2 vectors
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Examples:
#include <immintrin.h>
#define IDX 3
__m256d float1(__m256d a, __m256d b) { a[IDX] = b[0]; return a; }
__m256d float2(__m256d a, double b) { a[IDX] = b; return a; }
__m256d float3(__m256d a, double b) { return _mm256_blend_epi32(a,
_mm256_set1_pd(b), 3 << IDX * 2); }
__m256i int1(__m256i a, __m256i b) { a[IDX] = b[0]; return a; }
__m256i int2(__m256i a, long b) { a[IDX] = b; return a; }
__m256i int3(__m256i a, long b) { return _mm256_blend_epi32(a,
_mm256_set1_epi64x(b), 3 << IDX * 2); }
__m256i int4(__m256i a, long *b) { a[IDX] = *b; return a; }
__m256i int5(__m256i a, long *b) { return _mm256_blend_epi32(a,
_mm256_set1_epi64x(*b), 3 << IDX * 2); }
It looks like the lowering extracts an 128-bit vector, inserts into that, then
reconstructs the 256-bit vector. A broadcast+blend is almost always going to be
more efficient, I think.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs