Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ת£ºSSEÖ¸Áî½éÉܼ°ÆäC¡¢C++Ó¦ÓÃ

SSEÊÇÓ¢ÌضûÌá³öµÄ¼´MMXÖ®ºóÐÂÒ»´ú£¨µ±È»ÊǼ¸ÄêÇ°ÁË£©CPUÖ¸Á£¬×îÔçÓ¦ÓÃÔÚPIIIϵÁÐCPUÉÏ¡£ÏÖÔÚÒѾ­µÃµ½ÁËIntel PIII¡¢P4¡¢Celeon¡¢Xeon¡¢AMD Athlon¡¢duronµÈϵÁÐCPUµÄÖ§³Ö¡£¶ø¸üеÄSSE2Ö¸Á½öµÃµ½ÁËP4ϵÁÐCPUµÄÖ§³Ö£¬ÕâÒ²ÊÇΪʲôÕâƪÎÄÕÂÊǽ²SSE¶ø²»ÊÇSSE2µÄÔ­ÒòÖ®Ò»¡£ÁíÒ»¸öÔ­Òò¾ÍÊÇSSEºÍSSE2µÄÖ¸ÁîϵͳÊǷdz£ÏàËƵģ¬SSE2±ÈSSE¶àµÄ½öÊÇÉÙÁ¿µÄ¶îÍ⸡µã´¦Àí¹¦ÄÜ¡¢64λ¸¡µãÊýÔËËãÖ§³ÖºÍ64λÕûÊýÔËËãÖ§³Ö¡£
SSEΪʲô»á±È´«Í³µÄ¸¡µãÔËËã¸ü¿ìÄØ£¿ÒòΪËüʹÓÃÁË128λµÄ´æ´¢µ¥Ôª£¬Õâ¶ÔÓÚ32λµÄ¸¡µãÊýÀ´½²£¬ÊÇ¿ÉÒÔ´æÏÂ4¸öµÄ£¬Ò²¾ÍÊÇ˵£¬SSEÖеÄËùÓмÆË㶼ÊÇÒ»´ÎÐÔÕë¶Ô4¸ö¸¡µãÊýÀ´Íê³ÉµÄ£¬ÕâÖÖÅú´¦Àíµ±È»¾Í»á´øÀ´Ð§ÂʵÄÌáÉý¡£ÎÒÃÇÔÙÀ´»Ø¹ËÒ»ÏÂSSEµÄÈ«³Æ£ºStream SIMD Extentions£¨Á÷SIMDÀ©Õ¹£©¡£SIMD¾ÍÊÇsingle instruction multiple data£¬Á¬ÆðÀ´¾ÍÊÇ“Êý¾ÝÁ÷µ¥Ö¸Áî¶àÊý¾ÝÀ©Õ¹”£¬´ÓÃû×ÖÎÒÃǾͿÉÒÔ¸üºÃµÄÀí½âSSEÊÇÈçºÎ¹¤×÷µÄÁË¡£
ËäÈ»SSE´ÓÀíÂÛÉÏÀ´½²Òª±È´«Í³µÄ¸¡µãÔËËã»á¿ì£¬µ«ÊÇËûËùÊܵÄÏÞÖÆÒ²ºÜ¶à£¬Ê×ÏÈ£¬ËäÈ»ËûÖ´ÐÐÒ»´ÎÏ൱ÓÚËĴΣ¬»á±È´«Í³µÄ¸¡µãÔËËãÖ´ÐÐ4´ÎµÄËÙ¶ÈÒª¿ì£¬µ«ÊÇËûÖ´ÐÐÒ»´ÎµÄËÙ¶ÈÈ´²¢Ã»ÓÐÏëÏóÖеÄÄÇô¿ì£¬ËùÒÔÒªÌåÏÖSSEµÄËٶȣ¬±ØÐëÓÐStream×öÇ°Ìᣬ¾ÍÊÇ´óÁ¿µÄÁ÷Êý¾Ý£¬ÕâÑù²ÅÄÜ·¢»ÓSIMDµÄÇ¿´ó×÷Óá£Æä´Î£¬SSEÖ§³ÖµÄÊý¾ÝÀàÐÍÊÇ4¸ö32루¹²¼Æ128룩¸¡µãÊý¼¯ºÏ£¬¾ÍÊÇC¡¢C++ÓïÑÔÖеÄfloat[4]£¬²¢ÇÒ±ØÐëÊÇÒÔ16λ×ֽڱ߽ç¶ÔÆëµÄ£¨ÉÔºó»áÒÔ´úÂëÀ´½øÐвûÊÍ£¬¹ØÓڱ߽ç¶ÔÆëµÄ¸ÅÄ¶ÁÕß¿ÉÒԲο¼ÂÛ̳ÉϵÄÆäËüÎÄÕ£¬¶¼»áÓкÜÏêϸµÄ½â´ð£¬ÎÒÕâÀï¾ÍË¡²»×¸ÊöÁË£©¡£Òò´ËÕâÒ²¸øÊäÈëºÍÊä³ö´øÀ´Á˲»ÉÙµÄÂé·³£¬Êµ¼ÊÉÏÖ÷ÒªÓ°ÏìSSE·¢»ÓÐÔÄܵľÍÊDz»Í£µÄ¶ÔÊý¾Ý½øÐи´ÖÆÒÔÊÊÓÃÓ¦ËüµÄÊý¾Ý¸ñʽ¡£
ÎÒÊÇÒ»¸öC++³ÌÐòÔ±£¬¶Ô»ã±à²¢²»ºÜÊ죬µ«ÎÒÓÖÏëÓÃSSEÀ´ÓÅ»¯ÎҵijÌÐò£¬ÎÒ¸ÃÔõô×öÄØ£¿ÐÒºÃVC++.netΪÎÒÃÇÌṩÁ˺ܷ½±ãµÄÖ¸ÁîCº¯Êý¼¶µÄ·â×°ºÍC¸ñʽÊý¾ÝÀàÐÍ£¬ÎÒÃÇÖ»ÐèÏñƽʱдC++´úÂëÒ»Ñù¶¨Òå±äÁ¿¡¢µ÷Óú¯Êý¾Í¿ÉÒԺܺõÄÓ¦ÓÃSSEÖ¸ÁîÁË¡£
µ±È»ÁË£¬ÎÒÃÇÐèÒª°üº¬Ò»¸öÍ·Îļþ£¬ÕâÀïÃæ°üÀ¨ÁËÎÒÃÇÐèÒªµÄÊý¾ÝÀàÐͺͺ¯ÊýµÄÉùÃ÷£º
#include <xmmintrin.h>
SSEÔËËãµÄ±ê×¼Êý¾ÝÀàÐÍÖ»ÓÐÒ»¸ö£¬¾ÍÊÇ£º
__m128£¬ËüÊÇÕâÑù¶¨ÒåµÄ£º
typedef struct __declspec(intrin_type) __declspec(align(16)) __m128 {
   float m128_f32[4];
} __m128;
¼ò»¯Ò»Ï£¬¾ÍÊÇ£º
struct __m128
{
   float m128_f32[4];
};
±ÈÈçÒª¶¨ÒåÒ»¸ö__m128±äÁ¿£


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

