MMX
Модератор: Модераторы
Не фтыкаю я что-то:
program testmmx;
uses mmx;
const
w1: tmmxinteger = (111,123,432,4356);
w2: tmmxinteger = (4213,6456,756,4);
var
w3: tmmxinteger;
begin
{$mmx+}
w3 := w2 + w1;
{$mmx-}
end.
и надпись Operator is not overloaded повергла меня в ступор! =)
Почитал про это в Ref.pdf и нифига не понял что от меня требуется...
program testmmx;
uses mmx;
const
w1: tmmxinteger = (111,123,432,4356);
w2: tmmxinteger = (4213,6456,756,4);
var
w3: tmmxinteger;
begin
{$mmx+}
w3 := w2 + w1;
{$mmx-}
end.
и надпись Operator is not overloaded повергла меня в ступор! =)
Почитал про это в Ref.pdf и нифига не понял что от меня требуется...
- Сергей Смирнов
- энтузиаст
- Сообщения: 595
- Зарегистрирован: 28.04.2005 13:23:25
- Откуда: Москва
- Контактная информация:
- Romtek
- постоялец
- Сообщения: 190
- Зарегистрирован: 22.05.2005 12:29:35
- Откуда: Рамат Ган
- Контактная информация:
Более того, когда я взял полный код из документации:
Пример отсюда: <a href='http://www.freepascal.org/docs-html/prog/progse14.html#x112-1110005.1' target='_blank'>http://www.freepascal.org/docs-html/prog/p...#x112-1110005.1</a>
а значит должен работать. Но не тут то было. :ph34r:
:rolleyes:Error: Identifier not found "i"
Пример отсюда: <a href='http://www.freepascal.org/docs-html/prog/progse14.html#x112-1110005.1' target='_blank'>http://www.freepascal.org/docs-html/prog/p...#x112-1110005.1</a>
а значит должен работать. Но не тут то было. :ph34r:
Вот, подправленный код из примера, компилер 2.0.0 всё компилит без траблов.
Program testmmx;
uses mmx;
var
d1 : double;
a : array[0..10000] of double;
i : longint;
begin
d1:=1.0;
{$mmx+}
{ floating point data is used, but we do _no_ arithmetic }
for i:=0 to 10000 do
a[i]:=d2; { this is done with 64 bit moves }
{$mmx-}
emms; { clear fpu }
{ now we can do floating point arithmetic again }
end.
Program testmmx;
uses mmx;
var
d1 : double;
a : array[0..10000] of double;
i : longint;
begin
d1:=1.0;
{$mmx+}
{ floating point data is used, but we do _no_ arithmetic }
for i:=0 to 10000 do
a[i]:=d2; { this is done with 64 bit moves }
{$mmx-}
emms; { clear fpu }
{ now we can do floating point arithmetic again }
end.
ushakov
>>Ваш релиз компилятора не собран с опцией SUPPORT_MMX
Вот с этого места попрошу подробнее, как пересобрать с такой опцией? Я знаю что он собран с GDB.... но не знаю где вообще меняются эти опции..
p.s Как собрать компилятор я знаю... не зyf.? где эту опцию поставить..
После вашего ответа этот вопрос нужно добавить в FAQ
>>Ваш релиз компилятора не собран с опцией SUPPORT_MMX
Вот с этого места попрошу подробнее, как пересобрать с такой опцией? Я знаю что он собран с GDB.... но не знаю где вообще меняются эти опции..
p.s Как собрать компилятор я знаю... не зyf.? где эту опцию поставить..
После вашего ответа этот вопрос нужно добавить в FAQ
в README все сказано:
This directory contains the sources of the Free Pascal Compiler
If you want to compile/modify the compiler, please read first the
programmers manual.
To recompile the compiler, you can use the batch files :
+ mppc386.bat if you want to build a cross compiler from i386 to m68k
+ mppcsparc if you want to build a cross compiler from i386 to SPARC
or
Use the make utility as following
make OS_TARGET="compiler OS target" \
CPU_TARGET="compiler CPU target" \
FPCCPUOPT="Optimization level" \
PP="compiler used to compile FPC" \
COMPILER_OPTIONS="Options passed to compiler" \
If an option is omitted, then target CPU/OS will be same as current CPU/OS
Possibles targets are : linux go32v2 win32 os2 freebsd beos netbsd amiga
atari sunos qnx netware openbsd wdosx palmos macos macosx emx
Possible compiler switches (* marks a currently required switch):
-----------------------------------------------------------------
GDB* support of the GNU Debugger
I386 generate a compiler for the Intel i386+
x86_64 generate a compiler for the AMD x86-64 architecture
M68K generate a compiler for the M68000
SPARC generate a compiler for SPARC
POWERPC generate a compiler for the PowerPC
VIS generate a compile for the VIS
DEBUG version with debug code is generated
EXTDEBUG some extra debug code is executed
SUPPORT_MMX only i386: releases the compiler switch
MMX which allows the compiler to generate
MMX instructions
EXTERN_MSG Don't compile the msgfiles in the compiler, always
use external messagefiles, default for TP
NOAG386INT no Intel Assembler output
NOAG386NSM no NASM output
NOAG386BIN leaves out the binary writer, default for TP
NORA386DIR No direct i386 assembler reader
TEST_GENERIC Test Generic version of code generator
(uses generic RTL calls)
-----------------------------------------------------------------
cpuflags The target processor has status flags (on by default)
cpufpemu The target compiler will also support emitting software
floating point operations
cpu64bit The target is a 64-bit processor
-----------------------------------------------------------------
Required switches for a i386 compiler be compiled by Free Pascal Compiler:
GDB;I386
to build a compiler to SPARC target using a Win32/i386 you just use :
make CPU_TARGET=SPARC
This directory contains the sources of the Free Pascal Compiler
If you want to compile/modify the compiler, please read first the
programmers manual.
To recompile the compiler, you can use the batch files :
+ mppc386.bat if you want to build a cross compiler from i386 to m68k
+ mppcsparc if you want to build a cross compiler from i386 to SPARC
or
Use the make utility as following
make OS_TARGET="compiler OS target" \
CPU_TARGET="compiler CPU target" \
FPCCPUOPT="Optimization level" \
PP="compiler used to compile FPC" \
COMPILER_OPTIONS="Options passed to compiler" \
If an option is omitted, then target CPU/OS will be same as current CPU/OS
Possibles targets are : linux go32v2 win32 os2 freebsd beos netbsd amiga
atari sunos qnx netware openbsd wdosx palmos macos macosx emx
Possible compiler switches (* marks a currently required switch):
-----------------------------------------------------------------
GDB* support of the GNU Debugger
I386 generate a compiler for the Intel i386+
x86_64 generate a compiler for the AMD x86-64 architecture
M68K generate a compiler for the M68000
SPARC generate a compiler for SPARC
POWERPC generate a compiler for the PowerPC
VIS generate a compile for the VIS
DEBUG version with debug code is generated
EXTDEBUG some extra debug code is executed
SUPPORT_MMX only i386: releases the compiler switch
MMX which allows the compiler to generate
MMX instructions
EXTERN_MSG Don't compile the msgfiles in the compiler, always
use external messagefiles, default for TP
NOAG386INT no Intel Assembler output
NOAG386NSM no NASM output
NOAG386BIN leaves out the binary writer, default for TP
NORA386DIR No direct i386 assembler reader
TEST_GENERIC Test Generic version of code generator
(uses generic RTL calls)
-----------------------------------------------------------------
cpuflags The target processor has status flags (on by default)
cpufpemu The target compiler will also support emitting software
floating point operations
cpu64bit The target is a 64-bit processor
-----------------------------------------------------------------
Required switches for a i386 compiler be compiled by Free Pascal Compiler:
GDB;I386
to build a compiler to SPARC target using a Win32/i386 you just use :
make CPU_TARGET=SPARC
Блин точно.. README =) Вродебы компилитcz компилятор... ща посмотрим =)
Нет, не робит =(
А самое что инетересно в версии 1.0.10 РАБОТАЕТ!!!!
Нет, не робит =(
Код: Выделить всё
program mmxtest;
{$MODE Delphi}
uses
MMX; { include some predefined data types }
const
{ tmmxword = array[0..3] of word;, declared by unit MMX }
w1 : tmmxword = (111,123,432,4356);
w2 : tmmxword = (4213,63456,756,4);
var
w3 : tmmxword;
i : longint;
begin
if is_mmx_cpu then { is_mmx_cpu is exported from unit mmx }
begin
{$mmx+} { turn mmx on }
w3:=w1+w2; // operator is not overloaded
{$mmx-}
end
else
begin
for i:=0 to 3 do
w3[i]:=w1[i]+w2[i];
end;
end.А самое что инетересно в версии 1.0.10 РАБОТАЕТ!!!!
