https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96912
Bug ID: 96912 Summary: Failure to optimize pattern 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 char v16i8 __attribute__((vector_size(16))); typedef int64_t v2i64 __attribute__((vector_size(16))); v2i64 blend_epi8(v2i64 x, v2i64 y, v16i8 mask) { v2i64 tmp = (mask < 0); return (~tmp & x) | (tmp & y); } This can be optimized to `return (v2i64)__builtin_ia32_pblendvb128((v16i8)x, (v16i8)y, mask);`. This transformation is done by LLVM, but not by GCC.