public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/61747] min,max pattern not always properly optimized (for sse4 targets) Date: Tue, 08 Jul 2014 15:46:00 -0000 [thread overview] Message-ID: <bug-61747-4-XkAMj9E0Pa@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-61747-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61747 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- ;; ??? For !flag_finite_math_only, the representation with SMIN/SMAX ;; isn't really correct, as those rtl operators aren't defined when ;; applied to NaNs. Hopefully the optimizers won't get too smart on us. (define_expand "<code><mode>3<mask_name><round_saeonly_name>" [(set (match_operand:VF 0 "register_operand") (smaxmin:VF (match_operand:VF 1 "<round_saeonly_nimm_predicate>") (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))] "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>" { if (!flag_finite_math_only) operands[1] = force_reg (<MODE>mode, operands[1]); ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands); }) and ;; These versions of the min/max patterns implement exactly the operations ;; min = (op1 < op2 ? op1 : op2) ;; max = (!(op1 < op2) ? op1 : op2) ;; Their operands are not commutative, and thus they may be used in the ;; presence of -0.0 and NaN. (define_insn "*ieee_smin<mode>3" [(set (match_operand:VF 0 "register_operand" "=v,v") (unspec:VF [(match_operand:VF 1 "register_operand" "0,v") (match_operand:VF 2 "nonimmediate_operand" "vm,vm")] UNSPEC_IEEE_MIN))] "TARGET_SSE" ... maybe explain the -O2 code. Note that the middle-end uses min/max regardless of flags and makes it the targets responsibility to disable instructions that don't conform to IEEE. The above suggests that a>b ? a : b isn't IEEE conform on x86.
next prev parent reply other threads:[~2014-07-08 15:46 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-08 13:34 [Bug tree-optimization/61747] New: " vincenzo.innocente at cern dot ch 2014-07-08 14:57 ` [Bug tree-optimization/61747] " glisse at gcc dot gnu.org 2014-07-08 15:21 ` vincenzo.innocente at cern dot ch 2014-07-08 15:27 ` glisse at gcc dot gnu.org 2014-07-08 15:35 ` vincenzo.innocente at cern dot ch 2014-07-08 15:46 ` rguenth at gcc dot gnu.org [this message] 2021-12-13 0:13 ` pinskia at gcc dot gnu.org 2023-07-18 11:15 ` rguenth at gcc dot gnu.org 2023-07-20 7:51 ` cvs-commit at gcc dot gnu.org 2023-07-20 7:52 ` rguenth at gcc dot gnu.org 2023-07-21 5:37 ` pinskia at gcc dot gnu.org 2023-07-21 6:21 ` rguenther at suse dot de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-61747-4-XkAMj9E0Pa@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).