public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67675] New: [SH] Improve __builtin_strcmp alignment test Date: Tue, 22 Sep 2015 01:22:00 -0000 [thread overview] Message-ID: <bug-67675-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67675 Bug ID: 67675 Summary: [SH] Improve __builtin_strcmp alignment test Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- Target: sh*-*-* If the alignments of both input pointers to __builtin_strcmp are not at least 4 bytes, code is emitted to do a run-time check: int foo1 (const char* x, const char* y) { return __builtin_strcmp (x, y); } _foo1: mov r4,r0 or r5,r0 // OR pointers tst #3,r0 // check if both are 4 byte aligned bf.s .L9 If one of the pointers is 4 byte aligned, the OR can be omitted, because we need to check only one pointer's alignement. For example: int foo2 (const char* x, const char* y) { return __builtin_strcmp (__builtin_assume_aligned (x, 4), y); } or also: struct S { int a, b, c; char s[64]; // this array will be always 4 byte aligned. }; int foo4 (struct S* x) { return __builtin_strcmp (x->s, "1234"); }
next reply other threads:[~2015-09-22 1:22 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-22 1:22 olegendo at gcc dot gnu.org [this message] 2015-09-22 1:57 ` [Bug target/67675] " olegendo at gcc dot gnu.org 2015-09-22 2:07 ` olegendo at gcc dot gnu.org 2015-09-25 13:09 ` olegendo 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-67675-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).