si (06.02.2006 17:27, просмотров: 1) ответил she на не верю! (с) Можно Ваш ассемблерный листинг тоже в студию?
Да пож...ста :) Только я ошибся и привел кол-во инструкций вместо циклов. Сильно извеняюсь.Кол-во циклов 122.
Да и это без оптимизации. В стысле с ключом -O0
У Генерала более правильные данные.
но все равно DSPICу далеко :)
<pre>
/**************************************************
source file containing three math functions. One function performs
addition of two 32-bit numbers, one performs multiplication, and one
performs division.
The “main()” function calls each of these functions.
Purpose : Benchmark 32-bit math functions.
**************************************************/
#include <math.h>
typedef unsigned long UInt32;
UInt32 add(UInt32 a, UInt32 b)
{
[0xe1a02000] mov r2,r0
return (a + b);
[0xe0820001] add r0,r2,r1
}
[0xe1a0f00e] mov pc,r14
UInt32 mul(UInt32 a, UInt32 b)
{
[0xe1a02000] mov r2,r0
return (a * b);
[0xe0000291] mul r0,r1,r2
}
[0xe1a0f00e] mov pc,r14
UInt32 div(UInt32 a, UInt32 b)
{
[0xe92d4038] stmfd r13!,{r3-r5,r14}
[0xe1a04000] mov r4,r0
[0xe1a05001] mov r5,r1
return (a / b);
[0xe1a01004] mov r1,r4
[0xe1a00005] mov r0,r5
[0xeb00001e] bl __rt_udiv
}
[0xe8bd8038] ldmfd r13!,{r3-r5,pc}
void main(void)
{
[0xe52de004] * str r14,[r13,#-4]!
[0xe24dd014] sub r13,r13,#0x14
volatile UInt32 result[4];
result[0] = 43125;
[0xe59f0058] ldr r0,0x00008144 ; = #0x0000a875
[0xe58d0004] str r0,[r13,#4]
result[1] = 14567;
[0xe59f0054] ldr r0,0x00008148 ; = #0x000038e7
[0xe58d0008] str r0,[r13,#8]
result[2] = add(result[0], result[1]);
[0xe59d2008] ldr r2,[r13,#8]
[0xe1a01002] mov r1,r2
[0xe59d2004] ldr r2,[r13,#4]
[0xe1a00002] mov r0,r2
[0xebffffe7] bl add
[0xe58d000c] str r0,[r13,#0xc]
result[1] = mul(result[0], result[2]);
[0xe59d200c] ldr r2,[r13,#0xc]
[0xe1a01002] mov r1,r2
[0xe59d2004] ldr r2,[r13,#4]
[0xe1a00002] mov r0,r2
[0xebffffe4] bl mul
[0xe58d0008] str r0,[r13,#8]
result[3] = div(result[1], result[2]);
[0xe59d200c] ldr r2,[r13,#0xc]
[0xe1a01002] mov r1,r2
[0xe59d2008] ldr r2,[r13,#8]
[0xe1a00002] mov r0,r2
[0xebffffe1] bl div
[0xe58d0010] str r0,[r13,#0x10]
return;
[0xe28dd014] add r13,r13,#0x14
}
[0xe49df004] ldr pc,[r13],#4
[0x0000a875] dcd 0x0000a875 u...
[0x000038e7] dcd 0x000038e7 .8..
</pre>