ImageVerifierCode 换一换
格式:PPT , 页数:70 ,大小:786.73KB ,
资源ID:14128527      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/14128527.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(深入理解计算机系统-复习-清华.ppt)为本站上传会员【仙人****88】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

深入理解计算机系统-复习-清华.ppt

1、单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,2010/10/24,#,Click to edit Master text styles,Second Level,Third level,Fourth level,Click to edit Master title style,#,15-213,F08,Click to edit Master text styles,Second Level,Third level,Fourth level,Click to edit Master title style,#,15-213,F08,计算机组成原理,Zha

2、ng,Youhui,(,张悠慧,),zyh02,2010,秋季,课程回顾,Topics,计算机系统结构等相关概念与范畴,数的表示,汇编语言与,C,语言,代码优化,计算机系统结构等相关概念与范畴,概念,计算机系统结构,编写出能够在机器上正确运行的系统程序所 必须了解到的计算机系统的属性,研究计算机系统软件与硬件的功能分配,确 定计算机系统软件与硬件的分界面,研究计算机系统的外部特性,即程序员所看 到的计算机系统属性,程序员看到的计算机系统属性,数据表示:硬件直接认别和处理的数据类型,寻址技术:编址方式、寻址方式和定位方式,寄存器定义:寄存器定义、数量和使用规则,指令系统:指令的操作类型、格式、排

3、序等,存储系统:要求速度高、容量大、价格便宜,中断系统:中断类型、中断级别和响应方式,输入输出系统:数据交换方式、交换过程控制,机器工作状态:定义和切换方式,如内核态、执行态、管理态和用户态等,概念,计算机组成,计算机系统的逻辑实现,设计功能部件:处理器,主存储器等,数据通路的宽度,各种操作对功能部件的共享程度,确定功能部件的并行度,设计缓冲和排队策略,设计控制机构,采用何种可靠性技术,概念,汇编语言,用符号表示的机器语言,可包括宏构造,概念,冯诺依曼计算机,特点,:,存储程序、运算器为中心、集中控制,存储器是字长固定的、顺序线性编址的一维结构,每个地址是唯一定义的,由指令形式的低级机器语言驱

4、动,指令顺序执行,一般按照指令在存储器中存放的顺序执行,程序分支由转移指令实现,运算器为中心,输入输出设备与存储器之间的数据传送都途经运算器,集中控制,运算器、存储器、输入输出设备的操作以及它们之间的联系都由控制器控制,现代处理器运算速度计算公式:,P,Fz X IPC X TPC,其中,:Fz,为处理机的工作主频,IPC(Instruction Per Cycle),指令级并行度,TPC(Threading Per Cycle),线程级并行度,例如:主频,3GHz,,,4,核,Pentium4,处理器的最高运算速度为:,P,3GHz X 4IPC X 4TPC=48GIPS,即:每秒钟,48

5、0,亿次,概念,处理器运算速度,提高处理器性能的主要途径,(1),提高主频,Fz,:,增加流水线级数,依靠计算机系统结构,缩短门电路延迟时间,依靠电子技术,(2),提高指令级并行度,IPC,依靠并行算法和计算机系统结构,(3),提高线程级并行度,TPC,依靠并行算法、程序设计和计算机系统结构,近期出现的新问题:,线延迟大于门延迟,漏电流很大,功耗惊人,近期提高计算机性能的途径,只能依靠并行算法、程序设计和计算机系统结构,不能指望电子技术,不仅对计算机系统结构,而且对并行算法、软件技术和计算机应用技术都将产生深远的 影响,概念,指令执行速度,平均速度,概念,Amdahl,定律,数的表示,Bits

6、Bytes,and Integers,Sizes of C Objects(in Bytes),C Data TypeTypical 32-bitIntel IA32x86-64,char111,short222,int444,long448,long long888,float444,double888,long double810/1210/16,char*448,Or any other pointer,Bit-Level Operations in C,Operations&,|,Available in C,Logic Operations in C,&,|,!,View 0 as

7、False”,Anything nonzero as“True”,Always return 0 or 1,Early termination,Shift Operations,Logical vs.Arithmetic,Shift amount 0 or,word size,Signed vs.Unsigned in C,Constants,By default,are considered to be,signed integers,Unsigned if have“U”as suffix,0U,4294967259U,Casting,Explicit casting between s

