[Bug target/82692] [8 Regression] Ordered comparisons used for unordered built-ins

2017-10-23 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82692

Uroš Bizjak  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-10-24
 Ever confirmed|0   |1

--- Comment #1 from Uroš Bizjak  ---
Happens in combine:

(insn 7 6 8 2 (set (reg:CCFPU 17 flags)
(compare:CCFPU (reg:DF 95)
(reg/v:DF 91 [ x ]))) "pr82692.c":9 52 {*cmpiudf}
 (expr_list:REG_DEAD (reg:DF 95)
(expr_list:REG_EQUAL (compare:CCFPU (const_double:DF 0.0 [0x0.0p+0])
(reg/v:DF 91 [ x ]))
(nil
(insn 8 7 9 2 (set (reg:QI 94)
(unlt:QI (reg:CCFPU 17 flags)
(const_int 0 [0]))) "pr82692.c":9 664 {*setcc_qi}
 (expr_list:REG_DEAD (reg:CCFPU 17 flags)
(nil)))
(insn 9 8 10 2 (set (reg:CCZ 17 flags)
(compare:CCZ (reg:QI 94)
(const_int 0 [0]))) "pr82692.c":9 1 {*cmpqi_ccno_1}
 (expr_list:REG_DEAD (reg:QI 94)
(nil)))

combines to:

Trying 8 -> 9:
Failed to match this instruction:
(set (reg:CCFPU 17 flags)
(reg:CCFPU 17 flags))
Successfully matched this instruction:
(set (pc)
(if_then_else (ge (reg:CCFPU 17 flags)
(const_int 0 [0]))
(label_ref:DI 34)
(pc)))

Trying 7 -> 9:
Successfully matched this instruction:
(set (reg:CCFP 17 flags)
(compare:CCFP (reg:DF 95)
(reg/v:DF 91 [ x ])))
Successfully matched this instruction:
(set (pc)
(if_then_else (ge (reg:CCFP 17 flags)
(const_int 0 [0]))
(label_ref:DI 34)
(pc)))

[Bug target/82692] [8 Regression] Ordered comparisons used for unordered built-ins

2017-10-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82692

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
   Target Milestone|--- |8.0

[Bug target/82692] [8 Regression] Ordered comparisons used for unordered built-ins

2017-10-27 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82692

--- Comment #21 from uros at gcc dot gnu.org ---
Author: uros
Date: Fri Oct 27 18:13:14 2017
New Revision: 254167

URL: https://gcc.gnu.org/viewcvs?rev=254167&root=gcc&view=rev
Log:
PR target/82692
* config/i386/i386-modes.def (CCFPU): Remove definition.
* config/i386/i386.c (put_condition_mode): Remove CCFPU mode handling.
(ix86_cc_modes_compatible): Ditto.
(ix86_expand_carry_flag_compare): Ditto.
(ix86_expand_int_movcc): Ditto.
(ix86_expand_int_addcc): Ditto.
(ix86_reverse_condition): Ditto.
(ix86_unordered_fp_compare): Rename from ix86_fp_compare_mode.
Return true/false for unordered/ordered fp comparisons.
(ix86_cc_mode): Always return CCFPmode for float mode comparisons.
(ix86_prepare_fp_compare_args): Update for rename.
(ix86_expand_fp_compare): Update for rename.  Generate unordered
compare RTXes wrapped with UNSPEC_NOTRAP unspec.
(ix86_expand_sse_compare_and_jump): Ditto.
* config/i386/predicates.md (fcmov_comparison_operator):
Remove CCFPU mode handling.
(ix86_comparison_operator): Ditto.
(ix86_carry_flag_operator): Ditto.
* config/i386/i386.md (UNSPEC_NOTRAP): New unspec.
(*cmpu_i387): Wrap compare RTX with UNSPEC_NOTRAP unspec.
(*cmpu_cc_i387): Ditto.
(FPCMP): Remove mode iterator.
(unord): Remove mode attribute.
(unord_subst): New define_subst transformation
(unord): New define_subst attribute.
(unordered): Ditto.
(*cmpi): Rewrite using unord_subst transformation.
(*cmpixf_i387): Ditto.
* config/i386/sse.md (_comi): Merge
from _comi and _ucomi
using unord_subst transformation.
* config/i386/subst.md (SUBST_A): Remove CCFP and CCFPU modes.
(round_saeonly): Also handle CCFP mode.
* reg-stack.c (subst_stack_regs_pat): Handle UNSPEC_NOTRAP unspec.
Remove UNSPEC_SAHF unspec handling.

testsuite/ChangeLog:

PR target/82692
* gcc.dg/torture/pr82692.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr82692.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386-modes.def
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.md
trunk/gcc/config/i386/predicates.md
trunk/gcc/config/i386/sse.md
trunk/gcc/config/i386/subst.md
trunk/gcc/reg-stack.c
trunk/gcc/testsuite/ChangeLog

[Bug target/82692] [8 Regression] Ordered comparisons used for unordered built-ins

2017-10-27 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82692

Uroš Bizjak  changed:

   What|Removed |Added

 Target|x86_64-*-*  |x86
 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #22 from Uroš Bizjak  ---
Fixed.