This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v4 6/7] S/390: Use signaling FP comparison instructions
- From: Andreas Krebbel <krebbel at linux dot ibm dot com>
- To: Ilya Leoshkevich <iii at linux dot ibm dot com>, gcc-patches at gcc dot gnu dot org
- Cc: richard dot guenther at gmail dot com, richard dot sandiford at arm dot com, segher at kernel dot crashing dot org, joseph at codesourcery dot com, rdapp at linux dot ibm dot com
- Date: Mon, 7 Oct 2019 18:19:57 +0200
- Subject: Re: [PATCH v4 6/7] S/390: Use signaling FP comparison instructions
- References: <20191001132709.87257-1-iii@linux.ibm.com> <20191001132709.87257-7-iii@linux.ibm.com>
On 01.10.19 15:27, Ilya Leoshkevich wrote:
> dg-torture.exp=inf-compare-1.c is failing, because (qNaN > +Inf)
> comparison is compiled to CDB instruction, which does not signal an
> invalid operation exception. KDB should have been used instead.
>
> This patch introduces a new CCmode and a new pattern in order to
> generate signaling instructions in this and similar cases.
>
> gcc/ChangeLog:
>
> 2019-08-09 Ilya Leoshkevich <iii@linux.ibm.com>
>
> PR target/77918
> * config/s390/2827.md: Add new opcodes.
> * config/s390/2964.md: Likewise.
> * config/s390/3906.md: Likewise.
> * config/s390/8561.md: Likewise.
> * config/s390/s390-builtins.def (s390_vfchesb): Use
> the new vec_cmpgev4sf_quiet_nocc.
> (s390_vfchedb): Use the new vec_cmpgev2df_quiet_nocc.
> (s390_vfchsb): Use the new vec_cmpgtv4sf_quiet_nocc.
> (s390_vfchdb): Use the new vec_cmpgtv2df_quiet_nocc.
> (vec_cmplev4sf): Use the new vec_cmplev4sf_quiet_nocc.
> (vec_cmplev2df): Use the new vec_cmplev2df_quiet_nocc.
> (vec_cmpltv4sf): Use the new vec_cmpltv4sf_quiet_nocc.
> (vec_cmpltv2df): Use the new vec_cmpltv2df_quiet_nocc.
> * config/s390/s390-modes.def (CCSFPS): New mode.
> * config/s390/s390.c (s390_match_ccmode_set): Support CCSFPS.
> (s390_select_ccmode): Return CCSFPS for LT, LE, GT, GE and LTGT.
> (s390_branch_condition_mask): Reuse CCS for CCSFPS.
> (s390_expand_vec_compare): Use non-signaling patterns where
> necessary.
> (s390_reverse_condition): Support CCSFPS.
> * config/s390/s390.md (*cmp<mode>_ccsfps): New pattern.
> * config/s390/vector.md: (VFCMP_HW_OP): Remove.
> (asm_fcmp_op): Likewise.
> (*smaxv2df3_vx): Use pattern for quiet comparison.
> (*sminv2df3_vx): Likewise.
> (*vec_cmp<VFCMP_HW_OP:code><mode>_nocc): Remove.
> (*vec_cmpeq<mode>_quiet_nocc): New pattern.
> (vec_cmpgt<mode>_quiet_nocc): Likewise.
> (vec_cmplt<mode>_quiet_nocc): New expander.
> (vec_cmpge<mode>_quiet_nocc): New pattern.
> (vec_cmple<mode>_quiet_nocc): New expander.
> (*vec_cmpeq<mode>_signaling_nocc): New pattern.
> (*vec_cmpgt<mode>_signaling_nocc): Likewise.
> (*vec_cmpgt<mode>_signaling_finite_nocc): Likewise.
> (*vec_cmpge<mode>_signaling_nocc): Likewise.
> (*vec_cmpge<mode>_signaling_finite_nocc): Likewise.
> (vec_cmpungt<mode>): New expander.
> (vec_cmpunge<mode>): Likewise.
> (vec_cmpuneq<mode>): Use quiet patterns.
> (vec_cmpltgt<mode>): Allow only on z14+.
> (vec_cmpordered<mode>): Use quiet patterns.
> (vec_cmpunordered<mode>): Likewise.
> (VEC_CMP_EXPAND): Add ungt and unge.
>
> gcc/testsuite/ChangeLog:
>
> 2019-08-09 Ilya Leoshkevich <iii@linux.ibm.com>
>
> * gcc.target/s390/vector/vec-scalar-cmp-1.c: Adjust
> expectations.
...
> diff --git a/gcc/config/s390/s390-modes.def b/gcc/config/s390/s390-modes.def
> index 7b7c1141449..2d9cd9b5945 100644
> --- a/gcc/config/s390/s390-modes.def
> +++ b/gcc/config/s390/s390-modes.def
> @@ -52,6 +52,8 @@ CCS: EQ LT GT UNORDERED (LTGFR, LTGR, LTR, ICM/Y,
> ADB/R, AEB/R, SDB/R, SEB/R,
> SRAG, SRA, SRDA)
> CCSR: EQ GT LT UNORDERED (CGF/R, CH/Y)
> +CCSFPS: EQ GT LT UNORDERED (KEB/R, KDB/R, KXBR, KDTR,
> + KXTR, WFK)
GT and LT need to be swapped.
Ok with that change. Thanks!
Andreas