This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improved trailing bit counting operation


Sorry guys, I'm not sure I understand your point.

ctz is not an ARM instruction, that's why __builtin_ctz is implemented using other existing instructions (rbit, clz).

Is that what you are referring to?

Daniel.

Adam Nemet wrote:
Basile STARYNKEVITCH writes:
Daniel Gutson wrote:
Adam,
  could you please elaborate?
Well the test file name contain ctz, so I would expect that the generated assembler contain that string also.

Right, this is what I meant. E.g.:


anemet@ropi:~/src/gcc/mipsisa64r2-elf/gcc$ touch foo.c
anemet@ropi:~/src/gcc/mipsisa64r2-elf/gcc$ ./cc1 foo.c -quiet -o - |grep foo .file 1 "foo.c"


But I am not an ARM expert!

and neither am I :).


Adam Nemet wrote:
Daniel Gutson <dgutson@codesourcery.com> writes:
Index: src/gcc-mainline/gcc/testsuite/gcc.target/arm/ctz.c
===================================================================
--- src/gcc-mainline/gcc/testsuite/gcc.target/arm/ctz.c    (revision 0)
+++ src/gcc-mainline/gcc/testsuite/gcc.target/arm/ctz.c    (revision 0)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O2 -march=armv6t2" } */
+
+unsigned int functest(unsigned int x)
+{
+    return __builtin_ctz(x);
+}
+
+/* { dg-final { scan-assembler "rbit" } } */
+/* { dg-final { scan-assembler "ctz" } } */
Watch out, this will match the .file directive.

Adam

-- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***

-- Daniel Gutson CodeSourcery www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]