https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98254
Bug ID: 98254 Summary: Failure to optimize simple pattern for __builtin_convertvector Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- typedef int32_t __attribute__((vector_size(16))) v4i32; typedef int16_t __attribute__((vector_size(8))) v4i16; v4i32 f(short *a) { return (v4i32){a[0], a[1], a[2], a[3]}; } This can be optimized to `return __builtin_convertvector(*(v4i16 *)a, v4i32);` (or at least, something very close to that, if aliasing is to be taken into account). LLVM does this transformation, but GCC does not.