https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122320
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2025-10-19
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Target| |x86_64
Severity|normal |enhancement
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
Trying 17 -> 27:
17: r115:V64QI=const_vector
27: r121:DI=unspec[r115:V64QI,r115:V64QI,0x4] 60
REG_DEAD r115:V64QI
REG_EQUAL unspec[const_vector,const_vector,0x4] 60
Failed to match this instruction:
(set (reg:DI 121)
(unspec:DI [
(const_vector:V64QI [
(const_int 0 [0]) repeated x64
]) repeated x2
(const_int 4 [0x4])
] UNSPEC_PCMP))
```
At the gimple level the following builtins could be simplified too:
```
_16 = __builtin_ia32_loaddquqi512_mask (px_29, { 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0 }, 0);
_17 = __builtin_ia32_loaddquqi512_mask (py_30, { 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0 }, 0);
_18 = __builtin_ia32_cmpb512_mask (_16, _17, 4, 18446744073709551615);
```
The 2 __builtin_ia32_loaddquqi512_mask into the zeros because of the last
argument the mask being 0.
__builtin_ia32_cmpb512_mask into -1 as `{0,...} == {0, ...}` is true. and the
mask is -1.
That would fix the issue too.