This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add testcase for rotate optimization on IA-32/x86-64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Oct 2004 03:32:40 -0400
- Subject: [PATCH] Add testcase for rotate optimization on IA-32/x86-64
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The testcase below used a rotate instruction at least back in GCC 2.96-RH,
did not get optimized that way in at least GCC 3.2.3, 3.3.4 and 3.4.2 and
seems to be optimized now on CVS HEAD again.
I think it would be better to add a testcase to make sure it doesn't go away
in the future again (grepped the testsuite and did not find any tests for
that). Ok for HEAD?
2004-10-25 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/i386-rotate-1.c: New test.
--- gcc/testsuite/gcc.dg/i386-rotate-1.c.jj 2004-10-25 09:22:37.306278408 +0200
+++ gcc/testsuite/gcc.dg/i386-rotate-1.c 2004-10-25 09:25:26.007321612 +0200
@@ -0,0 +1,16 @@
+/* Verify that rolb instruction is emitted on IA-32/x86-64. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void foo (unsigned char *);
+
+int
+main (void)
+{
+ unsigned char c = 0;
+ foo (&c);
+ c = c >> 1 | c << 7;
+ return c;
+}
+
+/* { dg-final { scan-assembler "rolb" { target i?86-*-* x86_64-*-* } } } */
Jakub