8、igned&unsigned same as U2T and T2U,int tx,ty;,unsigned ux,uy;,tx=(int)ux;,uy=(unsigned)ty;,Implicit casting also occurs via assignments and procedure calls,tx=ux;,uy=ty;,Unsigned is dangerous!,Integer C Puzzles Revisited,x 0,(x*2)=0,x&7=7,(x30)-1,x y,-x=0,x 0&y 0,x+y 0,x=0,-x=0,x=0,(x|-x)31=-1,ux 3=

9、ux/8,x 3=x/8,x&(x-1)!=0,int x=foo();,int y=bar();,unsigned ux=x;,unsigned uy=y;,Initialization,Floating Point,Representation,Bits to right of“binary point”represent fractional powers of 2,Represents rational number:,b,i,b,i,1,b,2,b,1,b,0,b,1,b,2,b,3,b,j,.,1,2,4,2,i,1,2,i,1/2,1/4,1/8,2,j,Numerical Fo

10、rm,1,s,M,2,E,Sign bit,s,determines whether number is negative or positive,Significand,M,normally a fractional value in range 1.0,2.0).,Exponent,E,weights value by power of two,Encoding,MSB is sign bit,exp,field encodes,E,frac,field encodes,M,Sizes,Single precision:8 exp bits,23 frac bits,Double prec

11、ision:11,exp,bits,52,frac,bits,Extended precision:15,exp,bits,63,frac,bits,Floating Point Representation,s,exp,frac,“Normalized”Numeric Values,Condition,exp,000,0,and,exp,111,1,Exponent coded as,biased,value,E,=,Exp Bias,Exp,:unsigned value denoted by,exp,Bias,:Bias value,Single precision:127(,Exp,:

12、1254,E,:-126127),Double precision:1023(,Exp,:12046,E,:-10221023),in general:,Bias,=2,e-1,-1,where e is number of exponent bits,Significand coded with implied leading 1,M,=,1.xxx,x,2,xxx,x,:bits of,frac,Minimum when,000,0,(,M,=1.0),Maximum when,111,1,(,M,=2.0,),Get extra leading bit for“free”,Denorma

13、lized Values,Condition,exp,=,000,0,Value,Exponent value,E,=,Bias,+1,Significand value,M,=,0.xxx,x,2,xxx,x,:bits of,frac,Cases,exp,=,000,0,frac,=,000,0,Note that have distinct values+0 and 0,exp,=,000,0,frac,000,0,Condition,exp,=,111,1,Cases,exp,=,111,1,frac,=,000,0,Represents value,(infinity),Operat

14、ion that overflows,Both positive and negative,exp,=,111,1,frac,000,0,Not-a-Number(NaN),s exp frac,E,Value,0 0000 000-60,0 0000 001-61/8*1/64=1/512,0 0000 010-62/8*1/64=2/512,0 0000 110-66/8*1/64=6/512,0 0000 111-67/8*1/64=7/512,0 0001000-68/8*1/64=8/512,0 0001 001 -69/8*1/64=9/512,0 0110 110-114/8*1

15、/2=14/16,0 0110 111-115/8*1/2=15/16,0 0111 00008/8*1 =1,0 0111 00109/8*1 =9/8,0 0111 010010/8*1 =10/8,0 1110110714/8*128=224,0 1110 111715/8*128=240,0 1111 000n/ainf,closest to zero,largest denorm,smallest norm,closest to 1 below,closest to 1 above,largest norm,Denormalized,numbers,Normalized,number

16、s,Round-To-Even,Binary Fractional Numbers,“Even”when least significant bit is,0,Half way when bits to right of rounding position=,100,2,Examples,Round to nearest 1/4(2 bits right of binary point),ValueBinaryRoundedActionRounded Value,2 3/32,10.00,011,2,10.00,2,(1/2up),2 1/4,2 7/8,10.11,100,2,11.00,2

17、1/2up),3,2 5/8,10.10,100,2,10.10,2,(1/2down),2 1/2,Floating Point in C,C Guarantees Two Levels,float,single precision,double,double precision,Conversions,Casting between,int,float,and,double,changes numeric values,Double,or,float,to,int,Truncates fractional part,Like rounding toward zero,Not defin

18、ed when out of range or NaN,Generally sets to Tmin or Tmax,int,to,double,Exact conversion,as long as int has,53 bit word size,int,to,float,Will round according to rounding mode,Floating Point Puzzles,For each of the following C expressions,either:,Argue that it is true for all argument values,Explai

