This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/64507] SH inlined builtin strncmp doesn't return 0 for 0 length
- From: "chrbr at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Jan 2015 09:36:00 +0000
- Subject: [Bug target/64507] SH inlined builtin strncmp doesn't return 0 for 0 length
- Auto-submitted: auto-generated
- References: <bug-64507-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64507
--- Comment #4 from chrbr at gcc dot gnu.org ---
Actually, the code could be slightly better by factorizing the return sequences
;; check length
mov #0,r0
;; goto .l2
;; else init r1,r0
;; goto .l1
.l2:
rtx
nop
.l1:
rts
sub r1,r0
into
;; check length
mov r1,r0
;; goto l1
;; else init r1,r0
.l1:
rts
sub r1,r0
however this creates an unitilized mov (which we donÂt care) but the backend
keeps forcing an useless mov #0,r1