A51: CALLING C FUNCTIONS from ASSEMBLY

ÒÔÏÂÈ«ÎÄתÔØ×Ôhttp://www.keil.com/support/docs/697.htm                       Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Versio ......

C51: MIXING C AND ASSEMBLY

ÒÔÏÂÈ«ÎÄתÔØ×Ôhttp://www.keil.com/support/docs/1671.htm                     Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Version 6.02
&mi ......

C/C++ÓïÑÔ±à³ÌÐÞÑø1£¨×ª£©

ʲôÊǺõijÌÐòÔ±£¿ÊDz»ÊǶ®µÃºÜ¶à¼¼Êõϸ½Ú£¿»¹ÊǶ®µ×²ã±à³Ì£¿»¹ÊDZà³ÌËٶȱȽϿ죿
ÎÒ¾õµÃ¶¼²»ÊÇ¡£¶ÔÓÚһЩ¼¼Êõϸ½ÚÀ´ËµºÍµ×²ãµÄ¼¼Êõ£¬Ö»Òª¿´°ïÖú£¬²é×ÊÁϾÍÄÜÕÒµ½£¬¶Ô
ÓÚËٶȿ죬ֻҪ±àµÃ¶àÒ²¾ÍÊìÄÜÉúÇÉÁË¡£
 
ÎÒÈÏΪºÃµÄ³ÌÐòÔ±Ó¦¸ÃÓÐÒÔϼ¸·½ÃæµÄËØÖÊ£º
 
  1¡¢ÓÐרÑо«Éñ£¬ÇÚѧÉÆÎÊ¡¢¾ÙÒ»·´ ......

c³ÌÐòʵÏÖÏãÅ©±àÂë

#include <stdio.h>
#include <math.h>
#include <string.h>
int i,j,n,k,b;
float addp;
char bitw[20];
/*³õʼ»¯½á¹¹ÌåÆäÖУºsΪÐÅÔ´·ûºÅ£»pΪÐÅÔ´·ûºÅ¸ÅÂÊ£»paddΪÀÛ¼Ó¸ÅÂÊ£»
l_fΪ-log[p(s[i])]¼´¹À¼ÆÂë×Ö³¤¶È£»lΪʵ¼ÊÐèÒªÂë×Ö³¤¶È£»wΪÂë×Ö*/
 struct shan
 {char s[20];
&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