19、n why not true,x=(int)(float)x,x=(int)(double)x,f=(float)(double)f,d=(float)d,f=-(-f);,2/3=2/3.0,d 0.0,(d*2)f,-f -d,d*d=0.0,(d+f)-d=f,int x=;,float f=;,double d=;,Assume neither,d,nor,f,is NaN,汇编与,C,语言,movl,Operand Combinations,Cannot do memory-memory transfer with a single instruction,movl,Imm,Reg,

20、Mem,Reg,Mem,Reg,Mem,Reg,Source,Dest,C Analog,movl$0 x4,%eax,temp=0 x4;,movl$-147,(%eax),*p=-147;,movl%eax,%edx,temp2=temp1;,movl%eax,(%edx),*p=temp;,movl(%eax),%edx,temp=*p;,Src,Dest,Indexed Addressing Modes,Most General Form,D(Rb,Ri,S)MemRegRb+S*RegRi+D,D:Constant“displacement”,Rb:Base register:Any

21、 of 8 integer registers,Ri:Index register:Any,except for,%esp,Unlikely youd use,%ebp,either,S:Scale:1,2,4,or 8,Special Cases,(Rb,Ri)MemRegRb+RegRi,D(Rb,Ri)MemRegRb+RegRi+D,(Rb,Ri,S)MemRegRb+S*RegRi,Address Computation Instruction,leal,Src,Dest,Src,is address mode expression,Set,Dest,to address denot

22、ed by expression,Uses,Computing addresses without a memory reference,E.g.,translation of,p=,Computing arithmetic expressions of the form x+k*y,k=1,2,4,or 8.,%rax,%rdx,%rcx,%rbx,%rsi,%rdi,%rsp,%rbp,x86-64 General Purpose Registers,Extend existing registers.Add 8 new ones.,Make,%ebp,/,%rbp,general pur

23、pose,%eax,%edx,%ecx,%ebx,%esi,%edi,%esp,%ebp,%r8,%r9,%r10,%r11,%r12,%r13,%r14,%r15,%r8d,%r9d,%r10d,%r11d,%r12d,%r13d,%r14d,%r15d,Swap in 64-bit Mode,Operands passed in registers,First(,xp,)in,%rdi,second(,yp,)in,%rsi,64-bit pointers,No stack operations required,32-bit data,Data held in registers,%ea

24、x,and,%edx,mov,l,operation,void swap(int*xp,int*yp),int t0=*xp;,int t1=*yp;,*xp=t1;,*yp=t0;,swap:,movl(%rdi),%edx,movl(%rsi),%eax,movl%eax,(%rdi),movl%edx,(%rsi),retq,Reading Condition Codes,SetX Instructions,Set single byte based on combinations of condition codes,Conditional Branch Example,int abs

25、diff(,int x,int y),int result;,if(x y),result=x-y;,else,result=y-x;,return result;,absdiff:,pushl%ebp,movl%esp,%ebp,movl 8(%ebp),%edx,movl 12(%ebp),%eax,cmpl%eax,%edx,jle .L7,subl%eax,%edx,movl%edx,%eax,.L8:,leave,ret,.L7:,subl%edx,%eax,jmp .L8,Body1,Set,Up,Finish,Body2,pushl%ebp,movl%esp,%ebp,pushl

26、ebx,movl8(%ebp),%ecx,movl12(%ebp),%edx,movl%ecx,%ebx,subl%edx,%ebx,movl%edx,%eax,subl%ecx,%eax,cmpl%edx,%ecx,cmovg%ebx,%eax,popl%ebx,popl%ebp,ret,int absdiff(,int x,int y),int result;,if(x y),result=x-y;,else,result=y-x;,return result;,Gcc 4.3.4,New Conditional Branch Example,Implementing Loops,IA3

27、2,All loops translated into form based on“do-while”,x86-64,Also make use of“jump to middle”,Why the Difference,IA32 compiler developed for machine where all operations costly,x86-64 compiler developed for machine where unconditional branches incur(almost)no overhead,“For”,“While”,“Do-While”,for(,Ini

28、t,;,Test,;,Update,),Body,Init,;,while(,Test,),Body,Update,;,Goto Version,Init,;,if(!,Test,),goto,done,;,loop:,Body,Update,;,if(,Test,),goto,loop,;,done:,While Version,For Version,Do-While Version,Init,;,if(!,Test,),goto,done,;,do,Body,Update,;,while(,Test,),done,:,“For”,“While”(Jump-to-Middle),for(,

29、Init,;,Test,;,Update,),Body,Init,;,while(,Test,),Body,Update,;,Init,;,goto,middle,;,loop:,Body,Update,;,middle:,if(,Test,),goto,loop,;,done:,While Version,For Version,Goto Version,Switch Statements,Implementation Options,Series of conditionals,Organize in tree structure,Logarithmic performance,Jump

