public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102860] [12 regression] libgomp.fortran/simd2.f90 ICEs after r12-4526 Date: Tue, 18 Jan 2022 17:21:02 +0000 [thread overview] Message-ID: <bug-102860-4-P1jBvxbJnt@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102860-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102860 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Short testcase: function foo(a) integer(kind=4) :: a(1024) a(:) = modulo (a(:), 39) end function -O2 -mcpu=power10. vect_recog_divmod_pattern only handles TRUNC_{DIV,MOD}_EXPR and EXACT_DIV_EXPR (and isn't guaranteed to succeed anyway), but optab_for_tree_code returns the same smod_optab or sdiv_optab (if signed; FLOOR_* for unsigned is mapped to TRUNC_*). I guess the quickest way would be to punt on {CEIL,FLOOR,ROUND}_{DIV,MOD}_EXPR in the vectorizer and tree-vect-generic.cc Further gradual improvements can be: 1) match.pd has: /* For unsigned integral types, FLOOR_DIV_EXPR is the same as TRUNC_DIV_EXPR. Rewrite into the latter in this case. */ (simplify (floor_div @0 @1) (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) && TYPE_UNSIGNED (type)) (trunc_div @0 @1))) but expmed.cc has: /* Promote floor rounding to trunc rounding for unsigned operations. */ if (unsignedp) { if (code == FLOOR_DIV_EXPR) code = TRUNC_DIV_EXPR; if (code == FLOOR_MOD_EXPR) code = TRUNC_MOD_EXPR; if (code == EXACT_DIV_EXPR && op1_is_pow2) code = TRUNC_DIV_EXPR; } Shouldn't we make it (for floor_divmod (floor_div floor_mod) trunc_divmod (trunc_div trunc_mod) (simplify (floor_divmod @0 @1) (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) && TYPE_UNSIGNED (type)) (trunc_divmod @0 @1)))) ? 2) as the RTL optabs really do just trunc div/mod, perhaps tree-vect-patterns.cc could be changed to replace some or all of those operations with the trunc operation followed by some arith and cond_exprs so that the vectorizer knows actual cost of those operations. E.g. it seems expmed.cc expands r = x %[fl] y; as r = x % y; if (r && (x ^ y) < 0) r += y; and d = x /[fl] y; would be r = x % y; d = x / y; if (r && (x ^ y) < 0) --d; Looking at wide-int.h, r = x %[cl] y; as r = x % y; if (r && (x ^ y) >= 0) r -= y; and d = /[cl] y; as r = x % y; d = x / y; if (r && (x ^ y) >= 0) ++d; All of the above for signed, as I said earlier, unsigned [fl] is the same as trunc and unsigned [cl] should replace (x ^ y) >= 0 with 1. [rd] is even more complex.
next prev parent reply other threads:[~2022-01-18 17:21 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-20 17:45 [Bug target/102860] New: " seurer at gcc dot gnu.org 2021-10-20 18:19 ` [Bug target/102860] " aldyh at gcc dot gnu.org 2021-10-20 19:36 ` pinskia at gcc dot gnu.org 2021-10-21 6:55 ` [Bug middle-end/102860] " rguenth at gcc dot gnu.org 2021-10-26 7:09 ` rguenth at gcc dot gnu.org 2021-10-26 18:13 ` seurer at gcc dot gnu.org 2021-12-15 7:05 ` luoxhu at gcc dot gnu.org 2021-12-15 7:24 ` luoxhu at gcc dot gnu.org 2022-01-17 13:13 ` rguenth at gcc dot gnu.org 2022-01-18 17:21 ` jakub at gcc dot gnu.org [this message] 2022-01-18 18:45 ` jakub at gcc dot gnu.org 2022-01-19 7:27 ` rguenther at suse dot de 2022-01-19 10:01 ` jakub at gcc dot gnu.org 2022-01-19 10:02 ` jakub at gcc dot gnu.org 2022-01-19 14:05 ` cvs-commit at gcc dot gnu.org 2022-01-19 14:06 ` jakub at gcc dot gnu.org 2022-01-24 9:21 ` cvs-commit at gcc dot gnu.org 2022-05-10 8:23 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:23 ` cvs-commit at gcc dot gnu.org 2022-05-11 18:39 ` cvs-commit at gcc dot gnu.org
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-102860-4-P1jBvxbJnt@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).