dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help required


From: Suvarna
Subject: Help required
Date: Mon, 22 Mar 2004 23:42:48 -0800 (PST)

Hi,

I am writing a Test case for h8300 target. 

My global config file is as follows.

/*  ----------------- Start Config file
------------------------ */
load_lib "framework.exp"

#
# Determine target machines for all known targets
#

verbose "Global Config File: target_triplet is
$target_triplet" 2
global target_list
case "$target_triplet" in {
    { "h8300-*-*" } 
        {
                set target_list { "h8300-sim{-mh,-ms}" 
        }
    }
}

/*  ----------------- End config file
------------------------ */


There is a program given below which I want to run
only when -ms compiler option is specified.

How do I specify this ? Can someone help me ?



/* ----------------- Start of program
----------------------- */

/* { dg-do compile } */
/* { dg-options "-Wall -O2 -mexr" } */

int mon_func(void) __attribute__((monitor));
int mon_func(void)
{
        return 0;
}

void main(void)
{
        int x;
        x = mon_func();
}

/* { dg-final { scan-assembler "exr" } } */

/* ----------------- End of program
----------------------- */


Another problem which I could still not solve is as
follows ( I have posted it long back).

I want to ensure that saveall attribute really saves
all registers on stack.

The problem here is that for various target options
the saving mechanism is different.
e.g. when -ms option is specified the saving would be
done using ldm/stm instruction but 
for other target options it different. 
How do I write a test case which will be applicable
only for specified target option ?

The test program and expected assembly is give at the
end of mail. 
I have marked what I want to test.

Basically I want to ensure that using saveall
attribute really saves
all registers er0 to er7.  How do I match the pairs in
my test case ?

An example would really help.

Thanks in advance.

Regards,

Suv


/* ----------------- Begin program
-------------------- */
register int rg asm("r5");
int a;
__attribute__ ((interrupt_handler,saveall)) void foo()
{
        int b;
        a = 1 ;
        b = a++;
        rg = b;
}
/* ----------------------- End program
----------------------- */

The 'C' program given above should generate H8/300
assembly code some what like

/* --------------- begin --------------- */

;       GCC For the Hitachi H8/300
;       By Hitachi America Ltd and Cygnus Support
; -O3

        .h8300hn
        .file   "test.c"
        .section .text
        .align 1
        .global _foo
_foo:
        mov.l   er6,@-er7
        mov.w   r7,r6
        mov.l   er0,@-er7 ; Test 1.0.1 <-------------
        mov.l   er1,@-er7 ; Test 1.1.1 <----------- 
        mov.l   er2,@-er7 ; Test 1.2.1 <---------
        mov.l   er3,@-er7 ; Test 1.3.1 <-------  |
        mov.l   er4,@-er7 ; Test 1.4.1 <-----  | |
        mov.l   er5,@-er7 ; Test 1.5.1 <---  | | |
        mov.w   #1,r2     ;                | | | |
        mov.w   r2,@_a    ;                | | | |
        mov.w   #_a,r3    ;                | | | | 
        mov.w   r2,r0     ;                | | | | 
        adds    #1,er2    ;                | | | |
        mov.w   r2,@er3   ;                | | | |
        mov.w   r0,r5     ;                | | | |
        mov.l   @er7+,er5 ; Test 1.0.2 <---  | | | 
        mov.l   @er7+,er4 ; Test 1.1.2 <-----  | | 
        mov.l   @er7+,er3 ; Test 1.2.2 <-------  |
        mov.l   @er7+,er2 ; Test 1.3.2 <--------- 
        mov.l   @er7+,er1 ; Test 1.4.2 <-----------
        mov.l   @er7+,er0 ; Test 1.5.2 <-------------
        mov.l   @er7+,er6
        rte ; <------------------------ Test 2
        .comm _a,2
        .ident  "GCC: (GNU) 3.3.1"

/* --------------- end ----------------- */



__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]