30、Table,Lookup branch target,Constant time,Possible when cases are small integer constants,GCC,Picks one based on case structure,Stack,Pointer,%esp,yoo,who,proc,Frame,Pointer,%ebp,Stack,“Top”,IA32-,Stack Frames,Contents,Local variables,Return information,Temporary space,Management,Space allocated when

31、 enter procedure,“Set-up”code,Deallocated when return,“Finish”code,Pointers,Stack pointer,%esp,indicates stack top,Frame pointer,%ebp,indicates start of current frame,amI,IA32/Linux Stack Frame,Current Stack Frame(“Top”to Bottom),Parameters for function about to call,“Argument build”,Local variables

32、If cant keep in registers,Saved register context,Old frame pointer,Caller Stack Frame,Return address,Pushed by,call,instruction,Arguments for this call,Stack Pointer,(,%esp,),Frame Pointer,(,%ebp,),Return Addr,Saved,Registers,+,Local,Variables,Argument,Build,Old%ebp,Arguments,Caller,Frame,IA32/Linu

33、x Register Usage,Integer Registers,Two have special uses,%ebp,%esp,Three managed as callee-save,%ebx,%esi,%edi,Old values saved on stack prior to using,Three managed as caller-save,%eax,%edx,%ecx,Do what you please,but expect any callee to do so,as well,Register,%eax,also stores returned value,%eax,

34、edx,%ecx,%ebx,%esi,%edi,%esp,%ebp,Caller-Save,Temporaries,Callee-Save,Temporaries,Special,%rax,%rbx,%rcx,%rdx,%rsi,%rdi,%rsp,%rbp,x86-64 Register Conventions,%r8,%r9,%r10,%r11,%r12,%r13,%r14,%r15,Return Value,Callee Saved,Argument#4,Argument#3,Argument#2,Argument#1,Stack Pointer,Callee Saved,Argume

35、nt#5,Argument#6,Callee Saved,Used for linking,C:Callee Saved,Callee Saved,Callee Saved,Callee Saved,x86-64 Registers,Arguments passed to functions via registers,If more than 6 integral parameters,then pass rest on stack,These registers can be used as caller-saved as well,All References to Stack Fram

36、e via Stack Pointer,Eliminates need to update,%ebp,Other Registers,6+1 callee saved,2 or 3 have special uses,x86-64 Locals in the Red Zone,Avoiding Stack Pointer Change,Can hold all information within small window beyond stack pointer,/*Swap,using local array*/,void swap_a(long*xp,long*yp),volatile

37、long loc2;,loc0=*xp;,loc1=*yp;,*xp=loc1;,*yp=loc0;,swap_a:,movq (%rdi),%rax,movq%rax,-24(%rsp),movq (%rsi),%rax,movq%rax,-16(%rsp),movq -16(%rsp),%rax,movq%rax,(%rdi),movq -24(%rsp),%rax,movq%rax,(%rsi),ret,rtn Ptr,unused,%rsp,8,loc1,loc0,16,24,x86-64 NonLeaf without Stack Frame,No values held while

