https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109900
Bug ID: 109900 Summary: _mm256_abs_epi8 is not expanded on gimple level Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: x86_64-linux-gnu Take (at -O3 -march=x86-64-v3): ``` #include <immintrin.h> __m256i should_be_cmpeq_abs0 () { return _mm256_set1_epi8 (1); } __m256i should_be_cmpeq_abs1 () { return _mm256_abs_epi8(_mm256_set1_epi8 (-1)); } ``` I would have expected these two produce the same code generation. In the end, we still have a builtin function in the IR rather than ABS_EXPR. The RTL level uses abs. In fact combine tries to combine the two instructions: Trying 5 -> 6: 5: r85:V32QI=const_vector 6: r84:V32QI=abs(r85:V32QI) REG_DEAD r85:V32QI REG_EQUAL const_vector Failed to match this instruction: (set (reg:V32QI 84) (const_vector:V32QI [ (const_int 1 [0x1]) repeated x32 ]))