CRIS: Add support for __builtin_clz.

Jesper Nilsson jesper.nilsson@axis.com
Mon Sep 3 11:14:00 GMT 2007


On Sat, Sep 01, 2007 at 02:13:51PM +0200, Hans-Peter Nilsson wrote:
> > Testing has been done for cris-axis-elf on i686-pc-linux-gnu.
> > No new regressions found.
> 
> You should've mentioned the combination of -march= options you
> tested and the fallout you mentioned from *other* test-cases
> that didn't expect separate -march= options.

Right, I was planning to send in this patch. :-)

Testing using multiple architectures for cris means running make check
with some additional parameters:

make check 'RUNTESTFLAGS=--target_board=cris-sim\{,-march=v3,-march=v8,-march=v10\}'

However, this will fail when reaching a testcase that has set
the -march using dg-options to something other than the test-flags,
like the following:

/* { dg-options "-O2 -march=v10" } */

The failure is due to the -march being redefined to a different
arcitecture, that in turn does not support the operation tested:

Testing torture/cris-asm-mof-1.c,  -O0
doing compile
pid is 21039 -21039
close result is 21039 exp8 0 1
output is <command-line>: warning: "__CRIS_arch_version" redefined
<command-line>: warning: this is the location of the previous definition
<command-line>: warning: "__CRIS_arch_version" redefined
<command-line>: warning: this is the location of the previous definition
<command-line>: warning: "__CRIS_arch_version" redefined
<command-line>: warning: this is the location of the previous definition
/home/jespern/cris-cross/no4/gcc_clean/gcc/testsuite/gcc.dg/torture/cris-asm-mof-1.c:
In function 'in2':
/home/jespern/cris-cross/no4/gcc_clean/gcc/testsuite/gcc.dg/torture/cris-asm-mof-1.c:26:
error: can't find a register in class 'MOF_REGS' while reloading 'asm'
/home/jespern/cris-cross/no4/gcc_clean/gcc/testsuite/gcc.dg/torture/cris-asm-mof-1.c:26:
error: 'asm' operand has impossible constraints
status 1
compiler exited with status 1
FAIL: gcc.dg/torture/cris-asm-mof-1.c  -O0  (test for excess errors)
ERROR: gcc.dg/torture/cris-asm-mof-1.c  -O0 : error executing dg-final:
couldn't open "cris-asm-mof-1.s": no such file or directory
Error/Warning threshold exceeded:  1 0 (max. 1 3)


Since the testcase is only valid for the architecture set in the
dg-options, the solution is to add the same as I did for the clz
testcases:

/* { dg-skip-if "" { cris-*-* } { "-march*" } { "" } } */

That is, skip the test if -march is already set.

Thus, here is a patch to gcc.dg/torture/cris-asm-mof-1.c.
Naturally, the patch has been tested on i686-pc-linux-gnu with
make check 'RUNTESTFLAGS=--target_board=cris-sim\{,-march=v3,-march=v8,-march=v10\}'

:ADDPATCH cris-asm-mof-testcase:

testsuite/ChangeLog:

2007-09-03  Jesper Nilsson  <jesper.nilsson@axis.com>

	* gcc.dg/torture/cris-asm-mof-1.c: Skip if -march defined.

Index: gcc.dg/torture/cris-asm-mof-1.c
===================================================================
--- gcc.dg/torture/cris-asm-mof-1.c	(revision 128037)
+++ gcc.dg/torture/cris-asm-mof-1.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile { target cris-*-* } } */
+/* { dg-skip-if "" { cris-*-* } { "-march*" } { "" } } */
 /* { dg-options "-O2 -march=v10" } */
 /* { dg-final { scan-assembler "in-asm: .mof" } } */
 /* { dg-final { scan-assembler "out-asm: .mof" } } */


Best regards,

/^JN - Jesper Nilsson
--
               Jesper Nilsson -- jesper.nilsson@axis.com



More information about the Gcc-patches mailing list