38、 swap being invoked,No callee save registers needed,long scount=0;,/*Swap ai&ai+1*/,void swap_ele_se,(long a,int i),swap(,scount+;,swap_ele_se:,movslq%esi,%rsi#Sign extend i,leaq (%rdi,%rsi,8),%rdi#&ai,leaq 8(%rdi),%rsi#&ai+1,call swap#swap(),incq scount(%rip),#scount+;,ret,x86-64 Call using Jump,Wh

39、en,swap,executes,ret,it will return from,swap_ele,Possible since,swap,is a“tail call”,long scount=0;,/*Swap ai&ai+1*/,void swap_ele,(long a,int i),swap(,swap_ele:,movslq%esi,%rsi#Sign extend i,leaq (%rdi,%rsi,8),%rdi#&ai,leaq 8(%rdi),%rsi#&ai+1,jmp swap#swap(),Interesting Features of Stack Frame,All

40、ocate Entire Frame at Once,All stack accesses can be relative to,%rsp,Do by decrementing stack pointer,Can delay allocation,since safe to temporarily use red zone,Simple Deallocation,Increment stack pointer,Basic Data Types,Integral,Stored&operated on in general registers,Signed vs.unsigned depends

41、on instructions used,IntelGASBytesC,byte,b,1,unsigned,char,word,w,2,unsigned,short,double word,l,4,unsigned,int,quad word,q,8,unsigned,long int,(x86-64),Floating Point,Stored&operated on in floating point registers,IntelGASBytesC,Single,s,4,float,Double,l,8,double,Extended,t,10/12/16,long double,Arr

42、ay Allocation,Basic Principle,T,A,L,;,Array of data type,T,and length,L,Contiguously allocated region of,L,*,sizeof(,T,),bytes,Identifier A can be used as a pointer to array element 0,Type T*,Viewing as Multidimensional Array,Declaration,T,A,R,C,;,2D array of data type,T,R,rows,C,columns,Type,T,elem

43、ent requires,K,bytes,Array Size,R,*,C,*,K,bytes,Arrangement,Row-Major Ordering,A00,A0C-1,AR-10,AR-1C-1,int ARC;,A,0,0,A,0,C-1,A,1,0,A,1,C-1,A,R-1,0,A,R-1,C-1,4*R*C,Bytes,Nested Array Row Access,Row Vectors,Ai,is array of,C,elements,Each element of type,T,requires,K,bytes,Starting address,A+,i,*(,C,*

44、K,),A,i,0,A,i,C-1,Ai,A,R-1,0,A,R-1,C-1,AR-1,A,A,0,0,A,0,C-1,A0,int ARC;,A+i*C*4,A+(R-1)*C*4,Nested Array Element Access,Array Elements,Aij,is element of type,T,Address,A+,i,*(,C,*,K,),+,j,*,K,=,A+,(,i*C+j,),*K,A,i,j,A,i,j,Ai,A,R-1,0,A,R-1,C-1,AR-1,A,A,0,0,A,0,C-1,A0,int ARC;,A+i*C*4,A+(R-1)*C*4,A+(

45、i*C+j)*4,Nested Array Element Access Code,Array Elements,pghindexdig,is,int,Address:,pgh+20*index+4*dig,IA32 Code,Computes address,pgh+4*dig+4*(index+4*index),movl,performs memory reference,int get_pgh_digit,(int index,int dig),return pghindexdig;,#%ecx=dig,#%eax=index,leal 0(,%ecx,4),%edx#4*dig,lea

46、l(%eax,%eax,4),%eax#5*index,movl pgh(%edx,%eax,4),%eax#*(pgh+4*dig+20*index),Array Element Accesses,Similar C references,Nested Array,Element at,Mempgh+20*index+4*dig,Different address computation,Multi-Level Array,Element at,MemMemuniv+4*index+4*dig,int get_pgh_digit,(int index,int dig),return pghi

47、ndexdig;,int get_univ_digit,(int index,int dig),return univindexdig;,Using Nested Arrays,Strengths,C compiler handles doubly subscripted arrays,Generates very efficient code,Avoids multiply in index computation,Limitation,Only works if have fixed array size,#define N 16,typedef int fix_matrixNN;,/*C

48、ompute element i,k of,fixed matrix product*/,int fix_prod_ele,(fix_matrix a,fix_matrix b,int i,int k),int j;,int result=0;,for(j=0;j N;j+),result+=aij*bjk;,return result;,A,(i,*),B,(*,k),Column-wise,Row-wise,Dynamic Nested Arrays,Strength,Can create matrix of arbitrary size,Programming,Must do index

49、 computation explicitly,Performance,Accessing single element costly,Must do multiplication,int*new_var_matrix(int n),return(int*),calloc(sizeof(int),n*n);,int var_ele,(int*a,int i,int j,int n),return ai*n+j;,movl 12(%ebp),%eax#i,movl 8(%ebp),%edx#a,imull 20(%ebp),%eax#n*i,addl 16(%ebp),%eax#n*i+j,mo

50、vl(%edx,%eax,4),%eax#Mema+4*(i*n+j),Optimizing Dynamic Array Mult.,Optimizations,Performed when set optimization level to,-O2,Code Motion,Expression,i*n,can be computed outside loop,Strength Reduction,Incrementing,j,has effect of incrementing,j*n+k,by,n,Performance,Compiler can optimize regular acce

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服