Instruction Usage

Instruction Usage - 04-1 04-1 InstructionUsage

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 04-1 04-1 InstructionUsage UsageofDLXInstructionsBySPEC92IntegerCode load int conditional branch add int compare int store int or shift and 26% 16% 0% 5% 10% 15% 20% 25% 14% 13% 9% 5% 4% 3% eqntott espresso gcc li compress Total dynamic count FIGURE 2.28 Graphical display of instructions executed of the five programs from SPECint92 in Figure 2.26. 04-1 EE4720LectureTransparency.Formatted13:16,24February2003fromlsli04. 04-1 04-2 04-2 InstructionUsage UsageofDLXInstructionsBySPEC92Floating-PointCode load FP mul FP add int store FP conditional branch add FP sub FP compare FP 23% 13% 0% 5% 10% 15% 20% 25% 11% 9% 8% 8% 6% 6% ear hydro2d mdljdp2 su2cor doduc mov reg FP 2% shift 2% Total dynamic count FIGURE 2.29 Graphical display of instructions executed of the five programs from SPECfp92 in Figure 2.27. 04-2 EE4720LectureTransparency.Formatted13:16,24February2003fromlsli04. 04-2 04-3 04-3 ControlTransfer(Flow)Instructions beqzr1,SKIP !Ifr1=0gotoSKIP add r2,r2,r5 SKIP add r2,r3,r4 Controltransfer(controlflow)instructions(CTIs) ... ... maycausenextinstructiontobefetchedfrom ... ... somewhereotherthanPC+4(assuming4-byteinstructions). Programswouldbetrivialwithoutthem. Occurfrequentlyinprograms. Oftenaperformancebottleneck. 04-3 EE4720LectureTransparency.Formatted13:16,24February2003fromlsli04. 04-3 04-4 04-4 Namesusedbelowarecommon: Branch : Conditionalcontroltransfer. Jump : Unconditionalcontroltransfer. Sometimesspecialcaseofbranch. JumpandLink : Unconditional,returnaddress(PC)savedinregister. Call : Unconditionalcontroltransfer,PC,etc.saved. Sometimesspecialcaseofjumpandlink. Return : Unconditional,PC,etc.frommostrecentcallrestored. Sometimesspecialcaseofjumpandlink. 04-4 EE4720LectureTransparency.Formatted13:16,24February2003fromlsli04. 04-4 04-5 04-5 CTIExamples CCode if(r2==r3)gotoTARGET1; r4=r5+r6; gotoTARGET2; TARGET1: r4=r5*r6; TARGET2: PROCNAME(); return; DLXAssemblerCode sub r1,r2,r3 !r1=r2-r3 beqzr1,TARGET1 !Branchifr1=0. add r4,r5,r6 !r4=r5+r6 j TARGET2 !Jumpunconditionally. TARGET1: !Label.(Assemblerandlinkerfindaddress.) multr4,r5,r6 !r4=r5*r6 TARGET2: !Anotherlabel. sw 16(r20),r31 !Savereturnaddress(ofcallertothisproc.) jal PROCNAME !CallprocedurePROCNAME. lw r31,16(r20) !Restorereturnaddress(overwrittenbyjal). jalrr31 !Return(fromthisprocedure). 04-5 EE4720LectureTransparency.Formatted13:16,24February2003fromlsli04. 04-5 04-6 04-6 DLXAssemblerCode(Sameaslastslide.) sub r1,r2,r3 !r1=r2-r3 beqzr1,TARGET1 !Branchifr1=0. add r4,r5,r6 !r4=r5+r6 j TARGET2 !Jumpunconditionally. TARGET1: !Label.(Assemblerandlinkerfindaddress.) multr4,r5,r6 !r4=r5*r6 TARGET2: !Anotherlabel. sw 16(r20),r31 !Savereturnaddress(ofcallertothisproc.) jal PROCNAME !CallprocedurePROCNAME. lw r31,16(r20) !Restorereturnaddress(overwrittenbyjal). jalrr31 !Return(fromthisprocedure). Branchinstruction: beqz . Jumpinstruction: j . Callinstruction: jal . Returninstruction: jalr . Note:callandreturnaresometimesspecialcaseof jumpandlink instructions. 04-6 EE4720LectureTransparency.Formatted13:16,24February2003fromlsli04. 04-6 04-7...
View Full Document

Page1 / 38

Instruction Usage - 04-1 04-1 InstructionUsage

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online