由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 汇编的mov指令
相关主题
问几句汇编指令(assembly language)How to become a better programmer
相对于machine code, assembly到底有啥改进?c的小问题
今天给c++震惊了About volatile in C
什么叫reverse engineer 一个软件?0 < -1 ? A c++ question
学了c++,java,.net,还要学汇编语言吗?string operator +
请教几个汇编语言的问题C怪问题一个
为啥C可以当汇编用,JAVA就不可以呢?alloc这个函数究竟做些啥活呢?
谁还记得这个如何实现微秒精度的time stamp
相关话题的讨论汇总
话题: memory话题: mov话题: mem话题: 汇编话题: purpose
进入Programming版参与讨论
1 (共1页)
s*****k
发帖数: 604
1
是不是不能把内存变量赋值给另一个内存变量?
a****l
发帖数: 8211
2
you should first understand what is 汇编 before asking this kind of "naive"
question.
simple answer: don't know.

【在 s*****k 的大作中提到】
: 是不是不能把内存变量赋值给另一个内存变量?
s*****k
发帖数: 604
3
给个明白点的答案吧

"

【在 a****l 的大作中提到】
: you should first understand what is 汇编 before asking this kind of "naive"
: question.
: simple answer: don't know.

s*****k
发帖数: 604
4
查了一下是不行的。但是没说为什么这么设计。甚至有人说这是arbitrary rule.
大侠能否解释一下

"

【在 a****l 的大作中提到】
: you should first understand what is 汇编 before asking this kind of "naive"
: question.
: simple answer: don't know.

a****l
发帖数: 8211
5
because it is CPU specific.

【在 s*****k 的大作中提到】
: 查了一下是不行的。但是没说为什么这么设计。甚至有人说这是arbitrary rule.
: 大侠能否解释一下
:
: "

m****t
发帖数: 37
6
你可以操作address

【在 s*****k 的大作中提到】
: 是不是不能把内存变量赋值给另一个内存变量?
t****t
发帖数: 6806
7
我想提问者的意思是, 为什么x86的汇编指令不能使用两个memory operand
两个memory operand不好encode instruction, 因为所有的指令都是最多一个memory o
perand(好象是这样).
后期指令集扩展时, x86用了很多RISC的思想, 鼓励把load/save和operation分开, 这样
就更没必要把load和save放一块儿了

"

【在 a****l 的大作中提到】
: you should first understand what is 汇编 before asking this kind of "naive"
: question.
: simple answer: don't know.

l*****d
发帖数: 359
8
因为所有赋值都要经过cpu的寄存器
a****l
发帖数: 8211
9
I think this is a really good question, maybe only the original x86
architect knows why. One guess 2c:
if two operands are all memory address, then the instruction is basically
only a "memory copy". While designing cpu core, you want instructions to be
basic and versatile, and such a single-purpose "copy" command seems not as
useful as other operations. I think the mail purpose of "mov" is to load
and store data to/from memory, so a two-memory-address-move does not seem
applicable for this ins

【在 t****t 的大作中提到】
: 我想提问者的意思是, 为什么x86的汇编指令不能使用两个memory operand
: 两个memory operand不好encode instruction, 因为所有的指令都是最多一个memory o
: perand(好象是这样).
: 后期指令集扩展时, x86用了很多RISC的思想, 鼓励把load/save和operation分开, 这样
: 就更没必要把load和save放一块儿了
:
: "

s*****k
发帖数: 604
10
对谢。是我没说明白。x86的汇编。

【在 a****l 的大作中提到】
: because it is CPU specific.
n**x
发帖数: 30
11
好像是因为就一个数据总线吧,一个指令在一个pipeline的stage里只能一次内存操作,
如果2个内存操作那么pipeline的,不管是inorder还是outorder都得加一个stage。
l********g
发帖数: 134
12
u r assuming a single-port memory (actually a cache interface seen by
pipeline).
it's well possible to have multi-port memory interface, and also mov (mem),
(mem) doesn't have to go through register file. all this inst has to do is
to check dependence and wait for a signal from memory interface (the mov is
done) to move to commit stage.
having said that, there did exist mov (mem), (mem) for some special purpose.
but it is usually translated to two mov's with memory-reg mode or a pair of
push/pop

【在 n**x 的大作中提到】
: 好像是因为就一个数据总线吧,一个指令在一个pipeline的stage里只能一次内存操作,
: 如果2个内存操作那么pipeline的,不管是inorder还是outorder都得加一个stage。

n**x
发帖数: 30
13
原来如此,什么机器这么设计?

,
is
purpose.
of

【在 l********g 的大作中提到】
: u r assuming a single-port memory (actually a cache interface seen by
: pipeline).
: it's well possible to have multi-port memory interface, and also mov (mem),
: (mem) doesn't have to go through register file. all this inst has to do is
: to check dependence and wait for a signal from memory interface (the mov is
: done) to move to commit stage.
: having said that, there did exist mov (mem), (mem) for some special purpose.
: but it is usually translated to two mov's with memory-reg mode or a pair of
: push/pop

d*****l
发帖数: 8441
14
有些DSP在自己配置小系统硬件的时候可以选用双端口memory的,但记不得DSP的汇编中
的类似MOV的操作在这种配置下能否做到在一个cycle里实现存取。还是挺怀疑的。
1 (共1页)
进入Programming版参与讨论
相关主题
如何实现微秒精度的time stamp学了c++,java,.net,还要学汇编语言吗?
C++隐式类型转换的规则?请教几个汇编语言的问题
overriding operator<<为啥C可以当汇编用,JAVA就不可以呢?
C++命名空间和算子重载谁还记得这个
问几句汇编指令(assembly language)How to become a better programmer
相对于machine code, assembly到底有啥改进?c的小问题
今天给c++震惊了About volatile in C
什么叫reverse engineer 一个软件?0 < -1 ? A c++ question
相关话题的讨论汇总
话题: memory话题: mov话题: mem话题: 汇编话题: purpose