Değişkenler
Açıklaması şöyle
Açıklaması şöyle
I don't know what assembler you've been using, but I've never used one that allowed one to declare variables with types. All the assemblers that I've ever used allowed one to reserve space and, to use any available op-code to access that space and operate on its content.
MOV Instruction
Aslında Copy anlamına gelir. Açıklaması şöyle.
Aslında Copy anlamına gelir. Açıklaması şöyle.
Many processors have an instruction called "move" (sometimes spelled MOV) which copies data from one location (the "source") to another (the "destination") in registers and/or memory. It does not do anything to the "source".
This is analogous to the "copy" (or "cp") command in a filesystem. In a "move" (or "mv") in the filesystem, the "source" would no longer be there. It is also contrary to the simple English meaning of "move"... after you move an object, it exists in its new location but no longer in its previous location.
MULTIPLY Instruction
İlk işlemcilerde çarpma instruction yoktu. Açıklaması şöyleFast multiplier circuits as used today take enormous amounts of logic, far beyond what would have been cost-effective (or perhaps even possible) in the mid-70s for an inexpensive microprocessor. Even slow multiplier circuits (as would appear later on chips like the 6809, 68000 or 8086) use a fair bit of logic and would have very considerably added to the cost, perhaps forcing a multi-chip design with all the complications that entails.The first lines of microprocessors were primarily targeted at embedded control applications where rapid multiplication is rarely needed, so that was likely a factor too.
GCC
asm
Şöyle yaparız.
Şöyle yaparız. escape() ve clobber() metodları arasında derleyicinin optimizasyon yapmasını engeller.
__asm blok kullanılır. -masm=intel seçeneği ile derlenir. Şöyle yaparız.
asm
Şöyle yaparız.
inline int my_int (double x)
{
int r;
asm ("fldl %1\n"
"fistpl %0\n"
:"=m"(r)
:"m"(x));
return r;
}
asm volatileŞöyle yaparız. escape() ve clobber() metodları arasında derleyicinin optimizasyon yapmasını engeller.
static void escape (void *p) {
asm volatile ("" : : "g"(p) : "memory");
}
static void clobber () {
asm volatile ("" : : : "memory");
}
void benchmark ()
{
vector<int> v;
v.reserve (1);
escape (v.data());
v.push_back (10);
clobber ()
}
Microsoft Extension__asm blok kullanılır. -masm=intel seçeneği ile derlenir. Şöyle yaparız.
#include "stdio.h"
int f()
{
__asm
{
mov eax, 42 // setting EAX to 42 here
}
}
int main()
{
int i = f();
printf("%i\n", i);
return 0;
}
Hiç yorum yok:
Yorum Gönder