public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ktkachov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/65235] New: [4.8, 4.9, 5 Regression] Simplifying vec_select of vec_concat miscompiles when first element of vec_concat is const_int Date: Fri, 27 Feb 2015 13:09:00 -0000 [thread overview] Message-ID: <bug-65235-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65235 Bug ID: 65235 Summary: [4.8, 4.9, 5 Regression] Simplifying vec_select of vec_concat miscompiles when first element of vec_concat is const_int Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ktkachov at gcc dot gnu.org Target: aarch64 This aarch64 intrinsics testcase aborts. #include "arm_neon.h" int main (int argc, char** argv) { int64x1_t val1; int64x1_t val2; int64x1_t val3; uint64x1_t val13; uint64x2_t val14; uint64_t got; uint64_t exp; val1 = vcreate_s64(UINT64_C(0xffffffff80008000)); val2 = vcreate_s64(UINT64_C(0x0000f38d00000000)); val3 = vcreate_s64(UINT64_C(0xffff7fff0000809b)); // Expect: "val13" = 8000000000001553 val13 = vcreate_u64 (UINT64_C(0x8000000000001553)); // Expect: "val14" = 0010 0000 0000 0002 0000 0000 0000 0000 val14 = vcombine_u64(vcgt_s64(vqrshl_s64(val1, val2), vshr_n_s64(val3, 18)), vshr_n_u64(val13, 11)); /* Should be 0000000000000000. */ got = vgetq_lane_u64(val14, 0); exp = 0; if(exp != got) __builtin_abort (); } Investigation shows that the problem is in the simplify-rtx machinery: Combine tries to combine: (insn 72 71 73 2 (set (reg:V2DI 117 [ D.18177 ]) (vec_concat:V2DI (reg:DI 176 [ D.18179 ]) (reg:DI 114 [ D.18168 ]))) (expr_list:REG_DEAD (reg:DI 176 [ D.18179 ]) (expr_list:REG_DEAD (reg:DI 114 [ D.18168 ]) and (insn 104 102 105 2 (set (reg:DI 193 [ D.18168 ]) (vec_select:DI (reg:V2DI 117 [ D.18177 ]) (parallel [ (const_int 0 [0]) ]))) (expr_list:REG_DEAD (reg:V2DI 117 [ D.18177 ]) (nil))) but ends up generating: (set (reg:DI 193 [ D.18168 ]) (reg:DI 114 [ D.18168 ])) i.e. it picks element 1 instead of the requested element 0. This happens during combine where it tries to to simplify a vec_select 0 of the intermediate rtx: (vec_concat:V2DI (const_int -1 [0xffffffffffffffff]) (reg:DI 114 [ D.18166 ])) The relevant code in simplify-rtx has been there for some time and is broken for all release branches. I have a patch in testing...
next reply other threads:[~2015-02-27 12:24 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-02-27 13:09 ktkachov at gcc dot gnu.org [this message] 2015-02-27 13:20 ` [Bug rtl-optimization/65235] [4.8/4.9/5 " rguenth at gcc dot gnu.org 2015-02-27 13:21 ` rguenth at gcc dot gnu.org 2015-02-27 16:20 ` ktkachov at gcc dot gnu.org 2015-02-27 16:30 ` ktkachov at gcc dot gnu.org 2015-02-27 16:53 ` ktkachov at gcc dot gnu.org 2015-02-27 16:56 ` ktkachov at gcc dot gnu.org 2015-03-02 11:06 ` [Bug rtl-optimization/65235] " jgreenhalgh at gcc dot gnu.org 2015-03-12 13:41 ` ktkachov at gcc dot gnu.org 2015-03-12 13:43 ` ktkachov at gcc dot gnu.org 2015-03-19 10:29 ` ktkachov at gcc dot gnu.org 2015-06-23 9:01 ` rguenth 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-65235-4@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).