dejagnu
[Top][All Lists]
Advanced

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

How to test/verify generated assembly code using DejaGNU ?


From: Suvarna
Subject: How to test/verify generated assembly code using DejaGNU ?
Date: Thu, 15 Jan 2004 06:18:22 -0800 (PST)

Hi,

I want to add following test case in the
cross-compiler's test suite. 

Can someone help me ?


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


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 ----------------- */

I have marked what I want to test.

Basically I want to test couple of things.
1. Ensure that using saveall attribute really saves
all registers er0 to er7. 

2. Using interrupt attribute the function returns with
RTE instruction.

Regards,

Suv


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus




reply via email to

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