The C code which was obtained from the public domain produces the following output from the
optimizing C compiler when compiled using the above outlined procedure. The C code which
generated this output is given in the zip file, DES.zip. The name of the subroutine is
“des_encrypt_core(…).”
Figure 4 shows the feedback from the optimizing C compiler on the des_encrypt_core() function.
The trip count is the number of times the loop will execute. In this case, DES has exactly 16
rounds in every instance (it is part of the definition of DES) and therefore, both the Known
Minimum Trip Count and the Know Maximum Trip Count are 16.
The Loop Carried Dependency bound represents the largest loop carry path. A loop carry path
occurs when one iteration of the loop writes a value that must be read in a future iteration. In the
DES core algorithm, the 64-bit block is separated into two 32-bit variables, denoted in the C
code as “l” and “r,” for “left” and “right” variables, respectively. Both variables, “l” and “r,” are
modified in each iteration of the loop, thus, all operations upon them from one iteration of the
loop must be completed before the next iteration of the loop may begin. The “r” variable has a
longer loop carry path and therefore determines the Loop Carried Dependency bound of 15, as
shown in Figure 5. The instructions in the bubbles of Figure 5 map directly to the corresponding
instruction of the original C code, as given in the zip file, DES.zip. The name of the subroutine is
“des_encrypt_core(…).”
The Loop Carried Dependency bound of 15 severely limits the performance of this system. As
we see from the output above, the partitioned resource bound is only 7. The unpartitioned
resource bound and partitioned resource bounds indicate the minimum number of cycles per
loop required based solely upon the resources available on chip. The unpartitioned resource
bound is measured before the variables are partitioned between the two banks of 16 registers
and the operations are correspondingly partitioned between the two banks of .L, .S, .D and .M
units. The partitioned resource bound of 7 indicates that the C6000 has the resources to do the
36 assembly instructions of this loop in 7 cycles.
This means that if the Loop Carried Dependency did not exist, the compiler might be able to find
a schedule of as few as 7 cycles per loop iteration. Because the Loop Carried Dependency
bound does exist, however, the compiler is forced to start looking for schedules of 15 cycles per
loop iteration and actually finds the schedule for 16 cycles per loop iteration.
å½ä¼åçCç¼è¯å¨ç¼è¯ç¨åºä½¿ç¨ä»¥ä¸çæ¦è¿°ãC代ç ,
è¿ç§è¾åºæ¯äº§çäºzipæ¡£æ¡,DES.zipãåç¨åºçå称
âdes_encrypt_core(â¦)ãâ
å¾4æ¾ç¤ºäºåé¦çCç¼è¯å¨çä¼ådes_encrypt_core()çåè½ã
è¿æ¬¡æ è¡ç次æ°è®¡æ°æ¯å¾ªç¯å°ä¼è¿è¡ãå¨è¿ç§æ åµä¸,DESæ£å¥½æ16å²
å¨æ¯ç§æ åµä¸,è½®(è¿æ¯å®ä¹çä¸é¨å,å æ¤,DES)å æ¬å·²ç¥ç
æå°æ è¡å¹¶æå¾æ大è¡ç¨æ°è®¡æ°æ¯16å²ã
循ç¯è¿è¡äºçº¦æ代表æ大ç循ç¯ä¾èµæºå¸¦è·¯å¾ãä¸ä¸ªåè·¯æºå¸¦è·¯å¾
åçå¨ä¸ä¸ªè¿ä»£å¾ªç¯çåä¸ä¸ªå¼å¿ é¡»è¢«è¯»å ¥ä¸ä¸ªæªæ¥çåå¤ãå¨
DESç®æ³çæ ¸å¿æ¯64ä½çè¡åº,æå®å为两个32ä½çåé,表示å¨C
代ç ä½ä¸ºâlâåârâ,å 为âå·¦âåâå³âåé,åå«ã两个åé,âlâåârâ
ä¿®æ¹å¨æ¯ä¸æ¬¡è¿ä»£å¾ªç¯ç,å æ¤,æææä½å¨ä»ä»¬èº«ä¸ä»ä¸ä¸ªè¿ä»£ç
åè·¯å¿ é¡»å®æä¹å,ä¸ä¸æ¬¡è¿ä»£å¾ªç¯çå¼å§ã" r "çåéæä¸ä¸ª
å循ç¯,å æ¤å³å®äºæºå¸¦è·¯å¾ä¾èµçç¯è¿è¡15,ä½ä¸º
æ¾ç¤ºå¨å¾5ã泡泡éçæ示å¾5å°å¾ç´æ¥å¯¹åºç
åæçC代ç æ令,ä½ä¸ºæ¢å®çzipæ¡£æ¡,DES.zipãåç¨åºçå称
âdes_encrypt_core(â¦)ãâ
循ç¯ä¾èµè§£çè¿è¡15æ大çéå¶äºè¯¥ç³»ç»çæ§è½ãä½ä¸º
æ们çå°ä»äº§é以ä¸,ååèµæºçåªæ7个ãè¿unpartitioned
èµæºçº¦æååå²çé注æèµæºæå°ç帧/
å¨è¦æ±ççç±ä» éäºå路对è¯ççå¯ç¨èµæºãunpartitionedèµæºç
æµéå约æåéä¹é´ç两家é¶è¡åå²ç16å²çå¯åå¨
åå²åè¿è¥ä¹ç¸åºç.Lä¹é´,è¿ä¸¤å®¶é¶è¡,.D .Såä¸å
åä½ãååèµæºçº¦æç7表æC6000æèµæºæ¥åè¿ä¸ª
36ç»è£ æåçåè·¯ä¸7å¨æã
è¿å°±æå³çå¦æ循ç¯ä¾èµå¹¶ä¸åå¨,è¿è¡é讯
以上从主体产生的c程序代码当采用如上的汇编处理之后产生了这样的优化结果追问
追加十分可以吗?有空的话帮帮忙吧,真的很急啊
追答不用了,人家已经用google或者百度帮你翻译了,俺这人工翻译的费用你可付不起哦呵呵..
追问在线翻译都会啊,可是不能用啊
追答不好意思,,确实工作很忙,不能帮到你,呵呵