This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/25128] [m68k] Suboptimal comparisons against 65536
- From: "gunnar at greyhound-data dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jun 2008 16:02:10 -0000
- Subject: [Bug target/25128] [m68k] Suboptimal comparisons against 65536
- References: <bug-25128-5009@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from gunnar at greyhound-data dot com 2008-06-10 16:02 -------
> Note that
>
> cmp.l #65535,%d0
> jbhi .L10
>
> can be replaced with
>
> swap %d0
> tst.w %d0
> jbne .L10
>
> A similar trick can be applied to signed comparisons as well.
But this "trick" will run slower on the higher 68k CPUs.
On 68040 or 68060 or SuperScalar Coldfire its better to generate less
instructions that do not have dependancies.
I think "cmp.l #65535,%d0" is the code that should be generated by "O2" as its
faster on many 68K models.
The shorter two instruction trick might be an option for compile optiont "Os"
Kind regards
Gunnar von Boehn
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25128