是否将英特尔用于其“预期目的"进行注册?提高效率? [英] Does using an Intel register for its "intended purpose" increase efficiency?

查看:48
本文介绍了是否将英特尔用于其“预期目的"进行注册?提高效率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本文声称每个寄存器都有预期的用途,更重要的是,

This article claims that each register has an intended purpose and more importantly,

当英特尔工程师进行设计时 最初的8086处理器 每个人都有一个特殊的目的 登记.当他们设计 指令集,他们创造了许多 优化和特殊说明 根据他们期望的功能 每个寄存器执行.使用 根据英特尔的注册 原始计划允许代码采用 这些优化的全部优势. 不幸的是,这似乎是一种迷失 艺术.很少有程序员知道英特尔的 总体设计,大多数编译器是 过于简单或专注于 使用寄存器的执行速度 适当地.了解如何 寄存器和指令集适合 然而,在一起很重要 踏上轻松之路 大小编码.

When the engineers at Intel designed the original 8086 processor, they had a special purpose in mind for each register. As they designed the instruction set, they created many optimizations and special instructions based on the function they expected each register to perform. Using registers according to Intel's original plan allows the code to take full advantage of these optimizations. Unfortunately, this seems to be a lost art. Few coders are aware of Intel's overall design, and most compilers are too the simplistic or focused on execution speed to use the registers properly. Understanding how the registers and instruction set fit together, however, is an important step on the road to effortless size-coding.

是否有其他来源可以佐证此文章?如果是这样,我真的很想检查一下.

Are there any other sources to corroborate this article? If so, I'd really like to check it out.

请注意,我不是在谈论诸如STOS之类的快速操作使用edi的情况-我只是想知道如果使用eaxesi作为计数器而不是ecx还是仅仅是可读性?

Please note I'm not talking about situations where fast operations like STOS uses edi - I'm just wondering if there is any performance degradation if I use eax and esi as counters instead of ecx or is it just about readability?

推荐答案

不,已经不复存在了-或至少不经常出现.通过将ECX用作计数器,可以使用LOOP指令.一次,这是一个很大的优势,但是在大多数最新的CPU上,LOOP的执行时间要比DEC ECX/JNZ的组合要长.可能的优点是它减少了内存带宽的使用,这是越来越多的瓶颈.当/如果您可以使用其他形式(如LOOPNZ),则这也可能是一个优势,使用单独的指令进行模拟可能会相对复杂.

No, not really anymore -- or at least not very often anyway. Using ECX as a counter lets you use the LOOP instruction. At one time, that was a significant advantage, but on most recent CPUs, a LOOP takes longer to execute than the combination of DEC ECX/JNZ wherever. The possible advantage is that it reduces memory bandwidth usage, which is a bottleneck more and more often. It can also be an advantage when/if you can use the other forms like LOOPNZ, which can be relatively complex to simulate with separate instructions.

这篇关于是否将英特尔用于其“预期目的"进行注册?提高效率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