pgoexample.c

来自「ADI Blackfin DSP BF535 简单范例程序」· C语言 代码 · 共 38 行

C
38
字号
/****************************************************************************
 *
 *	       File: PgoExample.c
 *
 *	Description: Used to demonstrate the basic operation of Profile 
 *               Guided Optimization.  
 *
 *               Read incoming data from address 0xFFD00000 and count the 
 *               number of even values and odd values.  Supplying data files 
 *               with varying numbers of odd values vs. even values will 
 *               direct the compiler to optimize the conditional statement 
 *               with a bias for the branch most likely to be taken.
 *
 ****************************************************************************/

unsigned int odds  = 0;
unsigned int evens = 0;
volatile int* data = (volatile int*)0xFFD00000;

int main( int argc, char* argv[] )
{
	int i;

	for( i=0; i<256; i++ )
	{
		if( (*data & 0xff) % 2 != 0 )
		{
			odds++;
		}
		else
		{
			evens++;
		}
	}
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?