File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / macro4 / pipe15.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:30:56 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21

#include "fpp_defs.h"


/*****************************************************************************
*
*		DBL PIPELINE TEST #15 MONITOR
*
*  This test will do:
*
*	LDD(1)  MULD(op1)  DIVD(op2)  DIVD(1)  ADDD(0)  STD
*
*  where 'op1' and 'op2' are the DIVD data patterns.
*****************************************************************************/
pipe_15()
{
	asm(".globl _pipeline_15_t");
	asm("_pipeline_15_t:");			/* entry address            */
	if( (cycle == 1) && (prt_hdrs) )	/* print headers on 1st cycle */
	{
	   writes("\n PIPE_15");
	}
	subtest = 1;
	pipe15_1();				/* data in REGs,  no NOPs */
	subtest++;				/* increment subtest num  */
	pipe15_2();				/* data in REGs,   1 NOP  */
	subtest++;				/* increment subtest num  */
	pipe15_3();				/* data in REGs,   2 NOPs */
	subtest++;				/* increment subtest num  */
	pipe15_4();				/* data in REGs,   3 NOPs */
	subtest++;				/* increment subtest num  */
	pipe15_5();				/* data in CACHE, no NOPs */
	subtest++;				/* increment subtest num  */
	pipe15_6();				/* data in CACHE,  1 NOP  */
	subtest++;				/* increment subtest num  */
	pipe15_7();				/* data in CACHE,  2 NOPs */
	subtest++;				/* increment subtest num  */
	pipe15_8();				/* data in CACHE,  3 NOPs */
	subtest++;				/* increment subtest num  */
	pipe15_9();				/* data via F.P.   0 NOPs */
	asm("jmp *return");			/* return to the test monitor */
}








