]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Fix up _mm_min_ss etc. handling of zeros and NaNs [PR116738]
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Sep 2024 07:14:29 +0000 (09:14 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Sep 2024 07:14:29 +0000 (09:14 +0200)
commit624d3af025e820ede7ec4334f7a2d5d4731c99a9
treeef2b11ac9b04d7c82a44d2ebc86edbad60871728
parentfd83474b2fee54697f27719a4631a21d68cb4ab6
i386: Fix up _mm_min_ss etc. handling of zeros and NaNs [PR116738]

min/max patterns for intrinsics which on x86 result in the second
input operand if the two operands are both zeros or one or both of them
are a NaN shouldn't use SMIN/SMAX RTL, because that is similarly to
MIN_EXPR/MAX_EXPR undefined what will be the result in those cases.

The following patch adds an expander which uses either a new pattern with
UNSPEC_IEEE_M{AX,IN} or use the S{MIN,MAX} representation of the same.

2024-09-20  Uros Bizjak  <ubizjak@gmail.com>
    Jakub Jelinek  <jakub@redhat.com>

PR target/116738
* config/i386/subst.md (mask_scalar_operand_arg34,
mask_scalar_expand_op3, round_saeonly_scalar_mask_arg3): New
subst attributes.
* config/i386/sse.md
(<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
Change from define_insn to define_expand, rename the old define_insn
to ...
(*<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
... this.
(<sse>_ieee_vm<ieee_maxmin><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
New define_insn.

* gcc.target/i386/sse-pr116738.c: New test.
gcc/config/i386/sse.md
gcc/config/i386/subst.md
gcc/testsuite/gcc.target/i386/sse-pr116738.c [new file with mode: 0644]