All pastes #464813 Raw Edit

Unnamed

public c v1 · immutable
#464813 ·published 2007-04-29 18:53 UTC
rendered paste body
#include <stdlib.h> int multiply_buf(void *ptr, void  *with, size_t count){	int i;	for(i=0;i<count;i++)	{	asm volatile ("movupd (%0), %%xmm0\n\t"		 "mulps (%1), %%xmm0\n\t"		 "movupd %%xmm0, (%0)"			:			: "r" (ptr+4*i), "r" (with));	}}int main(){	float with[4] = {0.5, 0.5, 0.5, 0.5};	float buffer[1048576];	float f=0.0;	int i;	for(i=0;i<1048576;i++)	{		buffer[i] = f;		f += 0.1;	}	multiply_buf(buffer, with, 1048576);	printf("%f %f %f %f", buffer[0], buffer[1], buffer[2], buffer[3]);}