/************************************************************************
*
*			SUBTEST 1  
*		data in registers, no NO-OPs
*
************************************************************************/
pipe15_1() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   sgl_value_1  = divd_1_data[index].op_1.m;      /* get op_1's MSW  */
	   sgl_value_2  = divd_1_data[index].op_1.l;      /* get op_1's LSW  */
	   sgl_value_3  = divd_1_data[index].op_2.m;      /* get op_2's MSW  */
	   sgl_value_4  = divd_1_data[index].op_2.l;      /* get op_2's LSW  */
	   sgl_value_7  = 0x40800000;		    /* get dbl precision 1.0 */
	   sgl_value_8  = 0;
	   dbl_expected = divd_1_data[index].exp;   /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_1_lp1:");
	   asm("movl _sgl_value_1,r0");		/* move operand 1 to r0/r1  */
	   asm("movl _sgl_value_2,r1");		
	   asm("movl _sgl_value_3,r2");		/* move operand 2 to r2/r3  */
	   asm("movl _sgl_value_4,r3");		
	   asm("movl _sgl_value_7,r4");		/* move a '1.0' to r4/r5    */
	   asm("movl _sgl_value_8,r5");		
	   asm("movl _sgl_value_8,r8");		/* move a '0.0' to r8/r9    */
	   asm("movl _sgl_value_8,r9");		
	   asm("ldd  r4");			/* load a '1.0'     (  1  ) */
	   asm("muld r0");			/* mult by op. 1    ( op1 ) */
	   asm("divd r2");			/* div by operand 2 ( exp ) */
	   asm("divd r4");			/* divide by '1.0'  ( exp ) */
	   asm("addd r8");			/* add '0.0'        ( exp ) */
	   asm("std  r6");			/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_1_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   asm("movl r6,_sgl_value_5");		/* get the result          */
	   asm("movl r7,_sgl_value_6");
	   dbl_st_acc.m = sgl_value_5;
	   dbl_st_acc.l = sgl_value_6;
	   if( (dbl_st_acc.m != dbl_expected.m) ||/* compare the results   */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Reg. Data, no NO-OPs");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_1_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 1 */






/************************************************************************
*
*			SUBTEST 2  
*		data in registers, 1 NO-OP
*
************************************************************************/
pipe15_2() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   sgl_value_1  = divd_1_data[index].op_1.m;      /* get op_1's MSW  */
	   sgl_value_2  = divd_1_data[index].op_1.l;      /* get op_1's LSW  */
	   sgl_value_3  = divd_1_data[index].op_2.m;      /* get op_2's MSW  */
	   sgl_value_4  = divd_1_data[index].op_2.l;      /* get op_2's LSW  */
	   sgl_value_7  = 0x40800000;		    /* get dbl precision 1.0 */
	   sgl_value_8  = 0;
	   dbl_expected = divd_1_data[index].exp;   /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_2_lp1:");
	   asm("movl _sgl_value_1,r0");		/* move operand 1 to r0/r1  */
	   asm("movl _sgl_value_2,r1");		
	   asm("movl _sgl_value_3,r2");		/* move operand 2 to r2/r3  */
	   asm("movl _sgl_value_4,r3");		
	   asm("movl _sgl_value_7,r4");		/* move a '1.0' to r4/r5    */
	   asm("movl _sgl_value_8,r5");		
	   asm("movl _sgl_value_8,r8");		/* move a '0.0' to r8/r9    */
	   asm("movl _sgl_value_8,r9");		
	   asm("ldd  r4");			/* load a '1.0'     (  1  ) */
	   asm("nop");
	   asm("muld r0");			/* mult by op. 1    ( op1 ) */
	   asm("nop");
	   asm("divd r2");			/* div by operand 2 ( exp ) */
	   asm("nop");
	   asm("divd r4");			/* divide by '1.0'  ( exp ) */
	   asm("nop");
	   asm("addd r8");			/* add '0.0'        ( exp ) */
	   asm("nop");
	   asm("std  r6");			/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_2_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   asm("movl r6,_sgl_value_5");		/* get the result          */
	   asm("movl r7,_sgl_value_6");
	   dbl_st_acc.m = sgl_value_5;
	   dbl_st_acc.l = sgl_value_6;
	   if( (dbl_st_acc.m != dbl_expected.m) ||/* compare the results   */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Reg. Data, 1 NO-OP");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_2_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 2 */








/************************************************************************
*
*			SUBTEST 3  
*		data in registers, 2 NO-OPs
*
************************************************************************/
pipe15_3() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   sgl_value_1  = divd_1_data[index].op_1.m;      /* get op_1's MSW  */
	   sgl_value_2  = divd_1_data[index].op_1.l;      /* get op_1's LSW  */
	   sgl_value_3  = divd_1_data[index].op_2.m;      /* get op_2's MSW  */
	   sgl_value_4  = divd_1_data[index].op_2.l;      /* get op_2's LSW  */
	   sgl_value_7  = 0x40800000;		    /* get dbl precision 1.0 */
	   sgl_value_8  = 0;
	   dbl_expected = divd_1_data[index].exp;   /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_3_lp1:");
	   asm("movl _sgl_value_1,r0");		/* move operand 1 to r0/r1  */
	   asm("movl _sgl_value_2,r1");		
	   asm("movl _sgl_value_3,r2");		/* move operand 2 to r2/r3  */
	   asm("movl _sgl_value_4,r3");		
	   asm("movl _sgl_value_7,r4");		/* move a '1.0' to r4/r5    */
	   asm("movl _sgl_value_8,r5");		
	   asm("movl _sgl_value_8,r8");		/* move a '0.0' to r8/r9    */
	   asm("movl _sgl_value_8,r9");		
	   asm("ldd  r4");			/* load a '1.0'     (  1  ) */
	   asm("nop");
	   asm("nop");
	   asm("muld r0");			/* mult by op. 1    ( op1 ) */
	   asm("nop");
	   asm("nop");
	   asm("divd r2");			/* div by operand 2 ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("divd r4");			/* divide by '1.0'  ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("addd r8");			/* add '0.0'        ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("std  r6");			/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_3_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   asm("movl r6,_sgl_value_5");		/* get the result          */
	   asm("movl r7,_sgl_value_6");
	   dbl_st_acc.m = sgl_value_5;
	   dbl_st_acc.l = sgl_value_6;
	   if( (dbl_st_acc.m != dbl_expected.m) ||/* compare the results   */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Reg. Data, 2 NO-OPs");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_3_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 3 */







/************************************************************************
*
*			SUBTEST 4  
*		data in registers, 3 NO-OPs
*
************************************************************************/
pipe15_4() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   sgl_value_1  = divd_1_data[index].op_1.m;      /* get op_1's MSW  */
	   sgl_value_2  = divd_1_data[index].op_1.l;      /* get op_1's LSW  */
	   sgl_value_3  = divd_1_data[index].op_2.m;      /* get op_2's MSW  */
	   sgl_value_4  = divd_1_data[index].op_2.l;      /* get op_2's LSW  */
	   sgl_value_7  = 0x40800000;		    /* get dbl precision 1.0 */
	   sgl_value_8  = 0;
	   dbl_expected = divd_1_data[index].exp;   /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_4_lp1:");
	   asm("movl _sgl_value_1,r0");		/* move operand 1 to r0/r1  */
	   asm("movl _sgl_value_2,r1");		
	   asm("movl _sgl_value_3,r2");		/* move operand 2 to r2/r3  */
	   asm("movl _sgl_value_4,r3");		
	   asm("movl _sgl_value_7,r4");		/* move a '1.0' to r4/r5    */
	   asm("movl _sgl_value_8,r5");		
	   asm("movl _sgl_value_8,r8");		/* move a '0.0' to r8/r9    */
	   asm("movl _sgl_value_8,r9");		
	   asm("ldd  r4");			/* load a '1.0'     (  1  ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("muld r0");			/* mult by op. 1    ( op1 ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("divd r2");			/* div by operand 2 ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("divd r4");			/* divide by '1.0'  ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("addd r8");			/* add '0.0'        ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("std  r6");			/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_4_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   asm("movl r6,_sgl_value_5");		/* get the result          */
	   asm("movl r7,_sgl_value_6");
	   dbl_st_acc.m = sgl_value_5;
	   dbl_st_acc.l = sgl_value_6;
	   if( (dbl_st_acc.m != dbl_expected.m) ||/* compare the results   */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Reg. Data, 3 NO-OPs");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_4_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 4 */








/************************************************************************
*
*			SUBTEST 5  
*		data in cache, no NO-OPs
*
************************************************************************/
pipe15_5() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   dbl_value_1  = divd_1_data[index].op_1;  /* get dbl operand # 1   */
	   dbl_value_2  = divd_1_data[index].op_2;  /* get dbl operand # 2   */
	   dbl_expected = divd_1_data[index].exp;   /* get expected results  */
	   dbl_dummy1.m = 0x40800000;		    /* get dbl precision 1.0 */
	   dbl_dummy1.l = 0;
	   dbl_dummy2.m = 0;			    /* get dbl precision 0.0 */
	   dbl_dummy2.l = 0;
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_5_lp1:");
	   asm("ldd  _dbl_dummy1");		/* load a '1.0'     (  1  ) */
	   asm("muld _dbl_value_1");		/* mult by op. 1    ( op1 ) */
	   asm("divd _dbl_value_2");		/* div by operand 2 ( exp ) */
	   asm("divd _dbl_dummy1");		/* divide by '1.0'  ( exp ) */
	   asm("addd _dbl_dummy2");		/* add a '0.0'      ( exp ) */
	   asm("std  _dbl_st_acc");		/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_5_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) || /* compare the results  */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Cache Data, no NO-OPs");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_5_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 5 */







/************************************************************************
*
*			SUBTEST 6  
*		data in cache, 1 NO-OP
*
************************************************************************/
pipe15_6() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   dbl_value_1  = divd_1_data[index].op_1;  /* get dbl operand # 1   */
	   dbl_value_2  = divd_1_data[index].op_2;  /* get dbl operand # 2   */
	   dbl_expected = divd_1_data[index].exp;   /* get expected results  */
	   dbl_dummy1.m = 0x40800000;		    /* get dbl precision 1.0 */
	   dbl_dummy1.l = 0;
	   dbl_dummy2.m = 0;			    /* get dbl precision 0.0 */
	   dbl_dummy2.l = 0;
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_6_lp1:");
	   asm("ldd  _dbl_dummy1");		/* load a '1.0'     (  1  ) */
	   asm("nop");
	   asm("muld _dbl_value_1");		/* mult by op. 1    ( op1 ) */
	   asm("nop");
	   asm("divd _dbl_value_2");		/* div by operand 2 ( exp ) */
	   asm("nop");
	   asm("divd _dbl_dummy1");		/* divide by '1.0'  ( exp ) */
	   asm("nop");
	   asm("addd _dbl_dummy2");		/* add a '0.0'      ( exp ) */
	   asm("nop");
	   asm("std  _dbl_st_acc");		/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_6_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) || /* compare the results  */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Cache Data, 1 NO-OP");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_6_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 6 */








/************************************************************************
*
*			SUBTEST 7  
*		data in cache, 2 NO-OPs
*
************************************************************************/
pipe15_7() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   dbl_value_1  = divd_1_data[index].op_1;  /* get dbl operand # 1   */
	   dbl_value_2  = divd_1_data[index].op_2;  /* get dbl operand # 2   */
	   dbl_expected = divd_1_data[index].exp;   /* get expected results  */
	   dbl_dummy1.m = 0x40800000;		    /* get dbl precision 1.0 */
	   dbl_dummy1.l = 0;
	   dbl_dummy2.m = 0;			    /* get dbl precision 0.0 */
	   dbl_dummy2.l = 0;
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_7_lp1:");
	   asm("ldd  _dbl_dummy1");		/* load a '1.0'     (  1  ) */
	   asm("nop");
	   asm("nop");
	   asm("muld _dbl_value_1");		/* mult by op. 1    ( op1 ) */
	   asm("nop");
	   asm("nop");
	   asm("divd _dbl_value_2");		/* div by operand 2 ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("divd _dbl_dummy1");		/* divide by '1.0'  ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("addd _dbl_dummy2");		/* add a '0.0'      ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("std  _dbl_st_acc");		/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_7_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) || /* compare the results  */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Cache Data, 2 NO-OPs");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_7_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 7 */







/************************************************************************
*
*			SUBTEST 8  
*		data in cache, 3 NO-OPs
*
************************************************************************/
pipe15_8() 
{
	force_loop = FALSE;			/* clear the force_loop flg */
	index = 0;
	do 
	{
	   dbl_value_1  = divd_1_data[index].op_1;  /* get dbl operand # 1   */
	   dbl_value_2  = divd_1_data[index].op_2;  /* get dbl operand # 2   */
	   dbl_expected = divd_1_data[index].exp;   /* get expected results  */
	   dbl_dummy1.m = 0x40800000;		    /* get dbl precision 1.0 */
	   dbl_dummy1.l = 0;
	   dbl_dummy2.m = 0;			    /* get dbl precision 0.0 */
	   dbl_dummy2.l = 0;
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_8_lp1:");
	   asm("ldd  _dbl_dummy1");		/* load a '1.0'     (  1  ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("muld _dbl_value_1");		/* mult by op. 1    ( op1 ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("divd _dbl_value_2");		/* div by operand 2 ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("divd _dbl_dummy1");		/* divide by '1.0'  ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("addd _dbl_dummy2");		/* add a '0.0'      ( exp ) */
	   asm("nop");
	   asm("nop");
	   asm("nop");
	   asm("std  _dbl_st_acc");		/* store the result ( exp ) */
	   if( force_loop )
	       asm("brb _pipe15_8_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) || /* compare the results  */
	       (dbl_st_acc.l != dbl_expected.l) )
	   {
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) 
		 print_pipe15_er("Cache Data, 3 NO-OPs");
	      if ( halt_flg ) 			/* halt on error?           */
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_8_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
}  /* end of subtest 8 */








/******************************************************************************
*
*			SUBTEST 9  
*
*	Get the data via the FRAME POINTER ( quad word indexed )
*
*	 ADDRESSES OF DATA OPERANDS    INDEX       DATA
*	pointer_data,-4     ( FP+40 )    5     the STF result goes here
*	pointer_data-8,-12  ( FP+32 )    4     <operand #1 data>
*	pointer_data-16,-20 ( FP+24 )    3     <operand #2 data>
*	pointer_data-24,-28 ( FP+16 )    2     < '1.0'  data>
*	pointer_data-32,-36 ( FP+8  )    1     < '0.0'  data>
*	pointer_data-40,-44 (  FP   )    0     point the frame pointer here
*
* NOTE: The double precision instructions are using Quad Word indexing.
******************************************************************************/
pipe15_9() 
{
	asm("moval (r13),_pre_event_fp");	/* save the frame pointer   */ 
	asm("moval (r14),_pre_event_sp");	/* save the stack pointer   */ 
	force_loop = FALSE;			/* clear force_loop flag */
	index = 0;
	do 
	{
	   sgl_value_1  = divd_1_data[index].op_1.m;  /* get op. #1's MSW   */
	   sgl_value_2  = divd_1_data[index].op_1.l;  /* get op. #1's LSW   */
	   sgl_value_3  = divd_1_data[index].op_2.m;  /* get op. #2's MSW   */
	   sgl_value_4  = divd_1_data[index].op_2.l;  /* get op. #2's LSW   */
	   sgl_value_7  = 0x40800000;		      /* get the '1.0' data */
	   sgl_value_8  = 0;
	   dbl_expected = divd_1_data[index].exp;   /* get expected results  */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe15_9_lp1:");
	   asm("moval _pointer_data,_sgl_value_9");/* get store data's addr  */
	   sgl_value_9 -= 8;
	   asm("movl _sgl_value_2,*_sgl_value_9"); /* set operand #1's LSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_1,*_sgl_value_9"); /* set operand #1's MSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_4,*_sgl_value_9"); /* set operand #2's LSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_3,*_sgl_value_9"); /* set operand #2's MSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_8,*_sgl_value_9"); /* set '1.0' data's LSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_7,*_sgl_value_9"); /* set '1.0' data's MSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_8,*_sgl_value_9"); /* set '0.0' data's LSW   */
	   sgl_value_9 -= 4;
	   asm("movl _sgl_value_8,*_sgl_value_9"); /* set '0.0' data's MSW   */
	   sgl_value_9 -= 8;			   /* get FRAME PTR's value  */
	   asm("movl _sgl_value_9,r13");	   /* set the FRAME POINTER  */
	   asm("movl $1,r2");			/* r2 index = 1 quadwords    */
	   asm("movl $2,r3");			/* r3 index = 2 quadwords    */
	   asm("movl $3,r4");			/* r4 index = 3 quadwords    */
	   asm("movl $4,r5");			/* r5 index = 4 quadwords    */
	   asm("movl $5,r6");			/* r6 index = 5 quadwords    */
	   asm("ldd  (r13)[r3]");		/* load a '1.0'      (  0  ) */
	   asm("muld (r13)[r5]");		/* mult by op. #1    ( op1 ) */
	   asm("divd (r13)[r4]");		/* divide by op. #2  ( exp ) */
	   asm("divd (r13)[r3]");		/* divide by '1.0'   ( exp ) */
	   asm("addd (r13)[r2]");		/* add '0.0'         ( exp ) */
	   asm("std  (r13)[r6]");		/* store the result  ( exp ) */
	   if( force_loop )
	       asm("brw _pipe15_9_lp1");;	/* run the loop again      */
/* 
 * verify the results
*/
	   asm("moval (r13),_sgl_value_10");	/* save the frame pointer  */
	   asm("movl _pointer_data,_sgl_value_6"); /* save the LSW stored  */
	   asm("movl _pointer_data-4,_sgl_value_5"); /*   and the MSW      */
	   if( (sgl_value_5  != dbl_expected.m) || /* verify the result... */
	       (sgl_value_6  != dbl_expected.l) || /* verify the result... */
	       (sgl_value_10 != sgl_value_9) )	   /* ... and the final FP */
	   {
	      asm("movl _pre_event_fp,r13");	/* restore frame pointer   */
	      asm("movl _pre_event_sp,r14");	/* restore stack pointer   */
	      errcnt++;				/* bump the error count    */
	      if ( prt_error ) {
		 print_pipe15_er("indexed FP addressing.\n");
		 writes("final Frame Pointer = ");
		 write32h( sgl_value_10 );
		 writes(",  expected FP = ");
		 write32h( sgl_value_9 );
		 writes(" \n");
	      }
	      if ( halt_flg )
		 pipe15_er_hlt( subtest );
	      if ( loop_on_err ) {
		 force_loop = TRUE;		/* set the force loop flag */
		 asm("brw _pipe15_9_lp1");	/* and loop                */
	      }
	   }   /* end of compare error */
	} while( index++ < max_divd_1_index );
	asm("movl _pre_event_fp,r13");		/* restore the frame pointer */
	asm("movl _pre_event_sp,r14");		/* restore the stack pointer */
}  /* end of subtest 9 */


/******************************************************************************
*
*			ERROR ROUTINE
*
*	print an error in the following form
*
*operand 1 = xxxxxxxx xxxxxxxx,    final Acc = xxxxxxxx xxxxxxxx,   index = dd
*operand 2 = xxxxxxxx xxxxxxxx, expected Acc = xxxxxxxx xxxxxxxx
*
******************************************************************************/
print_pipe15_er(msg)
char *msg;
{
	writes(" \n");		/* start a new print line   */
	writes("cycle: ");
	writed( cycle );
	writes(" test ");
	writed( test_no );
	writes("  (Pipe 15), subtest ");
	writed( subtest );
	writes(" error - ");
	writes( msg );
	writec('\n');
	writes(" LDD(1.0)  MULD(op1)  DIVD(op2)  DIVD(1.0)  ADDD(0.0)  STD\n");
	writes("operand 1 = ");
	write32h( sgl_value_1 );
	writec(' ');
	write32h( sgl_value_2 );
	writes(",    final Acc = ");
	write32h( dbl_st_acc.m );
	writec(' ');
	write32h( dbl_st_acc.l );
	writes(",   index = ");
	writed( index );
	writec('\n');
	writes("operand 2 = ");
	write32h( sgl_value_3 );
	writec(' ');
	write32h( sgl_value_4 );
	writes(", expected Acc = ");
	write32h( dbl_expected.m );
	writec(' ');
	write32h( dbl_expected.l );
	writec('\n');
}





/******************************************************************************
*
*			HALT ON ERROR ROUTINE
*
*  	halt with the necessary information saved in the registers
*
******************************************************************************/
pipe15_er_hlt( subtest )
int subtest;
{
	sgl_value_5 = dbl_st_acc.m;
	sgl_value_6 = dbl_st_acc.l;
	sgl_value_7 = dbl_expected.m;
	sgl_value_8 = dbl_expected.l;
	asm("movl _test_no,r0");		/* r0 = test number        */
	asm("movl _subtest,r1");		/* r1 = subtest number     */
	asm("movl $1,r2");			/* r2 = error code         */
	asm("movl _cycle,r3");			/* r3 = cycle count        */
	asm("movl _sgl_value_1,r4");		/* r4 = MSW operand one    */
	asm("movl _sgl_value_2,r5");		/* r5 = LSW operand one    */
	asm("movl _sgl_value_3,r6");		/* r6 = MSW operand two    */
	asm("movl _sgl_value_4,r7");		/* r7 = LSW operand two    */
	asm("movl _sgl_value_5,r8");		/* r8 = MSW operand stored */
	asm("movl _sgl_value_6,r9");		/* r9 = LSW operand stored */
	asm("movl _sgl_value_7,r10");		/* r10 = MSW operand exp   */
	asm("movl _sgl_value_8,r11");		/* r11 = LSW operand exp   */
	asm("movl _index,r12");			/* r12 = data index        */
	if( subtest == 9 ) {
		asm("movl _sgl_value_10,r13");	/* r13 = final FP value     */
		asm("movl _sgl_value_9,r14");	/* r14 = expected FP value  */
	};
	asm(".globl _pipe15_1_hlt");
	asm("_pipe15_1_hlt:");			/* PC after the halt       */
	asm("halt");				/* HALT ...                */
}  /* end of halt on error */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.