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"); }