https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125302
Bug ID: 125302
Summary: Wrong passthrough value in
`_mm512_mask_reduce_{max,min}_{ps,pd}`
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: sayantn05 at gmail dot com
Target Milestone: ---
Intel specifies that the AVX512F intrinsics
`_mm512_mask_reduce_{max,min}_{ps,pd}` should use the smallest and largest
value, respectively, in place of the elements which are masked off.
Specifically, `max_pd` should use `0xFFEFFFFFFFFFFFFF`, `min_pd` should use
`0x7FEFFFFFFFFFFFFF`, `max_ps` should use `0xFF7FFFFF` and `min_ps` should use
`0x7F7FFFFF`. Refer to
https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mask_reduce_max_p&ig_expand=5340,5345
and
https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mask_reduce_min_p&ig_expand=5371,5376
But GCC instead uses negative and positive infinity, respectively, for `max`
and `min`, and clang uses negative and positive NaN, respectively.
https://godbolt.org/z/KoqvsWbE5