mirror of
https://github.com/yasm/yasm
synced 2026-08-26 22:26:05 -04:00
Merged changes r1927-r1963 from the trunk into multiarch branch.
svn path=/branches/multiarch/; revision=1964
This commit is contained in:
commit
cd66a1f174
70 changed files with 12681 additions and 4898 deletions
15
Makefile.am
15
Makefile.am
|
|
@ -21,6 +21,9 @@ nodist_include_HEADERS = libyasm-stdint.h
|
|||
noinst_HEADERS = util.h
|
||||
|
||||
BUILT_SOURCES =
|
||||
MAINTAINERCLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
SUFFIXES =
|
||||
|
||||
# configure.lineno doesn't clean up after itself?
|
||||
CLEANFILES = configure.lineno
|
||||
|
|
@ -75,8 +78,8 @@ EXTRA_DIST += Mkfiles/vc/libyasm/libyasm.vcproj
|
|||
EXTRA_DIST += Mkfiles/vc/modules/modules.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc/re2c/re2c.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc/re2c/run.bat
|
||||
EXTRA_DIST += Mkfiles/vc/gap/gap.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc/gap/run.bat
|
||||
EXTRA_DIST += Mkfiles/vc/genperf/genperf.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc/genperf/run.bat
|
||||
EXTRA_DIST += Mkfiles/vc8/crt_secure_no_deprecate.vsprops
|
||||
EXTRA_DIST += Mkfiles/vc8/yasm.sln
|
||||
EXTRA_DIST += Mkfiles/vc8/yasm.vcproj
|
||||
|
|
@ -96,11 +99,11 @@ EXTRA_DIST += Mkfiles/vc8/libyasm/libyasm.vcproj
|
|||
EXTRA_DIST += Mkfiles/vc8/modules/modules.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc8/re2c/re2c.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc8/re2c/run.bat
|
||||
EXTRA_DIST += Mkfiles/vc8/gap/gap.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc8/gap/run.bat
|
||||
EXTRA_DIST += Mkfiles/vc8/genperf/genperf.vcproj
|
||||
EXTRA_DIST += Mkfiles/vc8/genperf/run.bat
|
||||
|
||||
# Until this gets fixed in automake
|
||||
DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
|
||||
DISTCLEANFILES += libyasm/stamp-h libyasm/stamp-h[0-9]*
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
|
|
@ -115,7 +118,7 @@ install-exec-hook: python-install
|
|||
uninstall-hook: python-uninstall
|
||||
|
||||
if BUILD_MAN
|
||||
MAINTAINERCLEANFILES = $(dist_man_MANS)
|
||||
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
||||
endif
|
||||
|
||||
# genstring build
|
||||
|
|
|
|||
|
|
@ -50,18 +50,20 @@ MODULES_ARCH_X86_OBJS= \
|
|||
modules/arch/x86/x86arch.o \
|
||||
modules/arch/x86/x86bc.o \
|
||||
modules/arch/x86/x86expr.o \
|
||||
modules/arch/x86/x86id.o
|
||||
modules/arch/x86/x86id.o \
|
||||
x86cpu.o \
|
||||
x86regtmod.o
|
||||
YASM_MODULES=arch_x86
|
||||
|
||||
#MODULES_ARCH_LC3B_OBJS= \
|
||||
# modules/arch/lc3b/lc3barch.o \
|
||||
# modules/arch/lc3b/lc3bbc.o \
|
||||
# lc3bid.o
|
||||
#YASM_MODULES+=arch_lc3b
|
||||
MODULES_ARCH_LC3B_OBJS= \
|
||||
modules/arch/lc3b/lc3barch.o \
|
||||
modules/arch/lc3b/lc3bbc.o \
|
||||
lc3bid.o
|
||||
YASM_MODULES+=arch_lc3b
|
||||
|
||||
MODULES_ARCH_OBJS= \
|
||||
$(MODULES_ARCH_X86_OBJS) \
|
||||
# $(MODULES_ARCH_LC3B_OBJS)
|
||||
$(MODULES_ARCH_LC3B_OBJS)
|
||||
|
||||
MODULES_DBGFMTS_OBJS= \
|
||||
modules/dbgfmts/null/null-dbgfmt.o \
|
||||
|
|
@ -170,10 +172,23 @@ genmodule: libyasm/genmodule.c
|
|||
module.c: libyasm/module.in genmodule
|
||||
./genmodule libyasm/module.in Mkfiles/Makefile.dj
|
||||
|
||||
x86parse.c: modules/arch/x86/x86parse.gap gap
|
||||
./gap modules/arch/x86/x86parse.gap $@
|
||||
x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: modules/arch/x86/gen_x86_insn.py
|
||||
# ignore error in case python is not installed
|
||||
-python modules/arch/x86/gen_x86_insn.py
|
||||
|
||||
modules/arch/x86/x86id.c: x86parse.c
|
||||
x86insn_nasm.c: x86insn_nasm.gperf genperf
|
||||
./genperf x86insn_nasm.gperf > $@
|
||||
|
||||
x86insn_gas.c: x86insn_gas.gperf genperf
|
||||
./genperf x86insn_gas.gperf > $@
|
||||
|
||||
x86cpu.c: modules/arch/x86/x86cpu.gperf genperf
|
||||
./genperf modules/arch/x86/x86cpu.gperf > $@
|
||||
|
||||
x86regtmod.c: modules/arch/x86/x86regtmod.gperf genperf
|
||||
./genperf modules/arch/x86/x86regtmod.gperf > $@
|
||||
|
||||
modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
|
||||
|
||||
lc3bid.c: modules/arch/lc3b/lc3bid.re re2c
|
||||
./re2c -s -o $@ modules/arch/lc3b/lc3bid.re
|
||||
|
|
@ -198,15 +213,15 @@ RE2C_SRCS= \
|
|||
re2c: $(RE2C_SRCS)
|
||||
$(BUILDCC) -I. -o re2c $(RE2C_SRCS)
|
||||
|
||||
GAP_SRCS= \
|
||||
tools/gap/gap.c \
|
||||
tools/gap/perfect.c \
|
||||
GENPERF_SRCS= \
|
||||
tools/genperf/genperf.c \
|
||||
tools/genperf/perfect.c \
|
||||
libyasm/phash.c \
|
||||
libyasm/xmalloc.c \
|
||||
libyasm/xstrdup.c
|
||||
|
||||
gap: $(GAP_SRCS)
|
||||
$(BUILDCC) -I. -o gap $(GAP_SRCS)
|
||||
genperf: $(GENPERF_SRCS)
|
||||
$(BUILDCC) -I. -o genperf $(GENPERF_SRCS)
|
||||
|
||||
yasm: $(YASM_OBJS)
|
||||
$(CC) -o yasm $(YASM_OBJS)
|
||||
|
|
|
|||
|
|
@ -53,18 +53,20 @@ MODULES_ARCH_X86_OBJS= \
|
|||
modules/arch/x86/x86arch.o \
|
||||
modules/arch/x86/x86bc.o \
|
||||
modules/arch/x86/x86expr.o \
|
||||
modules/arch/x86/x86id.o
|
||||
modules/arch/x86/x86id.o \
|
||||
x86cpu.o \
|
||||
x86regtmod.o
|
||||
YASM_MODULES=arch_x86
|
||||
|
||||
#MODULES_ARCH_LC3B_OBJS= \
|
||||
# modules/arch/lc3b/lc3barch.o \
|
||||
# modules/arch/lc3b/lc3bbc.o \
|
||||
# lc3bid.o
|
||||
#YASM_MODULES+=arch_lc3b
|
||||
MODULES_ARCH_LC3B_OBJS= \
|
||||
modules/arch/lc3b/lc3barch.o \
|
||||
modules/arch/lc3b/lc3bbc.o \
|
||||
lc3bid.o
|
||||
YASM_MODULES+=arch_lc3b
|
||||
|
||||
MODULES_ARCH_OBJS= \
|
||||
$(MODULES_ARCH_X86_OBJS) \
|
||||
# $(MODULES_ARCH_LC3B_OBJS)
|
||||
$(MODULES_ARCH_LC3B_OBJS)
|
||||
|
||||
MODULES_DBGFMTS_OBJS= \
|
||||
modules/dbgfmts/null/null-dbgfmt.o \
|
||||
|
|
@ -162,7 +164,7 @@ nasm-macros.c: modules/preprocs/nasm/standard.mac version.mac genmacro
|
|||
modules/preprocs/nasm/nasm-pp.c: nasm-macros.c
|
||||
|
||||
genversion: modules/preprocs/nasm/genversion.c
|
||||
$(BUILDCC) -IMkfiles -o $@ $<
|
||||
$(BUILDCC) -IMkfiles -I. -o $@ $<
|
||||
|
||||
version.mac: genversion
|
||||
./genversion $@
|
||||
|
|
@ -173,10 +175,23 @@ genmodule: libyasm/genmodule.c
|
|||
module.c: libyasm/module.in genmodule
|
||||
./genmodule libyasm/module.in Mkfiles/Makefile.flat
|
||||
|
||||
x86parse.c: modules/arch/x86/x86parse.gap gap
|
||||
./gap modules/arch/x86/x86parse.gap $@
|
||||
x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: modules/arch/x86/gen_x86_insn.py
|
||||
# ignore error in case python is not installed
|
||||
-python modules/arch/x86/gen_x86_insn.py
|
||||
|
||||
modules/arch/x86/x86id.c: x86parse.c
|
||||
x86insn_nasm.c: x86insn_nasm.gperf genperf
|
||||
./genperf x86insn_nasm.gperf > $@
|
||||
|
||||
x86insn_gas.c: x86insn_gas.gperf genperf
|
||||
./genperf x86insn_gas.gperf > $@
|
||||
|
||||
x86cpu.c: modules/arch/x86/x86cpu.gperf genperf
|
||||
./genperf modules/arch/x86/x86cpu.gperf > $@
|
||||
|
||||
x86regtmod.c: modules/arch/x86/x86regtmod.gperf genperf
|
||||
./genperf modules/arch/x86/x86regtmod.gperf > $@
|
||||
|
||||
modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
|
||||
|
||||
lc3bid.c: modules/arch/lc3b/lc3bid.re re2c
|
||||
./re2c -s -o $@ modules/arch/lc3b/lc3bid.re
|
||||
|
|
@ -201,15 +216,15 @@ RE2C_SRCS= \
|
|||
re2c: $(RE2C_SRCS)
|
||||
$(BUILDCC) -I. -o re2c $(RE2C_SRCS)
|
||||
|
||||
GAP_SRCS= \
|
||||
tools/gap/gap.c \
|
||||
tools/gap/perfect.c \
|
||||
GENPERF_SRCS= \
|
||||
tools/genperf/genperf.c \
|
||||
tools/genperf/perfect.c \
|
||||
libyasm/phash.c \
|
||||
libyasm/xmalloc.c \
|
||||
libyasm/xstrdup.c
|
||||
|
||||
gap: $(GAP_SRCS)
|
||||
$(BUILDCC) -I. -o gap $(GAP_SRCS)
|
||||
genperf: $(GENPERF_SRCS)
|
||||
$(BUILDCC) -I. -o genperf $(GENPERF_SRCS)
|
||||
|
||||
yasm: $(YASM_OBJS)
|
||||
$(CC) -o yasm $(YASM_OBJS)
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
cd ..\..\..\
|
||||
%1 modules\arch\x86\x86parse.gap x86parse.c
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="gap"
|
||||
ProjectGUID="{5758BF4E-ABC4-11DA-B012-B622A1EF5492}"
|
||||
RootNamespace="gap"
|
||||
Name="genperf"
|
||||
ProjectGUID="{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}"
|
||||
RootNamespace="genperf"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
|
|
@ -33,10 +33,10 @@
|
|||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gap.exe"
|
||||
OutputFile="$(OutDir)/genperf.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/gap.pdb"
|
||||
ProgramDatabaseFile="$(OutDir)/genperf.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gap.exe"
|
||||
OutputFile="$(OutDir)/genperf.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
|
|
@ -116,12 +116,12 @@
|
|||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{7D996CB2-ABC4-11DA-B012-B622A1EF5492}">
|
||||
UniqueIdentifier="{1062695D-1C50-4068-8313-73A409885BC1}">
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\gap.c">
|
||||
RelativePath="..\..\..\tools\genperf\genperf.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\perfect.c">
|
||||
RelativePath="..\..\..\tools\genperf\perfect.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\libyasm\phash.c">
|
||||
|
|
@ -136,18 +136,18 @@
|
|||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{85DD7A94-ABC4-11DA-B012-B622A1EF5492}">
|
||||
UniqueIdentifier="{3C1E9AA8-6338-4CED-99F1-BEBA80607BD5}">
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\perfect.h">
|
||||
RelativePath="..\..\..\tools\genperf\perfect.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\standard.h">
|
||||
RelativePath="..\..\..\tools\genperf\standard.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{8EB9B268-ABC4-11DA-B012-B622A1EF5492}">
|
||||
UniqueIdentifier="{005ED203-AC60-4E97-A0A2-8239D00786FE}">
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\run.bat">
|
||||
19
Mkfiles/vc/genperf/run.bat
Normal file
19
Mkfiles/vc/genperf/run.bat
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
cd ..\..\..
|
||||
@echo off
|
||||
reg query HKCR\Python.File\shell\open\command >nul: 2>&1
|
||||
goto answer%errorlevel%
|
||||
:answer0
|
||||
echo ... building with Python ...
|
||||
@echo on
|
||||
modules\arch\x86\gen_x86_insn.py
|
||||
@echo off
|
||||
goto end
|
||||
:answer1
|
||||
echo ... building without Python ...
|
||||
goto end
|
||||
:end
|
||||
@echo on
|
||||
%1 x86insn_nasm.gperf x86insn_nasm.c
|
||||
%1 x86insn_gas.gperf x86insn_gas.c
|
||||
%1 modules\arch\x86\x86cpu.gperf x86cpu.c
|
||||
%1 modules\arch\x86\x86regtmod.gperf x86regtmod.c
|
||||
|
|
@ -124,6 +124,18 @@
|
|||
<Filter
|
||||
Name="arch"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\lc3b\lc3barch.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\lc3b\lc3barch.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\lc3b\lc3bbc.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lc3bid.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\x86\x86arch.c">
|
||||
</File>
|
||||
|
|
@ -139,6 +151,12 @@
|
|||
<File
|
||||
RelativePath="..\..\..\modules\arch\x86\x86id.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\x86cpu.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\x86regtmod.c">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="dbgfmts"
|
||||
|
|
|
|||
|
|
@ -6,16 +6,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasm", "libyasm\libyasm.
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modules", "modules\modules.vcproj", "{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619} = {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}
|
||||
{225700A5-07B8-434E-AD61-555278BF6733} = {225700A5-07B8-434E-AD61-555278BF6733}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713} = {3C58BE13-50A3-4583-984D-D8902B3D7713}
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492} = {5758BF4E-ABC4-11DA-B012-B622A1EF5492}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{225700A5-07B8-434E-AD61-555278BF6733} = {225700A5-07B8-434E-AD61-555278BF6733}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasm", "yasm.vcproj", "{34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} = {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
@ -32,7 +33,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "re2c\re2c.vcproj",
|
|||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gap", "gap\gap.vcproj", "{5758BF4E-ABC4-11DA-B012-B622A1EF5492}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genperf", "genperf\genperf.vcproj", "{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
@ -74,10 +75,10 @@ Global
|
|||
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug.Build.0 = Debug|Win32
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release.ActiveCfg = Release|Win32
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release.Build.0 = Release|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug.ActiveCfg = Debug|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug.Build.0 = Debug|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release.ActiveCfg = Release|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release.Build.0 = Release|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug.ActiveCfg = Debug|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug.Build.0 = Debug|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release.ActiveCfg = Release|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release.Build.0 = Release|Win32
|
||||
{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug.ActiveCfg = Debug|Win32
|
||||
{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug.Build.0 = Debug|Win32
|
||||
{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release.ActiveCfg = Release|Win32
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
cd ..\..\..\
|
||||
%1 modules\arch\x86\x86parse.gap x86parse.c
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="gap"
|
||||
ProjectGUID="{5758BF4E-ABC4-11DA-B012-B622A1EF5492}"
|
||||
RootNamespace="gap"
|
||||
Name="genperf"
|
||||
ProjectGUID="{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}"
|
||||
RootNamespace="genperf"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gap.exe"
|
||||
OutputFile="$(OutDir)/genperf.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)\$(TargetName).pdb"
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/gap.exe"
|
||||
OutputFile="$(OutDir)/genperf.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile="$(OutDir)\$(TargetName).pdb"
|
||||
|
|
@ -186,14 +186,14 @@
|
|||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{7D996CB2-ABC4-11DA-B012-B622A1EF5492}"
|
||||
UniqueIdentifier="{1062695D-1C50-4068-8313-73A409885BC1}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\gap.c"
|
||||
RelativePath="..\..\..\tools\genperf\genperf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\perfect.c"
|
||||
RelativePath="..\..\..\tools\genperf\perfect.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
|
@ -212,14 +212,14 @@
|
|||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{85DD7A94-ABC4-11DA-B012-B622A1EF5492}"
|
||||
UniqueIdentifier="{3C1E9AA8-6338-4CED-99F1-BEBA80607BD5}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\perfect.h"
|
||||
RelativePath="..\..\..\tools\genperf\perfect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\tools\gap\standard.h"
|
||||
RelativePath="..\..\..\tools\genperf\standard.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
19
Mkfiles/vc8/genperf/run.bat
Normal file
19
Mkfiles/vc8/genperf/run.bat
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
cd ..\..\..
|
||||
@echo off
|
||||
reg query HKCR\Python.File\shell\open\command >nul: 2>&1
|
||||
goto answer%errorlevel%
|
||||
:answer0
|
||||
echo ... building with Python ...
|
||||
@echo on
|
||||
modules\arch\x86\gen_x86_insn.py
|
||||
@echo off
|
||||
goto end
|
||||
:answer1
|
||||
echo ... building without Python ...
|
||||
goto end
|
||||
:end
|
||||
@echo on
|
||||
%1 x86insn_nasm.gperf x86insn_nasm.c
|
||||
%1 x86insn_gas.gperf x86insn_gas.c
|
||||
%1 modules\arch\x86\x86cpu.gperf x86cpu.c
|
||||
%1 modules\arch\x86\x86regtmod.gperf x86regtmod.c
|
||||
|
|
@ -329,6 +329,22 @@
|
|||
<Filter
|
||||
Name="arch"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\lc3b\lc3barch.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\lc3b\lc3barch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\lc3b\lc3bbc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lc3bid.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\modules\arch\x86\x86arch.c"
|
||||
>
|
||||
|
|
@ -349,6 +365,14 @@
|
|||
RelativePath="..\..\..\modules\arch\x86\x86id.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\x86cpu.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\x86regtmod.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="dbgfmts"
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasm", "libyasm\libyasm.
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modules", "modules\modules.vcproj", "{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713} = {3C58BE13-50A3-4583-984D-D8902B3D7713}
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492} = {5758BF4E-ABC4-11DA-B012-B622A1EF5492}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619} = {C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}
|
||||
{225700A5-07B8-434E-AD61-555278BF6733} = {225700A5-07B8-434E-AD61-555278BF6733}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713} = {3C58BE13-50A3-4583-984D-D8902B3D7713}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasm", "yasm.vcproj", "{34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} = {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}
|
||||
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}
|
||||
{021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmacro", "genmacro\genmacro.vcproj", "{225700A5-07B8-434E-AD61-555278BF6733}"
|
||||
|
|
@ -29,7 +29,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genversion", "genversion\ge
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "re2c\re2c.vcproj", "{3C58BE13-50A3-4583-984D-D8902B3D7713}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gap", "gap\gap.vcproj", "{5758BF4E-ABC4-11DA-B012-B622A1EF5492}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genperf", "genperf\genperf.vcproj", "{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmodule", "genmodule\genmodule.vcproj", "{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}"
|
||||
EndProject
|
||||
|
|
@ -97,14 +97,14 @@ Global
|
|||
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|Win32.Build.0 = Release|Win32
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|x64.ActiveCfg = Release|Win32
|
||||
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release|x64.Build.0 = Release|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Debug|x64.Build.0 = Debug|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|Win32.Build.0 = Release|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|x64.ActiveCfg = Release|Win32
|
||||
{5758BF4E-ABC4-11DA-B012-B622A1EF5492}.Release|x64.Build.0 = Release|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Debug|x64.Build.0 = Debug|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|Win32.Build.0 = Release|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|x64.ActiveCfg = Release|Win32
|
||||
{C45A8B59-8B59-4D5D-A8E8-FB090F8DD619}.Release|x64.Build.0 = Release|Win32
|
||||
{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
|
|
|
|||
48
configure.ac
48
configure.ac
|
|
@ -54,13 +54,21 @@ AC_HELP_STRING([--enable-gcov],[Enable gcov code coverage (requires GCC)]),
|
|||
esac])
|
||||
|
||||
AC_ARG_ENABLE(python,
|
||||
AC_HELP_STRING([--enable-python],[Build Python bindings]),
|
||||
AC_HELP_STRING([--enable-python],[Enable Python-requiring portions of build]),
|
||||
[case "${enableval}" in
|
||||
yes) enable_python="yes" ;;
|
||||
no) enable_python="no" ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
|
||||
esac], enable_python="auto")
|
||||
|
||||
AC_ARG_ENABLE(python-bindings,
|
||||
AC_HELP_STRING([--enable-python-bindings],[Build Python bindings]),
|
||||
[case "${enableval}" in
|
||||
yes) enable_python_bindings="yes" ;;
|
||||
no) enable_python_bindings="no" ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python-bindings]) ;;
|
||||
esac], enable_python_bindings="auto")
|
||||
|
||||
#
|
||||
# Checks for programs.
|
||||
#
|
||||
|
|
@ -245,18 +253,37 @@ AC_SUBST(CCLD_FOR_BUILD)
|
|||
HOST_CC="$CC_FOR_BUILD"
|
||||
AC_SUBST(HOST_CC)
|
||||
|
||||
# Detect if we can build Python bindings
|
||||
# (needs Python, Python headers, and Pyrex)
|
||||
# Detect if we have Python
|
||||
if test x$enable_python = xno; then
|
||||
have_python=no
|
||||
else
|
||||
AC_MSG_NOTICE([Checking to see if we can build Python bindings])
|
||||
AC_MSG_NOTICE([Checking for Python])
|
||||
have_python=no
|
||||
AM_PATH_PYTHON(2.4,[],[AC_MSG_WARN([Python not found])])
|
||||
|
||||
if test -z "$PYTHON" || test "$PYTHON" = : ; then
|
||||
have_python=no
|
||||
else
|
||||
have_python=yes
|
||||
fi
|
||||
|
||||
if test x$have_python = xno ; then
|
||||
if test x$enable_python = xyes ; then
|
||||
AC_MSG_ERROR([Python explicitly requested, but a suitable Python version was not found])
|
||||
else
|
||||
AC_MSG_WARN([Could not find a suitable version of Python])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Detect if we can build Python bindings
|
||||
# (needs Python, Python headers, and Pyrex)
|
||||
if test x$enable_python_bindings = xno; then
|
||||
have_python_bindings=no
|
||||
else
|
||||
AC_MSG_NOTICE([Checking to see if we can build Python bindings])
|
||||
have_python_bindings=no
|
||||
if test x$have_python = xyes; then
|
||||
AC_MSG_CHECKING([for Pyrex >= 0.9.5.1])
|
||||
PYREX_CHECK_VERSION(0.9.5.1, [AC_MSG_RESULT(yes)
|
||||
have_pyrex=yes],
|
||||
|
|
@ -265,21 +292,22 @@ else
|
|||
|
||||
AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
|
||||
|
||||
if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then
|
||||
have_python=yes
|
||||
if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then
|
||||
have_python_bindings=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$have_python = xno ; then
|
||||
if test x$enable_python = xyes ; then
|
||||
AC_MSG_ERROR([Building Python explicitly requested, but can't build Python bindings because either Pyrex, Python headers or a suitable Python version was not found])
|
||||
if test x$have_python_bindings = xno ; then
|
||||
if test x$enable_python_bindings = xyes ; then
|
||||
AC_MSG_ERROR([Building Python bindings explicitly requested, but can't build Python bindings because either Pyrex, Python headers or a suitable Python version was not found])
|
||||
else
|
||||
AC_MSG_WARN([Couldn't find either Pyrex, the Python headers or a suitable version of Python, not building Python bindings])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
|
||||
AM_CONDITIONAL(HAVE_PYTHON_BINDINGS, test x$have_python_bindings = xyes)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
po/Makefile.in
|
||||
|
|
|
|||
|
|
@ -263,7 +263,11 @@ int yasm_bc_tobytes_common
|
|||
yasm_output_value_func output_value,
|
||||
/*@null@*/ yasm_output_reloc_func output_reloc);
|
||||
|
||||
#define yasm_bc__next(x) STAILQ_NEXT(x, link)
|
||||
/** Get the next bytecode in a linked list of bytecodes.
|
||||
* \param bc bytecode
|
||||
* \return Next bytecode.
|
||||
*/
|
||||
#define yasm_bc__next(bc) STAILQ_NEXT(bc, link)
|
||||
|
||||
/** Set multiple field of a bytecode.
|
||||
* A bytecode can be repeated a number of times when output. This function
|
||||
|
|
|
|||
|
|
@ -56,13 +56,13 @@ typedef struct yasm_expr__item {
|
|||
|
||||
/** Expression item data. Correct value depends on type. */
|
||||
union {
|
||||
yasm_bytecode *precbc; /**< Direct bytecode ref (#YASM_EXPR_PRECBC) */
|
||||
yasm_symrec *sym; /**< Symbol (#YASM_EXPR_SYM) */
|
||||
yasm_expr *expn; /**< Subexpression (#YASM_EXPR_EXPR) */
|
||||
yasm_intnum *intn; /**< Integer value (#YASM_EXPR_INT) */
|
||||
yasm_floatnum *flt; /**< Floating point value (#YASM_EXPR_FLOAT) */
|
||||
uintptr_t reg; /**< Register (#YASM_EXPR_REG) */
|
||||
unsigned int subst; /**< Subst placeholder (#YASM_EXPR_SUBST) */
|
||||
yasm_bytecode *precbc; /**< Direct bytecode ref (YASM_EXPR_PRECBC) */
|
||||
yasm_symrec *sym; /**< Symbol (YASM_EXPR_SYM) */
|
||||
yasm_expr *expn; /**< Subexpression (YASM_EXPR_EXPR) */
|
||||
yasm_intnum *intn; /**< Integer value (YASM_EXPR_INT) */
|
||||
yasm_floatnum *flt; /**< Floating point value (YASM_EXPR_FLOAT) */
|
||||
uintptr_t reg; /**< Register (YASM_EXPR_REG) */
|
||||
unsigned int subst; /**< Subst placeholder (YASM_EXPR_SUBST) */
|
||||
} data;
|
||||
} yasm_expr__item;
|
||||
|
||||
|
|
|
|||
|
|
@ -631,7 +631,17 @@ floatnum_get_common(const yasm_floatnum *flt, /*@out@*/ unsigned char *ptr,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* IEEE-754 (Intel) "single precision" format:
|
||||
/* IEEE-754r "half precision" format:
|
||||
* 16 bits:
|
||||
* 15 9 Bit 0
|
||||
* | | |
|
||||
* seee eemm mmmm mmmm
|
||||
*
|
||||
* e = bias 15 exponent
|
||||
* s = sign bit
|
||||
* m = mantissa bits, bit 10 is an implied one bit.
|
||||
*
|
||||
* IEEE-754 (Intel) "single precision" format:
|
||||
* 32 bits:
|
||||
* Bit 31 Bit 22 Bit 0
|
||||
* | | |
|
||||
|
|
@ -672,6 +682,9 @@ yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr,
|
|||
yasm_internal_error(N_("unsupported floatnum functionality"));
|
||||
}
|
||||
switch (destsize) {
|
||||
case 2:
|
||||
retval = floatnum_get_common(flt, ptr, 2, 10, 1, 5);
|
||||
break;
|
||||
case 4:
|
||||
retval = floatnum_get_common(flt, ptr, 4, 23, 1, 8);
|
||||
break;
|
||||
|
|
@ -702,6 +715,7 @@ int
|
|||
yasm_floatnum_check_size(/*@unused@*/ const yasm_floatnum *flt, size_t size)
|
||||
{
|
||||
switch (size) {
|
||||
case 16:
|
||||
case 32:
|
||||
case 64:
|
||||
case 80:
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ struct yasm_effaddr {
|
|||
* "expr(,1)" (which is definitely an effective address).
|
||||
*/
|
||||
unsigned int strong:1;
|
||||
|
||||
/** 1 if effective address is forced PC-relative. */
|
||||
unsigned int pc_rel:1;
|
||||
|
||||
/** 1 if effective address is forced non-PC-relative. */
|
||||
unsigned int not_pc_rel:1;
|
||||
};
|
||||
|
||||
/** An instruction operand (opaque type). */
|
||||
|
|
|
|||
|
|
@ -158,6 +158,8 @@ lc3b_ea_create_expr(yasm_arch *arch, yasm_expr *e)
|
|||
ea->nosplit = 0;
|
||||
ea->strong = 0;
|
||||
ea->segreg = 0;
|
||||
ea->pc_rel = 0;
|
||||
ea->not_pc_rel = 0;
|
||||
return ea;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,8 @@ EXTRA_DIST += modules/arch/lc3b/tests/lc3b-basic.asm
|
|||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-basic.errwarn
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-basic.hex
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-br.asm
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-br.errwarn
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-br.hex
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-ea-err.asm
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-ea-err.errwarn
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-mp22NC.asm
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-mp22NC.errwarn
|
||||
EXTRA_DIST += modules/arch/lc3b/tests/lc3b-mp22NC.hex
|
||||
|
|
|
|||
|
|
@ -5,18 +5,56 @@ libyasm_a_SOURCES += modules/arch/x86/x86arch.h
|
|||
libyasm_a_SOURCES += modules/arch/x86/x86bc.c
|
||||
libyasm_a_SOURCES += modules/arch/x86/x86expr.c
|
||||
libyasm_a_SOURCES += modules/arch/x86/x86id.c
|
||||
libyasm_a_SOURCES += x86cpu.c
|
||||
libyasm_a_SOURCES += x86regtmod.c
|
||||
|
||||
YASM_MODULES += arch_x86
|
||||
|
||||
modules/arch/x86/x86id.c: x86parse.c
|
||||
modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
|
||||
|
||||
EXTRA_DIST += modules/arch/x86/x86parse.gap
|
||||
EXTRA_DIST += modules/arch/x86/gen_x86_insn.py
|
||||
|
||||
x86parse.c: $(srcdir)/modules/arch/x86/x86parse.gap gap$(EXEEXT)
|
||||
$(top_builddir)/gap$(EXEEXT) $(srcdir)/modules/arch/x86/x86parse.gap $@
|
||||
if HAVE_PYTHON
|
||||
x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
|
||||
$(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
|
||||
else
|
||||
x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
|
||||
@echo Python must be installed to regenerate x86 instructions files
|
||||
cp $(srcdir)/x86insn_nasm.gperf $@
|
||||
x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
|
||||
@echo Python must be installed to regenerate x86 instructions files
|
||||
cp $(srcdir)/x86insn_gas.gperf $@
|
||||
endif
|
||||
|
||||
BUILT_SOURCES += x86parse.c
|
||||
CLEANFILES += x86parse.c
|
||||
BUILT_SOURCES += x86insns.c
|
||||
BUILT_SOURCES += x86insn_nasm.gperf
|
||||
BUILT_SOURCES += x86insn_gas.gperf
|
||||
EXTRA_DIST += x86insns.c
|
||||
EXTRA_DIST += x86insn_nasm.gperf
|
||||
EXTRA_DIST += x86insn_gas.gperf
|
||||
MAINTAINERCLEANFILES += x86insns.c
|
||||
MAINTAINERCLEANFILES += x86insn_nasm.gperf
|
||||
MAINTAINERCLEANFILES += x86insn_gas.gperf
|
||||
|
||||
EXTRA_DIST += modules/arch/x86/x86cpu.gperf
|
||||
EXTRA_DIST += modules/arch/x86/x86regtmod.gperf
|
||||
|
||||
# Use suffix rules for gperf files
|
||||
x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
|
||||
x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
|
||||
x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
|
||||
$(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
|
||||
x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
|
||||
$(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
|
||||
|
||||
BUILT_SOURCES += x86insn_nasm.c
|
||||
BUILT_SOURCES += x86insn_gas.c
|
||||
BUILT_SOURCES += x86cpu.c
|
||||
BUILT_SOURCES += x86regtmod.c
|
||||
CLEANFILES += x86insn_nasm.c
|
||||
CLEANFILES += x86insn_gas.c
|
||||
CLEANFILES += x86cpu.c
|
||||
CLEANFILES += x86regtmod.c
|
||||
|
||||
EXTRA_DIST += modules/arch/x86/tests/Makefile.inc
|
||||
|
||||
|
|
|
|||
5637
modules/arch/x86/gen_x86_insn.py
Executable file
5637
modules/arch/x86/gen_x86_insn.py
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -84,6 +84,8 @@ EXTRA_DIST += modules/arch/x86/tests/mem64hi32.asm
|
|||
EXTRA_DIST += modules/arch/x86/tests/mem64hi32.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/mem64rip.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/mem64rip.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/mixcase.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/mixcase.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/movdq32.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/movdq32.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/movdq64.asm
|
||||
|
|
@ -124,6 +126,11 @@ EXTRA_DIST += modules/arch/x86/tests/rep.asm
|
|||
EXTRA_DIST += modules/arch/x86/tests/rep.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/ret.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/ret.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/riprel1.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/riprel1.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/riprel2.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/riprel2.errwarn
|
||||
EXTRA_DIST += modules/arch/x86/tests/riprel2.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/segmov.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/segmov.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/shift.asm
|
||||
|
|
@ -144,6 +151,12 @@ EXTRA_DIST += modules/arch/x86/tests/sse4.asm
|
|||
EXTRA_DIST += modules/arch/x86/tests/sse4.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse4-err.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse4-err.errwarn
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse5-all.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse5-all.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse5-basic.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse5-basic.hex
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse5-err.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/sse5-err.errwarn
|
||||
EXTRA_DIST += modules/arch/x86/tests/ssse3.asm
|
||||
EXTRA_DIST += modules/arch/x86/tests/ssse3.c
|
||||
EXTRA_DIST += modules/arch/x86/tests/ssse3.hex
|
||||
|
|
|
|||
3
modules/arch/x86/tests/mixcase.asm
Normal file
3
modules/arch/x86/tests/mixcase.asm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
CPU SSE5
|
||||
MOV AX,5
|
||||
|
||||
3
modules/arch/x86/tests/mixcase.hex
Normal file
3
modules/arch/x86/tests/mixcase.hex
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
b8
|
||||
05
|
||||
00
|
||||
66
modules/arch/x86/tests/riprel1.asm
Normal file
66
modules/arch/x86/tests/riprel1.asm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
bits 64
|
||||
val:
|
||||
default abs
|
||||
|
||||
mov rax, val ; 32-bit imm
|
||||
mov rax, dword val ; 32-bit imm
|
||||
mov rax, qword val ; 64-bit imm
|
||||
|
||||
mov rbx, val ; 32-bit imm
|
||||
mov rbx, dword val ; 32-bit imm
|
||||
mov rbx, qword val ; 64-bit imm
|
||||
|
||||
mov rax, [val] ; 48 8b ... (32-bit disp)
|
||||
mov rax, [dword val] ; 48 8b ... (32-bit disp)
|
||||
mov rax, [qword val] ; 48 a1 ... (64-bit disp)
|
||||
a32 mov rax, [val] ; 67 48 a1 ... (32-bit disp)
|
||||
a32 mov rax, [dword val] ; 67 48 a1 ... (32-bit disp)
|
||||
a32 mov rax, [qword val] ; 67 48 a1 ... (32-bit disp)
|
||||
; [this one is debatable on correctness,
|
||||
; I chose in yasm to make a32 override]
|
||||
a64 mov rax, [val] ; 48 8b ... (32-bit disp)
|
||||
a64 mov rax, [dword val] ; 48 8b ... (32-bit disp)
|
||||
a64 mov rax, [qword val] ; 48 a1 ... (64-bit disp)
|
||||
|
||||
mov rbx, [val] ; 48 8b ... (32-bit disp)
|
||||
mov rbx, [dword val] ; 48 8b ... (32-bit disp)
|
||||
;mov rbx, [qword val] ; illegal (can't have 64-bit disp)
|
||||
a32 mov rbx, [val] ; 67 48 8b ... (32-bit disp)
|
||||
a32 mov rbx, [dword val] ; 67 48 8b ... (32-bit disp)
|
||||
;a32 mov rbx, [qword val] ; illegal (can't have 64-bit disp)
|
||||
a64 mov rbx, [val] ; 48 8b ... (32-bit disp)
|
||||
a64 mov rbx, [dword val] ; 48 8b ... (32-bit disp)
|
||||
;a64 mov rbx, [qword val] ; illegal (can't have 64-bit disp)
|
||||
|
||||
default rel
|
||||
|
||||
mov rax, val ; 32-bit imm
|
||||
mov rax, dword val ; 32-bit imm
|
||||
mov rax, qword val ; 64-bit imm
|
||||
|
||||
mov rbx, val ; 32-bit imm
|
||||
mov rbx, dword val ; 32-bit imm
|
||||
mov rbx, qword val ; 64-bit imm
|
||||
|
||||
mov rax, [val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
mov rax, [dword val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
mov rax, [qword val] ; 48 a1 ... (64-bit disp, ABS)
|
||||
a32 mov rax, [val] ; 67 48 8b ... (32-bit disp, RIP-rel)
|
||||
a32 mov rax, [dword val] ; 67 48 8b ... (32-bit disp, RIP-rel)
|
||||
a32 mov rax, [qword val] ; 67 48 a1 ... (32-bit disp, ABS)
|
||||
; [this one is debatable on correctness,
|
||||
; I chose in yasm to make a32 override]
|
||||
a64 mov rax, [val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
a64 mov rax, [dword val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
a64 mov rax, [qword val] ; 48 a1 ... (64-bit disp, ABS)
|
||||
|
||||
mov rbx, [val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
mov rbx, [dword val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
;mov rbx, [qword val] ; illegal (can't have 64-bit disp)
|
||||
a32 mov rbx, [val] ; 67 48 8b ... (32-bit disp, RIP-rel)
|
||||
a32 mov rbx, [dword val] ; 67 48 8b ... (32-bit disp, RIP-rel)
|
||||
;a32 mov rbx, [qword val] ; illegal (can't have 64-bit disp)
|
||||
a64 mov rbx, [val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
a64 mov rbx, [dword val] ; 48 8b ... (32-bit disp, RIP-rel)
|
||||
;a64 mov rbx, [qword val] ; illegal (can't have 64-bit disp)
|
||||
|
||||
334
modules/arch/x86/tests/riprel1.hex
Normal file
334
modules/arch/x86/tests/riprel1.hex
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
48
|
||||
c7
|
||||
c0
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c0
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
b8
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c3
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c3
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
bb
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
67
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
67
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
67
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
67
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
67
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c0
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c0
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
b8
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c3
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
c7
|
||||
c3
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
bb
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
1e
|
||||
ff
|
||||
ff
|
||||
ff
|
||||
48
|
||||
8b
|
||||
05
|
||||
17
|
||||
ff
|
||||
ff
|
||||
ff
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
67
|
||||
48
|
||||
8b
|
||||
05
|
||||
05
|
||||
ff
|
||||
ff
|
||||
ff
|
||||
67
|
||||
48
|
||||
8b
|
||||
05
|
||||
fd
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
67
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
ef
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
48
|
||||
8b
|
||||
05
|
||||
e8
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
48
|
||||
a1
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1d
|
||||
d7
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
48
|
||||
8b
|
||||
1d
|
||||
d0
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
67
|
||||
48
|
||||
8b
|
||||
1d
|
||||
c8
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
67
|
||||
48
|
||||
8b
|
||||
1d
|
||||
c0
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
48
|
||||
8b
|
||||
1d
|
||||
b9
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
48
|
||||
8b
|
||||
1d
|
||||
b2
|
||||
fe
|
||||
ff
|
||||
ff
|
||||
110
modules/arch/x86/tests/riprel2.asm
Normal file
110
modules/arch/x86/tests/riprel2.asm
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
bits 64
|
||||
|
||||
default abs ; default abs, except for explicit rel
|
||||
|
||||
mov rax,[foo]
|
||||
mov rax,[qword 123456789abcdef0h]
|
||||
mov rbx,[foo]
|
||||
mov rax,[dword foo]
|
||||
mov rbx,[dword foo]
|
||||
mov rax,[qword foo]
|
||||
mov rax,[rel foo] ; rel
|
||||
mov rbx,[rel foo] ; rel
|
||||
mov rax,[rel dword foo] ; rel
|
||||
;mov rax,[rel qword foo] ; illegal
|
||||
mov rax,[abs foo]
|
||||
mov rbx,[abs foo]
|
||||
mov rax,[abs dword foo]
|
||||
mov rax,[abs qword foo]
|
||||
|
||||
mov rax,[es:foo]
|
||||
mov rax,[qword es:123456789abcdef0h]
|
||||
mov rbx,[es:foo]
|
||||
mov rax,[dword es:foo]
|
||||
mov rbx,[dword es:foo]
|
||||
mov rax,[qword es:foo]
|
||||
mov rax,[rel es:foo] ; rel
|
||||
mov rbx,[rel es:foo] ; rel
|
||||
mov rax,[rel dword es:foo] ; rel
|
||||
;mov rax,[rel qword es:foo] ; illegal
|
||||
mov rax,[abs es:foo]
|
||||
mov rbx,[abs es:foo]
|
||||
mov rax,[abs dword es:foo]
|
||||
mov rax,[abs qword es:foo]
|
||||
|
||||
mov rax,[fs:foo]
|
||||
mov rax,[qword fs:123456789abcdef0h]
|
||||
mov rbx,[fs:foo]
|
||||
mov rax,[dword fs:foo]
|
||||
mov rbx,[dword fs:foo]
|
||||
mov rax,[qword fs:foo]
|
||||
mov rax,[rel fs:foo] ; rel
|
||||
mov rbx,[rel fs:foo] ; rel
|
||||
mov rax,[rel dword fs:foo] ; rel
|
||||
;mov rax,[rel qword fs:foo] ; illegal
|
||||
mov rax,[abs fs:foo]
|
||||
mov rbx,[abs fs:foo]
|
||||
mov rax,[abs dword fs:foo]
|
||||
mov rax,[abs qword fs:foo]
|
||||
|
||||
mov rax,[rbx]
|
||||
mov rax,[rel rbx]
|
||||
mov rax,[abs rbx]
|
||||
|
||||
default rel
|
||||
|
||||
; all of these are default rel, except for 64-bit displacements
|
||||
mov rax,[foo]
|
||||
mov rax,[qword 123456789abcdef0h] ; abs
|
||||
mov rbx,[foo]
|
||||
mov rax,[dword foo]
|
||||
mov rbx,[dword foo]
|
||||
mov rax,[qword foo] ; abs
|
||||
mov rax,[rel foo]
|
||||
mov rbx,[rel foo]
|
||||
mov rax,[rel dword foo]
|
||||
;mov rax,[rel qword foo] ; illegal
|
||||
mov rax,[abs foo]
|
||||
mov rbx,[abs foo]
|
||||
mov rax,[abs dword foo]
|
||||
mov rax,[abs qword foo]
|
||||
|
||||
; all of these are abs due to es:, except for explicit rel
|
||||
mov rax,[es:foo]
|
||||
mov rax,[qword es:123456789abcdef0h]
|
||||
mov rbx,[es:foo]
|
||||
mov rax,[dword es:foo]
|
||||
mov rbx,[dword es:foo]
|
||||
mov rax,[qword es:foo]
|
||||
mov rax,[rel es:foo] ; rel
|
||||
mov rbx,[rel es:foo] ; rel
|
||||
mov rax,[rel dword es:foo] ; rel
|
||||
;mov rax,[rel qword es:foo] ; illegal
|
||||
mov rax,[abs es:foo]
|
||||
mov rbx,[abs es:foo]
|
||||
mov rax,[abs dword es:foo]
|
||||
mov rax,[abs qword es:foo]
|
||||
|
||||
; all of these are abs due to fs:, except for explicit rel
|
||||
mov rax,[fs:foo]
|
||||
mov rax,[qword fs:123456789abcdef0h]
|
||||
mov rbx,[fs:foo]
|
||||
mov rax,[dword fs:foo]
|
||||
mov rbx,[dword fs:foo]
|
||||
mov rax,[qword fs:foo]
|
||||
mov rax,[rel fs:foo] ; rel
|
||||
mov rbx,[rel fs:foo] ; rel
|
||||
mov rax,[rel dword fs:foo] ; rel
|
||||
;mov rax,[rel qword fs:foo] ; illegal
|
||||
mov rax,[abs fs:foo]
|
||||
mov rbx,[abs fs:foo]
|
||||
mov rax,[abs dword fs:foo]
|
||||
mov rax,[abs qword fs:foo]
|
||||
|
||||
mov rax,[rbx]
|
||||
mov rax,[rel rbx]
|
||||
mov rax,[abs rbx]
|
||||
|
||||
section .data
|
||||
foo equ $
|
||||
|
||||
26
modules/arch/x86/tests/riprel2.errwarn
Normal file
26
modules/arch/x86/tests/riprel2.errwarn
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
-:20: warning: `es' segment register ignored in 64-bit mode
|
||||
-:21: warning: `es' segment register ignored in 64-bit mode
|
||||
-:22: warning: `es' segment register ignored in 64-bit mode
|
||||
-:23: warning: `es' segment register ignored in 64-bit mode
|
||||
-:24: warning: `es' segment register ignored in 64-bit mode
|
||||
-:25: warning: `es' segment register ignored in 64-bit mode
|
||||
-:26: warning: `es' segment register ignored in 64-bit mode
|
||||
-:27: warning: `es' segment register ignored in 64-bit mode
|
||||
-:28: warning: `es' segment register ignored in 64-bit mode
|
||||
-:30: warning: `es' segment register ignored in 64-bit mode
|
||||
-:31: warning: `es' segment register ignored in 64-bit mode
|
||||
-:32: warning: `es' segment register ignored in 64-bit mode
|
||||
-:33: warning: `es' segment register ignored in 64-bit mode
|
||||
-:73: warning: `es' segment register ignored in 64-bit mode
|
||||
-:74: warning: `es' segment register ignored in 64-bit mode
|
||||
-:75: warning: `es' segment register ignored in 64-bit mode
|
||||
-:76: warning: `es' segment register ignored in 64-bit mode
|
||||
-:77: warning: `es' segment register ignored in 64-bit mode
|
||||
-:78: warning: `es' segment register ignored in 64-bit mode
|
||||
-:79: warning: `es' segment register ignored in 64-bit mode
|
||||
-:80: warning: `es' segment register ignored in 64-bit mode
|
||||
-:81: warning: `es' segment register ignored in 64-bit mode
|
||||
-:83: warning: `es' segment register ignored in 64-bit mode
|
||||
-:84: warning: `es' segment register ignored in 64-bit mode
|
||||
-:85: warning: `es' segment register ignored in 64-bit mode
|
||||
-:86: warning: `es' segment register ignored in 64-bit mode
|
||||
708
modules/arch/x86/tests/riprel2.hex
Normal file
708
modules/arch/x86/tests/riprel2.hex
Normal file
|
|
@ -0,0 +1,708 @@
|
|||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
f0
|
||||
de
|
||||
bc
|
||||
9a
|
||||
78
|
||||
56
|
||||
34
|
||||
12
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
89
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1d
|
||||
82
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
7b
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
a1
|
||||
f0
|
||||
de
|
||||
bc
|
||||
9a
|
||||
78
|
||||
56
|
||||
34
|
||||
12
|
||||
26
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
05
|
||||
17
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
1d
|
||||
0f
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
05
|
||||
07
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
a1
|
||||
f0
|
||||
de
|
||||
bc
|
||||
9a
|
||||
78
|
||||
56
|
||||
34
|
||||
12
|
||||
64
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
05
|
||||
9f
|
||||
01
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
1d
|
||||
97
|
||||
01
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
05
|
||||
8f
|
||||
01
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
03
|
||||
48
|
||||
8b
|
||||
03
|
||||
48
|
||||
8b
|
||||
03
|
||||
48
|
||||
8b
|
||||
05
|
||||
59
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
f0
|
||||
de
|
||||
bc
|
||||
9a
|
||||
78
|
||||
56
|
||||
34
|
||||
12
|
||||
48
|
||||
8b
|
||||
1d
|
||||
48
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
41
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1d
|
||||
3a
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
29
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1d
|
||||
22
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
05
|
||||
1b
|
||||
01
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
a1
|
||||
f0
|
||||
de
|
||||
bc
|
||||
9a
|
||||
78
|
||||
56
|
||||
34
|
||||
12
|
||||
26
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
05
|
||||
b7
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
1d
|
||||
af
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
05
|
||||
a7
|
||||
00
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
26
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
a1
|
||||
f0
|
||||
de
|
||||
bc
|
||||
9a
|
||||
78
|
||||
56
|
||||
34
|
||||
12
|
||||
64
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
05
|
||||
3f
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
1d
|
||||
37
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
05
|
||||
2f
|
||||
00
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
1c
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
8b
|
||||
04
|
||||
25
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
64
|
||||
48
|
||||
a1
|
||||
c4
|
||||
02
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
48
|
||||
8b
|
||||
03
|
||||
48
|
||||
8b
|
||||
03
|
||||
48
|
||||
8b
|
||||
03
|
||||
509
modules/arch/x86/tests/sse5-all.asm
Normal file
509
modules/arch/x86/tests/sse5-all.asm
Normal file
|
|
@ -0,0 +1,509 @@
|
|||
; Instructions are ordered in SSE5 databook order
|
||||
; BITS=16 to minimize output length
|
||||
[bits 16]
|
||||
compd xmm1, xmm4, xmm7, 5 ; 0F 25 2D 347 10 05
|
||||
compd xmm2, xmm5, [0], byte 5 ; 0F 25 2D 056 20 00 00 05
|
||||
compd xmm3, xmm6, dqword [0], 5 ; 0F 25 2D 066 30 00 00 05
|
||||
|
||||
comps xmm1, xmm4, xmm7, 5 ; 0F 25 2C 347 10 05
|
||||
comps xmm2, xmm5, [0], byte 5 ; 0F 25 2C 056 20 00 00 05
|
||||
comps xmm3, xmm6, dqword [0], 5 ; 0F 25 2C 066 30 00 00 05
|
||||
|
||||
comsd xmm1, xmm4, xmm7, 5 ; 0F 25 2F 347 10 05
|
||||
comsd xmm2, xmm5, [0], byte 5 ; 0F 25 2F 056 20 00 00 05
|
||||
comsd xmm3, xmm6, qword [0], 5 ; 0F 25 2F 066 30 00 00 05
|
||||
|
||||
comss xmm1, xmm4, xmm7, 5 ; 0F 25 2E 347 10 05
|
||||
comss xmm2, xmm5, [0], byte 5 ; 0F 25 2E 056 20 00 00 05
|
||||
comss xmm3, xmm6, dword [0], 5 ; 0F 25 2E 066 30 00 00 05
|
||||
|
||||
cvtph2ps xmm1, xmm4 ; 0F 7A 30 314
|
||||
cvtph2ps xmm2, [0] ; 0F 7A 30 026 00 00
|
||||
cvtph2ps xmm3, qword [0] ; 0F 7A 30 036 00 00
|
||||
|
||||
cvtps2ph xmm1, xmm4 ; 0F 7A 31 341
|
||||
cvtps2ph [0], xmm2 ; 0F 7A 31 026 00 00
|
||||
cvtps2ph qword [0], xmm3 ; 0F 7A 31 036 00 00
|
||||
|
||||
fmaddpd xmm1, xmm1, xmm2, xmm3 ; 0F 24 01 323 10 /or/ 0F 24 01 332 18
|
||||
fmaddpd xmm1, xmm1, xmm2, [0] ; 0F 24 01 026 10 00 00
|
||||
fmaddpd xmm1, xmm1, xmm2, dqword [0] ; 0F 24 01 026 10 00 00
|
||||
fmaddpd xmm1, xmm1, [0], xmm3 ; 0F 24 01 036 18 00 00
|
||||
fmaddpd xmm1, xmm1, dqword [0], xmm3 ; 0F 24 01 036 18 00 00
|
||||
fmaddpd xmm1, xmm2, xmm3, xmm1 ; 0F 24 05 323 10 /or/ 0F 24 05 332 18
|
||||
fmaddpd xmm1, xmm2, [0], xmm1 ; 0F 24 05 026 10 00 00
|
||||
fmaddpd xmm1, xmm2, dqword [0], xmm1 ; 0F 24 05 026 10 00 00
|
||||
fmaddpd xmm1, [0], xmm3, xmm1 ; 0F 24 05 036 18 00 00
|
||||
fmaddpd xmm1, dqword [0], xmm3, xmm1 ; 0F 24 05 036 18 00 00
|
||||
|
||||
fmaddps xmm1, xmm1, xmm2, xmm3 ; 0F 24 00 323 10 /or/ 0F 24 00 332 18
|
||||
fmaddps xmm1, xmm1, xmm2, [0] ; 0F 24 00 026 10 00 00
|
||||
fmaddps xmm1, xmm1, xmm2, dqword [0] ; 0F 24 00 026 10 00 00
|
||||
fmaddps xmm1, xmm1, [0], xmm3 ; 0F 24 00 036 18 00 00
|
||||
fmaddps xmm1, xmm1, dqword [0], xmm3 ; 0F 24 00 036 18 00 00
|
||||
fmaddps xmm1, xmm2, xmm3, xmm1 ; 0F 24 04 323 10 /or/ 0F 24 04 332 18
|
||||
fmaddps xmm1, xmm2, [0], xmm1 ; 0F 24 04 026 10 00 00
|
||||
fmaddps xmm1, xmm2, dqword [0], xmm1 ; 0F 24 04 026 10 00 00
|
||||
fmaddps xmm1, [0], xmm3, xmm1 ; 0F 24 04 036 18 00 00
|
||||
fmaddps xmm1, dqword [0], xmm3, xmm1 ; 0F 24 04 036 18 00 00
|
||||
|
||||
fmaddsd xmm1, xmm1, xmm2, xmm3 ; 0F 24 03 323 10 /or/ 0F 24 03 332 18
|
||||
fmaddsd xmm1, xmm1, xmm2, [0] ; 0F 24 03 026 10 00 00
|
||||
fmaddsd xmm1, xmm1, xmm2, qword [0] ; 0F 24 03 026 10 00 00
|
||||
fmaddsd xmm1, xmm1, [0], xmm3 ; 0F 24 03 036 18 00 00
|
||||
fmaddsd xmm1, xmm1, qword [0], xmm3 ; 0F 24 03 036 18 00 00
|
||||
fmaddsd xmm1, xmm2, xmm3, xmm1 ; 0F 24 07 323 10 /or/ 0F 24 07 332 18
|
||||
fmaddsd xmm1, xmm2, [0], xmm1 ; 0F 24 07 026 10 00 00
|
||||
fmaddsd xmm1, xmm2, qword [0], xmm1 ; 0F 24 07 026 10 00 00
|
||||
fmaddsd xmm1, [0], xmm3, xmm1 ; 0F 24 07 036 18 00 00
|
||||
fmaddsd xmm1, qword [0], xmm3, xmm1 ; 0F 24 07 036 18 00 00
|
||||
|
||||
fmaddss xmm1, xmm1, xmm2, xmm3 ; 0F 24 02 323 10 /or/ 0F 24 02 332 18
|
||||
fmaddss xmm1, xmm1, xmm2, [0] ; 0F 24 02 026 10 00 00
|
||||
fmaddss xmm1, xmm1, xmm2, dword [0] ; 0F 24 02 026 10 00 00
|
||||
fmaddss xmm1, xmm1, [0], xmm3 ; 0F 24 02 036 18 00 00
|
||||
fmaddss xmm1, xmm1, dword [0], xmm3 ; 0F 24 02 036 18 00 00
|
||||
fmaddss xmm1, xmm2, xmm3, xmm1 ; 0F 24 06 323 10 /or/ 0F 24 06 332 18
|
||||
fmaddss xmm1, xmm2, [0], xmm1 ; 0F 24 06 026 10 00 00
|
||||
fmaddss xmm1, xmm2, dword [0], xmm1 ; 0F 24 06 026 10 00 00
|
||||
fmaddss xmm1, [0], xmm3, xmm1 ; 0F 24 06 036 18 00 00
|
||||
fmaddss xmm1, dword [0], xmm3, xmm1 ; 0F 24 06 036 18 00 00
|
||||
|
||||
fmsubpd xmm1, xmm1, xmm2, xmm3 ; 0F 24 09 323 10 /or/ 0F 24 09 332 18
|
||||
fmsubpd xmm1, xmm1, xmm2, [0] ; 0F 24 09 026 10 00 00
|
||||
fmsubpd xmm1, xmm1, xmm2, dqword [0] ; 0F 24 09 026 10 00 00
|
||||
fmsubpd xmm1, xmm1, [0], xmm3 ; 0F 24 09 036 18 00 00
|
||||
fmsubpd xmm1, xmm1, dqword [0], xmm3 ; 0F 24 09 036 18 00 00
|
||||
fmsubpd xmm1, xmm2, xmm3, xmm1 ; 0F 24 0D 323 10 /or/ 0F 24 0D 332 18
|
||||
fmsubpd xmm1, xmm2, [0], xmm1 ; 0F 24 0D 026 10 00 00
|
||||
fmsubpd xmm1, xmm2, dqword [0], xmm1 ; 0F 24 0D 026 10 00 00
|
||||
fmsubpd xmm1, [0], xmm3, xmm1 ; 0F 24 0D 036 18 00 00
|
||||
fmsubpd xmm1, dqword [0], xmm3, xmm1 ; 0F 24 0D 036 18 00 00
|
||||
|
||||
fmsubps xmm1, xmm1, xmm2, xmm3 ; 0F 24 08 323 10 /or/ 0F 24 08 332 18
|
||||
fmsubps xmm1, xmm1, xmm2, [0] ; 0F 24 08 026 10 00 00
|
||||
fmsubps xmm1, xmm1, xmm2, dqword [0] ; 0F 24 08 026 10 00 00
|
||||
fmsubps xmm1, xmm1, [0], xmm3 ; 0F 24 08 036 18 00 00
|
||||
fmsubps xmm1, xmm1, dqword [0], xmm3 ; 0F 24 08 036 18 00 00
|
||||
fmsubps xmm1, xmm2, xmm3, xmm1 ; 0F 24 0C 323 10 /or/ 0F 24 0C 332 18
|
||||
fmsubps xmm1, xmm2, [0], xmm1 ; 0F 24 0C 026 10 00 00
|
||||
fmsubps xmm1, xmm2, dqword [0], xmm1 ; 0F 24 0C 026 10 00 00
|
||||
fmsubps xmm1, [0], xmm3, xmm1 ; 0F 24 0C 036 18 00 00
|
||||
fmsubps xmm1, dqword [0], xmm3, xmm1 ; 0F 24 0C 036 18 00 00
|
||||
|
||||
fmsubsd xmm1, xmm1, xmm2, xmm3 ; 0F 24 0B 323 10 /or/ 0F 24 0B 332 18
|
||||
fmsubsd xmm1, xmm1, xmm2, [0] ; 0F 24 0B 026 10 00 00
|
||||
fmsubsd xmm1, xmm1, xmm2, qword [0] ; 0F 24 0B 026 10 00 00
|
||||
fmsubsd xmm1, xmm1, [0], xmm3 ; 0F 24 0B 036 18 00 00
|
||||
fmsubsd xmm1, xmm1, qword [0], xmm3 ; 0F 24 0B 036 18 00 00
|
||||
fmsubsd xmm1, xmm2, xmm3, xmm1 ; 0F 24 0F 323 10 /or/ 0F 24 0F 332 18
|
||||
fmsubsd xmm1, xmm2, [0], xmm1 ; 0F 24 0F 026 10 00 00
|
||||
fmsubsd xmm1, xmm2, qword [0], xmm1 ; 0F 24 0F 026 10 00 00
|
||||
fmsubsd xmm1, [0], xmm3, xmm1 ; 0F 24 0F 036 18 00 00
|
||||
fmsubsd xmm1, qword [0], xmm3, xmm1 ; 0F 24 0F 036 18 00 00
|
||||
|
||||
fmsubss xmm1, xmm1, xmm2, xmm3 ; 0F 24 0A 323 10 /or/ 0F 24 0A 332 18
|
||||
fmsubss xmm1, xmm1, xmm2, [0] ; 0F 24 0A 026 10 00 00
|
||||
fmsubss xmm1, xmm1, xmm2, dword [0] ; 0F 24 0A 026 10 00 00
|
||||
fmsubss xmm1, xmm1, [0], xmm3 ; 0F 24 0A 036 18 00 00
|
||||
fmsubss xmm1, xmm1, dword [0], xmm3 ; 0F 24 0A 036 18 00 00
|
||||
fmsubss xmm1, xmm2, xmm3, xmm1 ; 0F 24 0E 323 10 /or/ 0F 24 0E 332 18
|
||||
fmsubss xmm1, xmm2, [0], xmm1 ; 0F 24 0E 026 10 00 00
|
||||
fmsubss xmm1, xmm2, dword [0], xmm1 ; 0F 24 0E 026 10 00 00
|
||||
fmsubss xmm1, [0], xmm3, xmm1 ; 0F 24 0E 036 18 00 00
|
||||
fmsubss xmm1, dword [0], xmm3, xmm1 ; 0F 24 0E 036 18 00 00
|
||||
|
||||
fnmaddpd xmm1, xmm1, xmm2, xmm3 ; 0F 24 11 323 10 /or/ 0F 24 11 332 18
|
||||
fnmaddpd xmm1, xmm1, xmm2, [0] ; 0F 24 11 026 10 00 00
|
||||
fnmaddpd xmm1, xmm1, xmm2, dqword [0] ; 0F 24 11 026 10 00 00
|
||||
fnmaddpd xmm1, xmm1, [0], xmm3 ; 0F 24 11 036 18 00 00
|
||||
fnmaddpd xmm1, xmm1, dqword [0], xmm3 ; 0F 24 11 036 18 00 00
|
||||
fnmaddpd xmm1, xmm2, xmm3, xmm1 ; 0F 24 15 323 10 /or/ 0F 24 15 332 18
|
||||
fnmaddpd xmm1, xmm2, [0], xmm1 ; 0F 24 15 026 10 00 00
|
||||
fnmaddpd xmm1, xmm2, dqword [0], xmm1 ; 0F 24 15 026 10 00 00
|
||||
fnmaddpd xmm1, [0], xmm3, xmm1 ; 0F 24 15 036 18 00 00
|
||||
fnmaddpd xmm1, dqword [0], xmm3, xmm1 ; 0F 24 15 036 18 00 00
|
||||
|
||||
fnmaddps xmm1, xmm1, xmm2, xmm3 ; 0F 24 10 323 10 /or/ 0F 24 10 332 18
|
||||
fnmaddps xmm1, xmm1, xmm2, [0] ; 0F 24 10 026 10 00 00
|
||||
fnmaddps xmm1, xmm1, xmm2, dqword [0] ; 0F 24 10 026 10 00 00
|
||||
fnmaddps xmm1, xmm1, [0], xmm3 ; 0F 24 10 036 18 00 00
|
||||
fnmaddps xmm1, xmm1, dqword [0], xmm3 ; 0F 24 10 036 18 00 00
|
||||
fnmaddps xmm1, xmm2, xmm3, xmm1 ; 0F 24 14 323 10 /or/ 0F 24 14 332 18
|
||||
fnmaddps xmm1, xmm2, [0], xmm1 ; 0F 24 14 026 10 00 00
|
||||
fnmaddps xmm1, xmm2, dqword [0], xmm1 ; 0F 24 14 026 10 00 00
|
||||
fnmaddps xmm1, [0], xmm3, xmm1 ; 0F 24 14 036 18 00 00
|
||||
fnmaddps xmm1, dqword [0], xmm3, xmm1 ; 0F 24 14 036 18 00 00
|
||||
|
||||
fnmaddsd xmm1, xmm1, xmm2, xmm3 ; 0F 24 13 323 10 /or/ 0F 24 13 332 18
|
||||
fnmaddsd xmm1, xmm1, xmm2, [0] ; 0F 24 13 026 10 00 00
|
||||
fnmaddsd xmm1, xmm1, xmm2, qword [0] ; 0F 24 13 026 10 00 00
|
||||
fnmaddsd xmm1, xmm1, [0], xmm3 ; 0F 24 13 036 18 00 00
|
||||
fnmaddsd xmm1, xmm1, qword [0], xmm3 ; 0F 24 13 036 18 00 00
|
||||
fnmaddsd xmm1, xmm2, xmm3, xmm1 ; 0F 24 17 323 10 /or/ 0F 24 17 332 18
|
||||
fnmaddsd xmm1, xmm2, [0], xmm1 ; 0F 24 17 026 10 00 00
|
||||
fnmaddsd xmm1, xmm2, qword [0], xmm1 ; 0F 24 17 026 10 00 00
|
||||
fnmaddsd xmm1, [0], xmm3, xmm1 ; 0F 24 17 036 18 00 00
|
||||
fnmaddsd xmm1, qword [0], xmm3, xmm1 ; 0F 24 17 036 18 00 00
|
||||
|
||||
fnmaddss xmm1, xmm1, xmm2, xmm3 ; 0F 24 12 323 10 /or/ 0F 24 12 332 18
|
||||
fnmaddss xmm1, xmm1, xmm2, [0] ; 0F 24 12 026 10 00 00
|
||||
fnmaddss xmm1, xmm1, xmm2, dword [0] ; 0F 24 12 026 10 00 00
|
||||
fnmaddss xmm1, xmm1, [0], xmm3 ; 0F 24 12 036 18 00 00
|
||||
fnmaddss xmm1, xmm1, dword [0], xmm3 ; 0F 24 12 036 18 00 00
|
||||
fnmaddss xmm1, xmm2, xmm3, xmm1 ; 0F 24 16 323 10 /or/ 0F 24 16 332 18
|
||||
fnmaddss xmm1, xmm2, [0], xmm1 ; 0F 24 16 026 10 00 00
|
||||
fnmaddss xmm1, xmm2, dword [0], xmm1 ; 0F 24 16 026 10 00 00
|
||||
fnmaddss xmm1, [0], xmm3, xmm1 ; 0F 24 16 036 18 00 00
|
||||
fnmaddss xmm1, dword [0], xmm3, xmm1 ; 0F 24 16 036 18 00 00
|
||||
|
||||
fnmsubpd xmm1, xmm1, xmm2, xmm3 ; 0F 24 19 323 10 /or/ 0F 24 19 332 18
|
||||
fnmsubpd xmm1, xmm1, xmm2, [0] ; 0F 24 19 026 10 00 00
|
||||
fnmsubpd xmm1, xmm1, xmm2, dqword [0] ; 0F 24 19 026 10 00 00
|
||||
fnmsubpd xmm1, xmm1, [0], xmm3 ; 0F 24 19 036 18 00 00
|
||||
fnmsubpd xmm1, xmm1, dqword [0], xmm3 ; 0F 24 19 036 18 00 00
|
||||
fnmsubpd xmm1, xmm2, xmm3, xmm1 ; 0F 24 1D 323 10 /or/ 0F 24 1D 332 18
|
||||
fnmsubpd xmm1, xmm2, [0], xmm1 ; 0F 24 1D 026 10 00 00
|
||||
fnmsubpd xmm1, xmm2, dqword [0], xmm1 ; 0F 24 1D 026 10 00 00
|
||||
fnmsubpd xmm1, [0], xmm3, xmm1 ; 0F 24 1D 036 18 00 00
|
||||
fnmsubpd xmm1, dqword [0], xmm3, xmm1 ; 0F 24 1D 036 18 00 00
|
||||
|
||||
fnmsubps xmm1, xmm1, xmm2, xmm3 ; 0F 24 18 323 10 /or/ 0F 24 18 332 18
|
||||
fnmsubps xmm1, xmm1, xmm2, [0] ; 0F 24 18 026 10 00 00
|
||||
fnmsubps xmm1, xmm1, xmm2, dqword [0] ; 0F 24 18 026 10 00 00
|
||||
fnmsubps xmm1, xmm1, [0], xmm3 ; 0F 24 18 036 18 00 00
|
||||
fnmsubps xmm1, xmm1, dqword [0], xmm3 ; 0F 24 18 036 18 00 00
|
||||
fnmsubps xmm1, xmm2, xmm3, xmm1 ; 0F 24 1C 323 10 /or/ 0F 24 1C 332 18
|
||||
fnmsubps xmm1, xmm2, [0], xmm1 ; 0F 24 1C 026 10 00 00
|
||||
fnmsubps xmm1, xmm2, dqword [0], xmm1 ; 0F 24 1C 026 10 00 00
|
||||
fnmsubps xmm1, [0], xmm3, xmm1 ; 0F 24 1C 036 18 00 00
|
||||
fnmsubps xmm1, dqword [0], xmm3, xmm1 ; 0F 24 1C 036 18 00 00
|
||||
|
||||
fnmsubsd xmm1, xmm1, xmm2, xmm3 ; 0F 24 1B 323 10 /or/ 0F 24 1B 332 18
|
||||
fnmsubsd xmm1, xmm1, xmm2, [0] ; 0F 24 1B 026 10 00 00
|
||||
fnmsubsd xmm1, xmm1, xmm2, qword [0] ; 0F 24 1B 026 10 00 00
|
||||
fnmsubsd xmm1, xmm1, [0], xmm3 ; 0F 24 1B 036 18 00 00
|
||||
fnmsubsd xmm1, xmm1, qword [0], xmm3 ; 0F 24 1B 036 18 00 00
|
||||
fnmsubsd xmm1, xmm2, xmm3, xmm1 ; 0F 24 1F 323 10 /or/ 0F 24 1F 332 18
|
||||
fnmsubsd xmm1, xmm2, [0], xmm1 ; 0F 24 1F 026 10 00 00
|
||||
fnmsubsd xmm1, xmm2, qword [0], xmm1 ; 0F 24 1F 026 10 00 00
|
||||
fnmsubsd xmm1, [0], xmm3, xmm1 ; 0F 24 1F 036 18 00 00
|
||||
fnmsubsd xmm1, qword [0], xmm3, xmm1 ; 0F 24 1F 036 18 00 00
|
||||
|
||||
fnmsubss xmm1, xmm1, xmm2, xmm3 ; 0F 24 1A 323 10 /or/ 0F 24 1A 332 18
|
||||
fnmsubss xmm1, xmm1, xmm2, [0] ; 0F 24 1A 026 10 00 00
|
||||
fnmsubss xmm1, xmm1, xmm2, dword [0] ; 0F 24 1A 026 10 00 00
|
||||
fnmsubss xmm1, xmm1, [0], xmm3 ; 0F 24 1A 036 18 00 00
|
||||
fnmsubss xmm1, xmm1, dword [0], xmm3 ; 0F 24 1A 036 18 00 00
|
||||
fnmsubss xmm1, xmm2, xmm3, xmm1 ; 0F 24 1E 323 10 /or/ 0F 24 1E 332 18
|
||||
fnmsubss xmm1, xmm2, [0], xmm1 ; 0F 24 1E 026 10 00 00
|
||||
fnmsubss xmm1, xmm2, dword [0], xmm1 ; 0F 24 1E 026 10 00 00
|
||||
fnmsubss xmm1, [0], xmm3, xmm1 ; 0F 24 1E 036 18 00 00
|
||||
fnmsubss xmm1, dword [0], xmm3, xmm1 ; 0F 24 1E 036 18 00 00
|
||||
|
||||
frczpd xmm1, xmm2 ; 0F 7A 11 312
|
||||
frczpd xmm1, [0] ; 0F 7A 11 016 00 00
|
||||
frczpd xmm1, dqword [0] ; 0F 7A 11 016 00 00
|
||||
|
||||
frczps xmm1, xmm2 ; 0F 7A 10 312
|
||||
frczps xmm1, [0] ; 0F 7A 10 016 00 00
|
||||
frczps xmm1, dqword [0] ; 0F 7A 10 016 00 00
|
||||
|
||||
frczsd xmm1, xmm2 ; 0F 7A 13 312
|
||||
frczsd xmm1, [0] ; 0F 7A 13 016 00 00
|
||||
frczsd xmm1, qword [0] ; 0F 7A 13 016 00 00
|
||||
|
||||
frczss xmm1, xmm2 ; 0F 7A 12 312
|
||||
frczss xmm1, [0] ; 0F 7A 12 016 00 00
|
||||
frczss xmm1, dword [0] ; 0F 7A 12 016 00 00
|
||||
|
||||
pcmov xmm1, xmm1, xmm2, xmm3 ; 0F 24 22 323 10 /or/ 0F 24 22 332 18
|
||||
pcmov xmm1, xmm1, xmm2, [0] ; 0F 24 22 026 10 00 00
|
||||
pcmov xmm1, xmm1, xmm2, dqword [0] ; 0F 24 22 026 10 00 00
|
||||
pcmov xmm1, xmm1, [0], xmm3 ; 0F 24 22 036 18 00 00
|
||||
pcmov xmm1, xmm1, dqword [0], xmm3 ; 0F 24 22 036 18 00 00
|
||||
pcmov xmm1, xmm2, xmm3, xmm1 ; 0F 24 26 323 10 /or/ 0F 24 26 332 18
|
||||
pcmov xmm1, xmm2, [0], xmm1 ; 0F 24 26 026 10 00 00
|
||||
pcmov xmm1, xmm2, dqword [0], xmm1 ; 0F 24 26 026 10 00 00
|
||||
pcmov xmm1, [0], xmm3, xmm1 ; 0F 24 26 036 18 00 00
|
||||
pcmov xmm1, dqword [0], xmm3, xmm1 ; 0F 24 26 036 18 00 00
|
||||
|
||||
pcomb xmm1, xmm4, xmm7, 5 ; 0F 25 4C 347 10 05
|
||||
pcomb xmm2, xmm5, [0], byte 5 ; 0F 25 4C 056 20 00 00 05
|
||||
pcomb xmm3, xmm6, dqword [0], 5 ; 0F 25 4C 066 30 00 00 05
|
||||
|
||||
pcomd xmm1, xmm4, xmm7, 5 ; 0F 25 4E 347 10 05
|
||||
pcomd xmm2, xmm5, [0], byte 5 ; 0F 25 4E 056 20 00 00 05
|
||||
pcomd xmm3, xmm6, dqword [0], 5 ; 0F 25 4E 066 30 00 00 05
|
||||
|
||||
pcomq xmm1, xmm4, xmm7, 5 ; 0F 25 4F 347 10 05
|
||||
pcomq xmm2, xmm5, [0], byte 5 ; 0F 25 4F 056 20 00 00 05
|
||||
pcomq xmm3, xmm6, dqword [0], 5 ; 0F 25 4F 066 30 00 00 05
|
||||
|
||||
pcomub xmm1, xmm4, xmm7, 5 ; 0F 25 6C 347 10 05
|
||||
pcomub xmm2, xmm5, [0], byte 5 ; 0F 25 6C 056 20 00 00 05
|
||||
pcomub xmm3, xmm6, dqword [0], 5 ; 0F 25 6C 066 30 00 00 05
|
||||
|
||||
pcomud xmm1, xmm4, xmm7, 5 ; 0F 25 6E 347 10 05
|
||||
pcomud xmm2, xmm5, [0], byte 5 ; 0F 25 6E 056 20 00 00 05
|
||||
pcomud xmm3, xmm6, dqword [0], 5 ; 0F 25 6E 066 30 00 00 05
|
||||
|
||||
pcomuq xmm1, xmm4, xmm7, 5 ; 0F 25 6F 347 10 05
|
||||
pcomuq xmm2, xmm5, [0], byte 5 ; 0F 25 6F 056 20 00 00 05
|
||||
pcomuq xmm3, xmm6, dqword [0], 5 ; 0F 25 6F 066 30 00 00 05
|
||||
|
||||
pcomuw xmm1, xmm4, xmm7, 5 ; 0F 25 6D 347 10 05
|
||||
pcomuw xmm2, xmm5, [0], byte 5 ; 0F 25 6D 056 20 00 00 05
|
||||
pcomuw xmm3, xmm6, dqword [0], 5 ; 0F 25 6D 066 30 00 00 05
|
||||
|
||||
pcomw xmm1, xmm4, xmm7, 5 ; 0F 25 4D 347 10 05
|
||||
pcomw xmm2, xmm5, [0], byte 5 ; 0F 25 4D 056 20 00 00 05
|
||||
pcomw xmm3, xmm6, dqword [0], 5 ; 0F 25 4D 066 30 00 00 05
|
||||
|
||||
permpd xmm1, xmm1, xmm2, xmm3 ; 0F 24 21 323 10 /or/ 0F 24 21 332 18
|
||||
permpd xmm1, xmm1, xmm2, [0] ; 0F 24 21 026 10 00 00
|
||||
permpd xmm1, xmm1, xmm2, dqword [0] ; 0F 24 21 026 10 00 00
|
||||
permpd xmm1, xmm1, [0], xmm3 ; 0F 24 21 036 18 00 00
|
||||
permpd xmm1, xmm1, dqword [0], xmm3 ; 0F 24 21 036 18 00 00
|
||||
permpd xmm1, xmm2, xmm3, xmm1 ; 0F 24 25 323 10 /or/ 0F 24 25 332 18
|
||||
permpd xmm1, xmm2, [0], xmm1 ; 0F 24 25 026 10 00 00
|
||||
permpd xmm1, xmm2, dqword [0], xmm1 ; 0F 24 25 026 10 00 00
|
||||
permpd xmm1, [0], xmm3, xmm1 ; 0F 24 25 036 18 00 00
|
||||
permpd xmm1, dqword [0], xmm3, xmm1 ; 0F 24 25 036 18 00 00
|
||||
|
||||
permps xmm1, xmm1, xmm2, xmm3 ; 0F 24 20 323 10 /or/ 0F 24 20 332 18
|
||||
permps xmm1, xmm1, xmm2, [0] ; 0F 24 20 026 10 00 00
|
||||
permps xmm1, xmm1, xmm2, dqword [0] ; 0F 24 20 026 10 00 00
|
||||
permps xmm1, xmm1, [0], xmm3 ; 0F 24 20 036 18 00 00
|
||||
permps xmm1, xmm1, dqword [0], xmm3 ; 0F 24 20 036 18 00 00
|
||||
permps xmm1, xmm2, xmm3, xmm1 ; 0F 24 24 323 10 /or/ 0F 24 24 332 18
|
||||
permps xmm1, xmm2, [0], xmm1 ; 0F 24 24 026 10 00 00
|
||||
permps xmm1, xmm2, dqword [0], xmm1 ; 0F 24 24 026 10 00 00
|
||||
permps xmm1, [0], xmm3, xmm1 ; 0F 24 24 036 18 00 00
|
||||
permps xmm1, dqword [0], xmm3, xmm1 ; 0F 24 24 036 18 00 00
|
||||
|
||||
phaddbd xmm1, xmm2 ; 0F 7A 42 312
|
||||
phaddbd xmm1, [0] ; 0F 7A 42 016 00 00
|
||||
phaddbd xmm1, dqword [0] ; 0F 7A 42 016 00 00
|
||||
|
||||
phaddbq xmm1, xmm2 ; 0F 7A 43 312
|
||||
phaddbq xmm1, [0] ; 0F 7A 43 016 00 00
|
||||
phaddbq xmm1, dqword [0] ; 0F 7A 43 016 00 00
|
||||
|
||||
phaddbw xmm1, xmm2 ; 0F 7A 41 312
|
||||
phaddbw xmm1, [0] ; 0F 7A 41 016 00 00
|
||||
phaddbw xmm1, dqword [0] ; 0F 7A 41 016 00 00
|
||||
|
||||
phadddq xmm1, xmm2 ; 0F 7A 4B 312
|
||||
phadddq xmm1, [0] ; 0F 7A 4B 016 00 00
|
||||
phadddq xmm1, dqword [0] ; 0F 7A 4B 016 00 00
|
||||
|
||||
phaddubd xmm1, xmm2 ; 0F 7A 52 312
|
||||
phaddubd xmm1, [0] ; 0F 7A 52 016 00 00
|
||||
phaddubd xmm1, dqword [0] ; 0F 7A 52 016 00 00
|
||||
|
||||
phaddubq xmm1, xmm2 ; 0F 7A 53 312
|
||||
phaddubq xmm1, [0] ; 0F 7A 53 016 00 00
|
||||
phaddubq xmm1, dqword [0] ; 0F 7A 53 016 00 00
|
||||
|
||||
phaddubw xmm1, xmm2 ; 0F 7A 51 312
|
||||
phaddubw xmm1, [0] ; 0F 7A 51 016 00 00
|
||||
phaddubw xmm1, dqword [0] ; 0F 7A 51 016 00 00
|
||||
|
||||
phaddudq xmm1, xmm2 ; 0F 7A 5B 312
|
||||
phaddudq xmm1, [0] ; 0F 7A 5B 016 00 00
|
||||
phaddudq xmm1, dqword [0] ; 0F 7A 5B 016 00 00
|
||||
|
||||
phadduwd xmm1, xmm2 ; 0F 7A 56 312
|
||||
phadduwd xmm1, [0] ; 0F 7A 56 016 00 00
|
||||
phadduwd xmm1, dqword [0] ; 0F 7A 56 016 00 00
|
||||
|
||||
phadduwq xmm1, xmm2 ; 0F 7A 57 312
|
||||
phadduwq xmm1, [0] ; 0F 7A 57 016 00 00
|
||||
phadduwq xmm1, dqword [0] ; 0F 7A 57 016 00 00
|
||||
|
||||
phaddwd xmm1, xmm2 ; 0F 7A 46 312
|
||||
phaddwd xmm1, [0] ; 0F 7A 46 016 00 00
|
||||
phaddwd xmm1, dqword [0] ; 0F 7A 46 016 00 00
|
||||
|
||||
phaddwq xmm1, xmm2 ; 0F 7A 47 312
|
||||
phaddwq xmm1, [0] ; 0F 7A 47 016 00 00
|
||||
phaddwq xmm1, dqword [0] ; 0F 7A 47 016 00 00
|
||||
|
||||
phsubbw xmm1, xmm2 ; 0F 7A 61 312
|
||||
phsubbw xmm1, [0] ; 0F 7A 61 016 00 00
|
||||
phsubbw xmm1, dqword [0] ; 0F 7A 61 016 00 00
|
||||
|
||||
phsubdq xmm1, xmm2 ; 0F 7A 63 312
|
||||
phsubdq xmm1, [0] ; 0F 7A 63 016 00 00
|
||||
phsubdq xmm1, dqword [0] ; 0F 7A 63 016 00 00
|
||||
|
||||
phsubwd xmm1, xmm2 ; 0F 7A 62 312
|
||||
phsubwd xmm1, [0] ; 0F 7A 62 016 00 00
|
||||
phsubwd xmm1, dqword [0] ; 0F 7A 62 016 00 00
|
||||
|
||||
pmacsdd xmm1, xmm4, xmm7, xmm1 ; 0F 24 9E 347 10
|
||||
pmacsdd xmm2, xmm5, [0], xmm2 ; 0F 24 9E 056 20 00 00
|
||||
pmacsdd xmm3, xmm6, dqword [0], xmm3 ; 0F 24 9E 066 30 00 00
|
||||
|
||||
pmacsdqh xmm1, xmm4, xmm7, xmm1 ; 0F 24 9F 347 10
|
||||
pmacsdqh xmm2, xmm5, [0], xmm2 ; 0F 24 9F 056 20 00 00
|
||||
pmacsdqh xmm3, xmm6, dqword [0], xmm3 ; 0F 24 9F 066 30 00 00
|
||||
|
||||
pmacsdql xmm1, xmm4, xmm7, xmm1 ; 0F 24 97 347 10
|
||||
pmacsdql xmm2, xmm5, [0], xmm2 ; 0F 24 97 056 20 00 00
|
||||
pmacsdql xmm3, xmm6, dqword [0], xmm3 ; 0F 24 97 066 30 00 00
|
||||
|
||||
pmacssdd xmm1, xmm4, xmm7, xmm1 ; 0F 24 8E 347 10
|
||||
pmacssdd xmm2, xmm5, [0], xmm2 ; 0F 24 8E 056 20 00 00
|
||||
pmacssdd xmm3, xmm6, dqword [0], xmm3 ; 0F 24 8E 066 30 00 00
|
||||
|
||||
pmacssdqh xmm1, xmm4, xmm7, xmm1 ; 0F 24 8F 347 10
|
||||
pmacssdqh xmm2, xmm5, [0], xmm2 ; 0F 24 8F 056 20 00 00
|
||||
pmacssdqh xmm3, xmm6, dqword [0], xmm3 ; 0F 24 8F 066 30 00 00
|
||||
|
||||
pmacssdql xmm1, xmm4, xmm7, xmm1 ; 0F 24 87 347 10
|
||||
pmacssdql xmm2, xmm5, [0], xmm2 ; 0F 24 87 056 20 00 00
|
||||
pmacssdql xmm3, xmm6, dqword [0], xmm3 ; 0F 24 87 066 30 00 00
|
||||
|
||||
pmacsswd xmm1, xmm4, xmm7, xmm1 ; 0F 24 86 347 10
|
||||
pmacsswd xmm2, xmm5, [0], xmm2 ; 0F 24 86 056 20 00 00
|
||||
pmacsswd xmm3, xmm6, dqword [0], xmm3 ; 0F 24 86 066 30 00 00
|
||||
|
||||
pmacssww xmm1, xmm4, xmm7, xmm1 ; 0F 24 85 347 10
|
||||
pmacssww xmm2, xmm5, [0], xmm2 ; 0F 24 85 056 20 00 00
|
||||
pmacssww xmm3, xmm6, dqword [0], xmm3 ; 0F 24 85 066 30 00 00
|
||||
|
||||
pmacswd xmm1, xmm4, xmm7, xmm1 ; 0F 24 96 347 10
|
||||
pmacswd xmm2, xmm5, [0], xmm2 ; 0F 24 96 056 20 00 00
|
||||
pmacswd xmm3, xmm6, dqword [0], xmm3 ; 0F 24 96 066 30 00 00
|
||||
|
||||
pmacsww xmm1, xmm4, xmm7, xmm1 ; 0F 24 95 347 10
|
||||
pmacsww xmm2, xmm5, [0], xmm2 ; 0F 24 95 056 20 00 00
|
||||
pmacsww xmm3, xmm6, dqword [0], xmm3 ; 0F 24 95 066 30 00 00
|
||||
|
||||
pmadcsswd xmm1, xmm4, xmm7, xmm1 ; 0F 24 A6 347 10
|
||||
pmadcsswd xmm2, xmm5, [0], xmm2 ; 0F 24 A6 056 20 00 00
|
||||
pmadcsswd xmm3, xmm6, dqword [0], xmm3 ; 0F 24 A6 066 30 00 00
|
||||
|
||||
pmadcswd xmm1, xmm4, xmm7, xmm1 ; 0F 24 B6 347 10
|
||||
pmadcswd xmm2, xmm5, [0], xmm2 ; 0F 24 B6 056 20 00 00
|
||||
pmadcswd xmm3, xmm6, dqword [0], xmm3 ; 0F 24 B6 066 30 00 00
|
||||
|
||||
pperm xmm1, xmm1, xmm2, xmm3 ; 0F 24 23 323 10 /or/ 0F 24 23 332 18
|
||||
pperm xmm1, xmm1, xmm2, [0] ; 0F 24 23 026 10 00 00
|
||||
pperm xmm1, xmm1, xmm2, dqword [0] ; 0F 24 23 026 10 00 00
|
||||
pperm xmm1, xmm1, [0], xmm3 ; 0F 24 23 036 18 00 00
|
||||
pperm xmm1, xmm1, dqword [0], xmm3 ; 0F 24 23 036 18 00 00
|
||||
pperm xmm1, xmm2, xmm3, xmm1 ; 0F 24 27 323 10 /or/ 0F 24 27 332 18
|
||||
pperm xmm1, xmm2, [0], xmm1 ; 0F 24 27 026 10 00 00
|
||||
pperm xmm1, xmm2, dqword [0], xmm1 ; 0F 24 27 026 10 00 00
|
||||
pperm xmm1, [0], xmm3, xmm1 ; 0F 24 27 036 18 00 00
|
||||
pperm xmm1, dqword [0], xmm3, xmm1 ; 0F 24 27 036 18 00 00
|
||||
|
||||
protb xmm1, xmm2, xmm3 ; 0F 24 40 323 10 /or/ 0F 24 40 332 18
|
||||
protb xmm1, xmm2, [0] ; 0F 24 40 026 10 00 00
|
||||
protb xmm1, xmm2, dqword [0] ; 0F 24 40 026 10 00 00
|
||||
protb xmm1, [0], xmm3 ; 0F 24 40 036 18 00 00
|
||||
protb xmm1, dqword [0], xmm3 ; 0F 24 40 036 18 00 00
|
||||
protb xmm1, xmm2, byte 5 ; 0F 7B 40 312 05
|
||||
protb xmm1, [0], byte 5 ; 0F 7B 40 016 00 00 05
|
||||
protb xmm1, dqword [0], 5 ; 0F 7B 40 016 00 00 05
|
||||
|
||||
protd xmm1, xmm2, xmm3 ; 0F 24 42 323 10 /or/ 0F 24 42 332 18
|
||||
protd xmm1, xmm2, [0] ; 0F 24 42 026 10 00 00
|
||||
protd xmm1, xmm2, dqword [0] ; 0F 24 42 026 10 00 00
|
||||
protd xmm1, [0], xmm3 ; 0F 24 42 036 18 00 00
|
||||
protd xmm1, dqword [0], xmm3 ; 0F 24 42 036 18 00 00
|
||||
protd xmm1, xmm2, byte 5 ; 0F 7B 42 312 05
|
||||
protd xmm1, [0], byte 5 ; 0F 7B 42 016 00 00 05
|
||||
protd xmm1, dqword [0], 5 ; 0F 7B 42 016 00 00 05
|
||||
|
||||
protq xmm1, xmm2, xmm3 ; 0F 24 43 323 10 /or/ 0F 24 43 332 18
|
||||
protq xmm1, xmm2, [0] ; 0F 24 43 026 10 00 00
|
||||
protq xmm1, xmm2, dqword [0] ; 0F 24 43 026 10 00 00
|
||||
protq xmm1, [0], xmm3 ; 0F 24 43 036 18 00 00
|
||||
protq xmm1, dqword [0], xmm3 ; 0F 24 43 036 18 00 00
|
||||
protq xmm1, xmm2, byte 5 ; 0F 7B 43 312 05
|
||||
protq xmm1, [0], byte 5 ; 0F 7B 43 016 00 00 05
|
||||
protq xmm1, dqword [0], 5 ; 0F 7B 43 016 00 00 05
|
||||
|
||||
protw xmm1, xmm2, xmm3 ; 0F 24 41 323 10 /or/ 0F 24 41 332 18
|
||||
protw xmm1, xmm2, [0] ; 0F 24 41 026 10 00 00
|
||||
protw xmm1, xmm2, dqword [0] ; 0F 24 41 026 10 00 00
|
||||
protw xmm1, [0], xmm3 ; 0F 24 41 036 18 00 00
|
||||
protw xmm1, dqword [0], xmm3 ; 0F 24 41 036 18 00 00
|
||||
protw xmm1, xmm2, byte 5 ; 0F 7B 41 312 05
|
||||
protw xmm1, [0], byte 5 ; 0F 7B 41 016 00 00 05
|
||||
protw xmm1, dqword [0], 5 ; 0F 7B 41 016 00 00 05
|
||||
|
||||
pshab xmm1, xmm2, xmm3 ; 0F 24 48 323 10 /or/ 0F 24 48 332 18
|
||||
pshab xmm1, xmm2, [0] ; 0F 24 48 026 10 00 00
|
||||
pshab xmm1, xmm2, dqword [0] ; 0F 24 48 026 10 00 00
|
||||
pshab xmm1, [0], xmm3 ; 0F 24 48 036 18 00 00
|
||||
pshab xmm1, dqword [0], xmm3 ; 0F 24 48 036 18 00 00
|
||||
|
||||
pshad xmm1, xmm2, xmm3 ; 0F 24 4A 323 10 /or/ 0F 24 4A 332 18
|
||||
pshad xmm1, xmm2, [0] ; 0F 24 4A 026 10 00 00
|
||||
pshad xmm1, xmm2, dqword [0] ; 0F 24 4A 026 10 00 00
|
||||
pshad xmm1, [0], xmm3 ; 0F 24 4A 036 18 00 00
|
||||
pshad xmm1, dqword [0], xmm3 ; 0F 24 4A 036 18 00 00
|
||||
|
||||
pshaq xmm1, xmm2, xmm3 ; 0F 24 4B 323 10 /or/ 0F 24 4B 332 18
|
||||
pshaq xmm1, xmm2, [0] ; 0F 24 4B 026 10 00 00
|
||||
pshaq xmm1, xmm2, dqword [0] ; 0F 24 4B 026 10 00 00
|
||||
pshaq xmm1, [0], xmm3 ; 0F 24 4B 036 18 00 00
|
||||
pshaq xmm1, dqword [0], xmm3 ; 0F 24 4B 036 18 00 00
|
||||
|
||||
pshaw xmm1, xmm2, xmm3 ; 0F 24 49 323 10 /or/ 0F 24 49 332 18
|
||||
pshaw xmm1, xmm2, [0] ; 0F 24 49 026 10 00 00
|
||||
pshaw xmm1, xmm2, dqword [0] ; 0F 24 49 026 10 00 00
|
||||
pshaw xmm1, [0], xmm3 ; 0F 24 49 036 18 00 00
|
||||
pshaw xmm1, dqword [0], xmm3 ; 0F 24 49 036 18 00 00
|
||||
|
||||
pshlb xmm1, xmm2, xmm3 ; 0F 24 44 323 10 /or/ 0F 24 44 332 18
|
||||
pshlb xmm1, xmm2, [0] ; 0F 24 44 026 10 00 00
|
||||
pshlb xmm1, xmm2, dqword [0] ; 0F 24 44 026 10 00 00
|
||||
pshlb xmm1, [0], xmm3 ; 0F 24 44 036 18 00 00
|
||||
pshlb xmm1, dqword [0], xmm3 ; 0F 24 44 036 18 00 00
|
||||
|
||||
pshld xmm1, xmm2, xmm3 ; 0F 24 46 323 10 /or/ 0F 24 46 332 18
|
||||
pshld xmm1, xmm2, [0] ; 0F 24 46 026 10 00 00
|
||||
pshld xmm1, xmm2, dqword [0] ; 0F 24 46 026 10 00 00
|
||||
pshld xmm1, [0], xmm3 ; 0F 24 46 036 18 00 00
|
||||
pshld xmm1, dqword [0], xmm3 ; 0F 24 46 036 18 00 00
|
||||
|
||||
pshlq xmm1, xmm2, xmm3 ; 0F 24 47 323 10 /or/ 0F 24 47 332 18
|
||||
pshlq xmm1, xmm2, [0] ; 0F 24 47 026 10 00 00
|
||||
pshlq xmm1, xmm2, dqword [0] ; 0F 24 47 026 10 00 00
|
||||
pshlq xmm1, [0], xmm3 ; 0F 24 47 036 18 00 00
|
||||
pshlq xmm1, dqword [0], xmm3 ; 0F 24 47 036 18 00 00
|
||||
|
||||
pshlw xmm1, xmm2, xmm3 ; 0F 24 45 323 10 /or/ 0F 24 45 332 18
|
||||
pshlw xmm1, xmm2, [0] ; 0F 24 45 026 10 00 00
|
||||
pshlw xmm1, xmm2, dqword [0] ; 0F 24 45 026 10 00 00
|
||||
pshlw xmm1, [0], xmm3 ; 0F 24 45 036 18 00 00
|
||||
pshlw xmm1, dqword [0], xmm3 ; 0F 24 45 036 18 00 00
|
||||
|
||||
; SSE5 instructions that are also SSE4.1 instructions
|
||||
|
||||
ptest xmm1, xmm2 ; 66 0F 38 17 312
|
||||
ptest xmm1, [0] ; 66 0F 38 17 016 00 00
|
||||
ptest xmm1, dqword [0] ; 66 0F 38 17 016 00 00
|
||||
|
||||
roundpd xmm1, xmm2, 5 ; 66 0F 3A 09 312 05
|
||||
roundpd xmm1, [0], byte 5 ; 66 0F 3A 09 016 00 00 05
|
||||
roundpd xmm1, dqword [0], 5 ; 66 0F 3A 09 016 00 00 05
|
||||
|
||||
roundps xmm1, xmm2, 5 ; 66 0F 3A 08 312 05
|
||||
roundps xmm1, [0], byte 5 ; 66 0F 3A 08 016 00 00 05
|
||||
roundps xmm1, dqword [0], 5 ; 66 0F 3A 08 016 00 00 05
|
||||
|
||||
roundsd xmm1, xmm2, 5 ; 66 0F 3A 0B 312 05
|
||||
roundsd xmm1, [0], byte 5 ; 66 0F 3A 0B 016 00 00 05
|
||||
roundsd xmm1, qword [0], 5 ; 66 0F 3A 0B 016 00 00 05
|
||||
|
||||
roundss xmm1, xmm2, 5 ; 66 0F 3A 0A 312 05
|
||||
roundss xmm1, [0], byte 5 ; 66 0F 3A 0A 016 00 00 05
|
||||
roundss xmm1, dword [0], 5 ; 66 0F 3A 0A 016 00 00 05
|
||||
|
||||
2727
modules/arch/x86/tests/sse5-all.hex
Normal file
2727
modules/arch/x86/tests/sse5-all.hex
Normal file
File diff suppressed because it is too large
Load diff
12
modules/arch/x86/tests/sse5-basic.asm
Normal file
12
modules/arch/x86/tests/sse5-basic.asm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[bits 32]
|
||||
compd xmm1, xmm4, xmm7, 5 ; 0F 25 2D 347 10 05
|
||||
compd xmm2, xmm5, [0], byte 5 ; 0F 25 2D 055 20 00 00 00 00 05
|
||||
compd xmm3, xmm6, dqword [ebx+ecx*4], byte 5 ; 0F 25 2D 064 213 30 05
|
||||
|
||||
[bits 64]
|
||||
compd xmm8, xmm11, xmm3, 5 ; 0F 25 2D 333 84 05
|
||||
compd xmm12, xmm4, xmm14, 5 ; 0F 25 2D 346 C1 05
|
||||
compd xmm9, xmm12, [0], byte 5 ; 0F 25 2D 044 045 94 00 00 00 00 05
|
||||
compd xmm9, xmm12, [r8], byte 5 ; 0F 25 2D 040 95 05
|
||||
compd xmm10, xmm13, dqword [rbx+r9*4], 5 ; 0F 25 2D 054 213 A6 05
|
||||
|
||||
59
modules/arch/x86/tests/sse5-basic.hex
Normal file
59
modules/arch/x86/tests/sse5-basic.hex
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
0f
|
||||
25
|
||||
2d
|
||||
e7
|
||||
10
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
2d
|
||||
20
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
34
|
||||
8b
|
||||
30
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
db
|
||||
84
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
e6
|
||||
c1
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
24
|
||||
25
|
||||
94
|
||||
00
|
||||
00
|
||||
00
|
||||
00
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
20
|
||||
95
|
||||
05
|
||||
0f
|
||||
25
|
||||
2d
|
||||
2c
|
||||
8b
|
||||
a6
|
||||
05
|
||||
116
modules/arch/x86/tests/sse5-err.asm
Normal file
116
modules/arch/x86/tests/sse5-err.asm
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
fmaddpd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmaddpd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmaddpd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmaddps xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmaddps xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmaddps xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmaddsd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmaddsd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmaddsd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmaddss xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmaddss xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmaddss xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmsubpd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmsubpd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmsubpd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmsubps xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmsubps xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmsubps xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmsubsd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmsubsd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmsubsd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fmsubss xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fmsubss xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fmsubss xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmaddpd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmaddpd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmaddpd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmaddps xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmaddps xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmaddps xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmaddsd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmaddsd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmaddsd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmaddss xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmaddss xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmaddss xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmsubpd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmsubpd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmsubpd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmsubps xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmsubps xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmsubps xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmsubsd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmsubsd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmsubsd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
fnmsubss xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
fnmsubss xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
fnmsubss xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
pcmov xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pcmov xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
pcmov xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
permpd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
permpd xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
permpd xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
permps xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
permps xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
permps xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
pmacsdd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacsdd xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacsdqh xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacsdqh xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacsdql xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacsdql xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacssdd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacssdd xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacssdqh xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacssdqh xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacssdql xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacssdql xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacsswd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacsswd xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacssww xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacssww xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacswd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacswd xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmacsww xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmacsww xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmadcsswd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmadcsswd xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pmadcswd xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pmadcswd xmm1, xmm1, xmm2, xmm3 ; illegal - better message?
|
||||
|
||||
pperm xmm1, xmm2, xmm1, xmm3 ; illegal
|
||||
pperm xmm1, xmm2, xmm3, xmm3 ; illegal
|
||||
pperm xmm1, xmm2, xmm2, xmm3 ; illegal
|
||||
|
||||
84
modules/arch/x86/tests/sse5-err.errwarn
Normal file
84
modules/arch/x86/tests/sse5-err.errwarn
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
-:1: one of source operand 1 or 3 must match dest operand
|
||||
-:2: one of source operand 1 or 3 must match dest operand
|
||||
-:3: one of source operand 1 or 3 must match dest operand
|
||||
-:5: one of source operand 1 or 3 must match dest operand
|
||||
-:6: one of source operand 1 or 3 must match dest operand
|
||||
-:7: one of source operand 1 or 3 must match dest operand
|
||||
-:9: one of source operand 1 or 3 must match dest operand
|
||||
-:10: one of source operand 1 or 3 must match dest operand
|
||||
-:11: one of source operand 1 or 3 must match dest operand
|
||||
-:13: one of source operand 1 or 3 must match dest operand
|
||||
-:14: one of source operand 1 or 3 must match dest operand
|
||||
-:15: one of source operand 1 or 3 must match dest operand
|
||||
-:17: one of source operand 1 or 3 must match dest operand
|
||||
-:18: one of source operand 1 or 3 must match dest operand
|
||||
-:19: one of source operand 1 or 3 must match dest operand
|
||||
-:21: one of source operand 1 or 3 must match dest operand
|
||||
-:22: one of source operand 1 or 3 must match dest operand
|
||||
-:23: one of source operand 1 or 3 must match dest operand
|
||||
-:25: one of source operand 1 or 3 must match dest operand
|
||||
-:26: one of source operand 1 or 3 must match dest operand
|
||||
-:27: one of source operand 1 or 3 must match dest operand
|
||||
-:29: one of source operand 1 or 3 must match dest operand
|
||||
-:30: one of source operand 1 or 3 must match dest operand
|
||||
-:31: one of source operand 1 or 3 must match dest operand
|
||||
-:33: one of source operand 1 or 3 must match dest operand
|
||||
-:34: one of source operand 1 or 3 must match dest operand
|
||||
-:35: one of source operand 1 or 3 must match dest operand
|
||||
-:37: one of source operand 1 or 3 must match dest operand
|
||||
-:38: one of source operand 1 or 3 must match dest operand
|
||||
-:39: one of source operand 1 or 3 must match dest operand
|
||||
-:41: one of source operand 1 or 3 must match dest operand
|
||||
-:42: one of source operand 1 or 3 must match dest operand
|
||||
-:43: one of source operand 1 or 3 must match dest operand
|
||||
-:45: one of source operand 1 or 3 must match dest operand
|
||||
-:46: one of source operand 1 or 3 must match dest operand
|
||||
-:47: one of source operand 1 or 3 must match dest operand
|
||||
-:49: one of source operand 1 or 3 must match dest operand
|
||||
-:50: one of source operand 1 or 3 must match dest operand
|
||||
-:51: one of source operand 1 or 3 must match dest operand
|
||||
-:53: one of source operand 1 or 3 must match dest operand
|
||||
-:54: one of source operand 1 or 3 must match dest operand
|
||||
-:55: one of source operand 1 or 3 must match dest operand
|
||||
-:57: one of source operand 1 or 3 must match dest operand
|
||||
-:58: one of source operand 1 or 3 must match dest operand
|
||||
-:59: one of source operand 1 or 3 must match dest operand
|
||||
-:61: one of source operand 1 or 3 must match dest operand
|
||||
-:62: one of source operand 1 or 3 must match dest operand
|
||||
-:63: one of source operand 1 or 3 must match dest operand
|
||||
-:65: one of source operand 1 or 3 must match dest operand
|
||||
-:66: one of source operand 1 or 3 must match dest operand
|
||||
-:67: one of source operand 1 or 3 must match dest operand
|
||||
-:69: one of source operand 1 or 3 must match dest operand
|
||||
-:70: one of source operand 1 or 3 must match dest operand
|
||||
-:71: one of source operand 1 or 3 must match dest operand
|
||||
-:73: one of source operand 1 or 3 must match dest operand
|
||||
-:74: one of source operand 1 or 3 must match dest operand
|
||||
-:75: one of source operand 1 or 3 must match dest operand
|
||||
-:77: one of source operand 1 or 3 must match dest operand
|
||||
-:78: one of source operand 1 or 3 must match dest operand
|
||||
-:80: one of source operand 1 or 3 must match dest operand
|
||||
-:81: one of source operand 1 or 3 must match dest operand
|
||||
-:83: one of source operand 1 or 3 must match dest operand
|
||||
-:84: one of source operand 1 or 3 must match dest operand
|
||||
-:86: one of source operand 1 or 3 must match dest operand
|
||||
-:87: one of source operand 1 or 3 must match dest operand
|
||||
-:89: one of source operand 1 or 3 must match dest operand
|
||||
-:90: one of source operand 1 or 3 must match dest operand
|
||||
-:92: one of source operand 1 or 3 must match dest operand
|
||||
-:93: one of source operand 1 or 3 must match dest operand
|
||||
-:95: one of source operand 1 or 3 must match dest operand
|
||||
-:96: one of source operand 1 or 3 must match dest operand
|
||||
-:98: one of source operand 1 or 3 must match dest operand
|
||||
-:99: one of source operand 1 or 3 must match dest operand
|
||||
-:101: one of source operand 1 or 3 must match dest operand
|
||||
-:102: one of source operand 1 or 3 must match dest operand
|
||||
-:104: one of source operand 1 or 3 must match dest operand
|
||||
-:105: one of source operand 1 or 3 must match dest operand
|
||||
-:107: one of source operand 1 or 3 must match dest operand
|
||||
-:108: one of source operand 1 or 3 must match dest operand
|
||||
-:110: one of source operand 1 or 3 must match dest operand
|
||||
-:111: one of source operand 1 or 3 must match dest operand
|
||||
-:113: one of source operand 1 or 3 must match dest operand
|
||||
-:114: one of source operand 1 or 3 must match dest operand
|
||||
-:115: one of source operand 1 or 3 must match dest operand
|
||||
|
|
@ -57,10 +57,17 @@ x86_create(const char *machine, const char *parser,
|
|||
|
||||
arch_x86->arch.module = &yasm_x86_LTX_arch;
|
||||
|
||||
arch_x86->cpu_enabled = ~CPU_Any;
|
||||
/* default to all instructions/features enabled */
|
||||
arch_x86->active_cpu = 0;
|
||||
arch_x86->cpu_enables_size = 1;
|
||||
arch_x86->cpu_enables = yasm_xmalloc(sizeof(wordptr));
|
||||
arch_x86->cpu_enables[0] = BitVector_Create(64, FALSE);
|
||||
BitVector_Fill(arch_x86->cpu_enables[0]);
|
||||
|
||||
arch_x86->amd64_machine = amd64_machine;
|
||||
arch_x86->mode_bits = 0;
|
||||
arch_x86->force_strict = 0;
|
||||
arch_x86->default_rel = 0;
|
||||
|
||||
if (yasm__strcasecmp(parser, "nasm") == 0)
|
||||
arch_x86->parser = X86_PARSER_NASM;
|
||||
|
|
@ -79,6 +86,11 @@ x86_create(const char *machine, const char *parser,
|
|||
static void
|
||||
x86_destroy(/*@only@*/ yasm_arch *arch)
|
||||
{
|
||||
yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
|
||||
unsigned int i;
|
||||
for (i=0; i<arch_x86->cpu_enables_size; i++)
|
||||
BitVector_Destroy(arch_x86->cpu_enables[i]);
|
||||
yasm_xfree(arch_x86->cpu_enables);
|
||||
yasm_xfree(arch);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +124,13 @@ x86_set_var(yasm_arch *arch, const char *var, unsigned long val)
|
|||
arch_x86->mode_bits = (unsigned int)val;
|
||||
else if (yasm__strcasecmp(var, "force_strict") == 0)
|
||||
arch_x86->force_strict = (unsigned int)val;
|
||||
else
|
||||
else if (yasm__strcasecmp(var, "default_rel") == 0) {
|
||||
if (arch_x86->mode_bits != 64)
|
||||
yasm_warn_set(YASM_WARN_GENERAL,
|
||||
N_("ignoring default rel in non-64-bit mode"));
|
||||
else
|
||||
arch_x86->default_rel = (unsigned int)val;
|
||||
} else
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,53 +27,59 @@
|
|||
#ifndef YASM_X86ARCH_H
|
||||
#define YASM_X86ARCH_H
|
||||
|
||||
#include <libyasm/bitvect.h>
|
||||
|
||||
/* Available CPU feature flags */
|
||||
#define CPU_Any (0UL) /* Any old cpu will do */
|
||||
#define CPU_Any 0 /* Any old cpu will do */
|
||||
#define CPU_086 CPU_Any
|
||||
#define CPU_186 (1UL<<0) /* i186 or better required */
|
||||
#define CPU_286 (1UL<<1) /* i286 or better required */
|
||||
#define CPU_386 (1UL<<2) /* i386 or better required */
|
||||
#define CPU_486 (1UL<<3) /* i486 or better required */
|
||||
#define CPU_586 (1UL<<4) /* i585 or better required */
|
||||
#define CPU_686 (1UL<<5) /* i686 or better required */
|
||||
#define CPU_P3 (1UL<<6) /* Pentium3 or better required */
|
||||
#define CPU_P4 (1UL<<7) /* Pentium4 or better required */
|
||||
#define CPU_IA64 (1UL<<8) /* IA-64 or better required */
|
||||
#define CPU_K6 (1UL<<9) /* AMD K6 or better required */
|
||||
#define CPU_Athlon (1UL<<10) /* AMD Athlon or better required */
|
||||
#define CPU_Hammer (1UL<<11) /* AMD Sledgehammer or better required */
|
||||
#define CPU_FPU (1UL<<12) /* FPU support required */
|
||||
#define CPU_MMX (1UL<<13) /* MMX support required */
|
||||
#define CPU_SSE (1UL<<14) /* Streaming SIMD extensions required */
|
||||
#define CPU_SSE2 (1UL<<15) /* Streaming SIMD extensions 2 required */
|
||||
#define CPU_SSE3 (1UL<<16) /* Streaming SIMD extensions 3 required */
|
||||
#define CPU_3DNow (1UL<<17) /* 3DNow! support required */
|
||||
#define CPU_Cyrix (1UL<<18) /* Cyrix-specific instruction */
|
||||
#define CPU_AMD (1UL<<19) /* AMD-specific inst. (older than K6) */
|
||||
#define CPU_SMM (1UL<<20) /* System Management Mode instruction */
|
||||
#define CPU_Prot (1UL<<21) /* Protected mode only instruction */
|
||||
#define CPU_Undoc (1UL<<22) /* Undocumented instruction */
|
||||
#define CPU_Obs (1UL<<23) /* Obsolete instruction */
|
||||
#define CPU_Priv (1UL<<24) /* Priveleged instruction */
|
||||
#define CPU_SVM (1UL<<25) /* Secure Virtual Machine instruction */
|
||||
#define CPU_PadLock (1UL<<25) /* VIA PadLock instruction */
|
||||
#define CPU_EM64T (1UL<<26) /* Intel EM64T or better */
|
||||
#define CPU_SSSE3 (1UL<<27) /* Streaming SIMD extensions 3 required */
|
||||
#define CPU_SSE41 (1UL<<28) /* Streaming SIMD extensions 4.1 required */
|
||||
#define CPU_SSE42 (1UL<<29) /* Streaming SIMD extensions 4.2 required */
|
||||
#define CPU_SSE4 (CPU_SSE41|CPU_SSE42)
|
||||
#define CPU_186 1 /* i186 or better required */
|
||||
#define CPU_286 2 /* i286 or better required */
|
||||
#define CPU_386 3 /* i386 or better required */
|
||||
#define CPU_486 4 /* i486 or better required */
|
||||
#define CPU_586 5 /* i585 or better required */
|
||||
#define CPU_686 6 /* i686 or better required */
|
||||
#define CPU_P3 7 /* Pentium3 or better required */
|
||||
#define CPU_P4 8 /* Pentium4 or better required */
|
||||
#define CPU_IA64 9 /* IA-64 or better required */
|
||||
#define CPU_K6 10 /* AMD K6 or better required */
|
||||
#define CPU_Athlon 11 /* AMD Athlon or better required */
|
||||
#define CPU_Hammer 12 /* AMD Sledgehammer or better required */
|
||||
#define CPU_FPU 13 /* FPU support required */
|
||||
#define CPU_MMX 14 /* MMX support required */
|
||||
#define CPU_SSE 15 /* Streaming SIMD extensions required */
|
||||
#define CPU_SSE2 16 /* Streaming SIMD extensions 2 required */
|
||||
#define CPU_SSE3 17 /* Streaming SIMD extensions 3 required */
|
||||
#define CPU_3DNow 18 /* 3DNow! support required */
|
||||
#define CPU_Cyrix 19 /* Cyrix-specific instruction */
|
||||
#define CPU_AMD 20 /* AMD-specific inst. (older than K6) */
|
||||
#define CPU_SMM 21 /* System Management Mode instruction */
|
||||
#define CPU_Prot 22 /* Protected mode only instruction */
|
||||
#define CPU_Undoc 23 /* Undocumented instruction */
|
||||
#define CPU_Obs 24 /* Obsolete instruction */
|
||||
#define CPU_Priv 25 /* Priveleged instruction */
|
||||
#define CPU_SVM 26 /* Secure Virtual Machine instruction */
|
||||
#define CPU_PadLock 27 /* VIA PadLock instruction */
|
||||
#define CPU_EM64T 28 /* Intel EM64T or better */
|
||||
#define CPU_SSSE3 29 /* Streaming SIMD extensions 3 required */
|
||||
#define CPU_SSE41 30 /* Streaming SIMD extensions 4.1 required */
|
||||
#define CPU_SSE42 31 /* Streaming SIMD extensions 4.2 required */
|
||||
#define CPU_SSE4a 32 /* AMD Streaming SIMD extensions 4a required */
|
||||
#define CPU_SSE5 33 /* AMD Streaming SIMD extensions 5 required */
|
||||
|
||||
/* Technically not CPU capabilities, they do affect what instructions are
|
||||
* available. These are tested against BITS==64.
|
||||
*/
|
||||
#define CPU_64 (1UL<<30) /* Only available in 64-bit mode */
|
||||
#define CPU_Not64 (1UL<<31) /* Not available (invalid) in 64-bit mode */
|
||||
#define CPU_64 120 /* Only available in 64-bit mode */
|
||||
#define CPU_Not64 121 /* Not available (invalid) in 64-bit mode */
|
||||
|
||||
typedef struct yasm_arch_x86 {
|
||||
yasm_arch_base arch; /* base structure */
|
||||
|
||||
/* What instructions/features are enabled? */
|
||||
unsigned long cpu_enabled;
|
||||
unsigned int active_cpu; /* active index into cpu_enables table */
|
||||
unsigned int cpu_enables_size; /* size of cpu_enables table */
|
||||
wordptr *cpu_enables;
|
||||
|
||||
unsigned int amd64_machine;
|
||||
enum {
|
||||
X86_PARSER_NASM = 0,
|
||||
|
|
@ -81,6 +87,7 @@ typedef struct yasm_arch_x86 {
|
|||
} parser;
|
||||
unsigned int mode_bits;
|
||||
unsigned int force_strict;
|
||||
unsigned int default_rel;
|
||||
} yasm_arch_x86;
|
||||
|
||||
/* 0-15 (low 4 bits) used for register number, stored in same data area.
|
||||
|
|
@ -137,9 +144,9 @@ typedef enum {
|
|||
* indicates bit of REX to use if REX is needed. Will not modify REX if not
|
||||
* in 64-bit mode or if it wasn't needed to express reg.
|
||||
*/
|
||||
int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3,
|
||||
uintptr_t reg, unsigned int bits,
|
||||
x86_rex_bit_pos rexbit);
|
||||
int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *drex,
|
||||
unsigned char *low3, uintptr_t reg,
|
||||
unsigned int bits, x86_rex_bit_pos rexbit);
|
||||
|
||||
/* Effective address type */
|
||||
typedef struct x86_effaddr {
|
||||
|
|
@ -157,14 +164,19 @@ typedef struct x86_effaddr {
|
|||
unsigned char valid_sib; /* 1 if SIB byte currently valid, 0 if not */
|
||||
unsigned char need_sib; /* 1 if SIB byte needed, 0 if not,
|
||||
0xff if unknown */
|
||||
|
||||
unsigned char drex; /* DREX SSE5 extension byte */
|
||||
unsigned char need_drex; /* 1 if DREX byte needed, 0 if not */
|
||||
} x86_effaddr;
|
||||
|
||||
void yasm_x86__ea_init(x86_effaddr *x86_ea, unsigned int spare,
|
||||
unsigned int drex, unsigned int need_drex,
|
||||
yasm_bytecode *precbc);
|
||||
|
||||
void yasm_x86__ea_set_disponly(x86_effaddr *x86_ea);
|
||||
x86_effaddr *yasm_x86__ea_create_reg(x86_effaddr *x86_ea, unsigned long reg,
|
||||
unsigned char *rex, unsigned int bits);
|
||||
unsigned char *rex, unsigned char *drex,
|
||||
unsigned int bits);
|
||||
x86_effaddr *yasm_x86__ea_create_imm
|
||||
(x86_effaddr *x86_ea, /*@keep@*/ yasm_expr *imm, unsigned int im_len);
|
||||
yasm_effaddr *yasm_x86__ea_create_expr(yasm_arch *arch,
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ static const yasm_bytecode_callback x86_bc_callback_jmpfar = {
|
|||
};
|
||||
|
||||
int
|
||||
yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3,
|
||||
uintptr_t reg, unsigned int bits,
|
||||
x86_rex_bit_pos rexbit)
|
||||
yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *drex,
|
||||
unsigned char *low3, uintptr_t reg,
|
||||
unsigned int bits, x86_rex_bit_pos rexbit)
|
||||
{
|
||||
*low3 = (unsigned char)(reg&7);
|
||||
|
||||
|
|
@ -113,13 +113,17 @@ yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3,
|
|||
x86_expritem_reg_size size = (x86_expritem_reg_size)(reg & ~0xFUL);
|
||||
|
||||
if (size == X86_REG8X || (reg & 0xF) >= 8) {
|
||||
/* Check to make sure we can set it */
|
||||
if (*rex == 0xff) {
|
||||
yasm_error_set(YASM_ERROR_TYPE,
|
||||
N_("cannot use A/B/C/DH with instruction needing REX"));
|
||||
return 1;
|
||||
if (drex) {
|
||||
*drex |= ((reg & 8) >> 3) << rexbit;
|
||||
} else {
|
||||
/* Check to make sure we can set it */
|
||||
if (*rex == 0xff) {
|
||||
yasm_error_set(YASM_ERROR_TYPE,
|
||||
N_("cannot use A/B/C/DH with instruction needing REX"));
|
||||
return 1;
|
||||
}
|
||||
*rex |= 0x40 | (((reg & 8) >> 3) << rexbit);
|
||||
}
|
||||
*rex |= 0x40 | (((reg & 8) >> 3) << rexbit);
|
||||
} else if (size == X86_REG8 && (reg & 7) >= 4) {
|
||||
/* AH/BH/CH/DH, so no REX allowed */
|
||||
if (*rex != 0 && *rex != 0xff) {
|
||||
|
|
@ -153,14 +157,16 @@ yasm_x86__bc_transform_jmpfar(yasm_bytecode *bc, x86_jmpfar *jmpfar)
|
|||
}
|
||||
|
||||
void
|
||||
yasm_x86__ea_init(x86_effaddr *x86_ea, unsigned int spare,
|
||||
yasm_bytecode *precbc)
|
||||
yasm_x86__ea_init(x86_effaddr *x86_ea, unsigned int spare, unsigned int drex,
|
||||
unsigned int need_drex, yasm_bytecode *precbc)
|
||||
{
|
||||
if (yasm_value_finalize(&x86_ea->ea.disp, precbc))
|
||||
yasm_error_set(YASM_ERROR_TOO_COMPLEX,
|
||||
N_("effective address too complex"));
|
||||
x86_ea->modrm &= 0xC7; /* zero spare/reg bits */
|
||||
x86_ea->modrm |= (spare << 3) & 0x38; /* plug in provided bits */
|
||||
x86_ea->drex = (unsigned char)drex;
|
||||
x86_ea->need_drex = (unsigned char)need_drex;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -170,6 +176,7 @@ yasm_x86__ea_set_disponly(x86_effaddr *x86_ea)
|
|||
x86_ea->need_modrm = 0;
|
||||
x86_ea->valid_sib = 0;
|
||||
x86_ea->need_sib = 0;
|
||||
x86_ea->need_drex = 0;
|
||||
}
|
||||
|
||||
static x86_effaddr *
|
||||
|
|
@ -183,23 +190,28 @@ ea_create(void)
|
|||
x86_ea->ea.nosplit = 0;
|
||||
x86_ea->ea.strong = 0;
|
||||
x86_ea->ea.segreg = 0;
|
||||
x86_ea->ea.pc_rel = 0;
|
||||
x86_ea->ea.not_pc_rel = 0;
|
||||
x86_ea->modrm = 0;
|
||||
x86_ea->valid_modrm = 0;
|
||||
x86_ea->need_modrm = 0;
|
||||
x86_ea->sib = 0;
|
||||
x86_ea->valid_sib = 0;
|
||||
x86_ea->need_sib = 0;
|
||||
x86_ea->drex = 0;
|
||||
x86_ea->need_drex = 0;
|
||||
|
||||
return x86_ea;
|
||||
}
|
||||
|
||||
x86_effaddr *
|
||||
yasm_x86__ea_create_reg(x86_effaddr *x86_ea, unsigned long reg,
|
||||
unsigned char *rex, unsigned int bits)
|
||||
unsigned char *rex, unsigned char *drex,
|
||||
unsigned int bits)
|
||||
{
|
||||
unsigned char rm;
|
||||
|
||||
if (yasm_x86__set_rex_from_reg(rex, &rm, reg, bits, X86_REX_B))
|
||||
if (yasm_x86__set_rex_from_reg(rex, drex, &rm, reg, bits, X86_REX_B))
|
||||
return NULL;
|
||||
|
||||
if (!x86_ea)
|
||||
|
|
@ -539,6 +551,7 @@ x86_bc_insn_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span,
|
|||
|
||||
/* Compute length of ea and add to total */
|
||||
bc->len += x86_ea->need_modrm + (x86_ea->need_sib ? 1:0);
|
||||
bc->len += x86_ea->need_drex ? 1:0;
|
||||
bc->len += (x86_ea->ea.segreg != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
|
@ -807,6 +820,9 @@ x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
|
|||
YASM_WRITE_8(*bufp, x86_ea->sib);
|
||||
}
|
||||
|
||||
if (x86_ea->need_drex)
|
||||
YASM_WRITE_8(*bufp, x86_ea->drex);
|
||||
|
||||
if (x86_ea->ea.need_disp) {
|
||||
unsigned int disp_len = x86_ea->ea.disp.size/8;
|
||||
|
||||
|
|
|
|||
370
modules/arch/x86/x86cpu.gperf
Normal file
370
modules/arch/x86/x86cpu.gperf
Normal file
|
|
@ -0,0 +1,370 @@
|
|||
#
|
||||
# x86 CPU recognition
|
||||
#
|
||||
# Copyright (C) 2002-2007 Peter Johnson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
%{
|
||||
#include <util.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <ctype.h>
|
||||
#include <libyasm.h>
|
||||
#include <libyasm/phash.h>
|
||||
|
||||
#include "modules/arch/x86/x86arch.h"
|
||||
|
||||
#define PROC_8086 0
|
||||
#define PROC_186 1
|
||||
#define PROC_286 2
|
||||
#define PROC_386 3
|
||||
#define PROC_486 4
|
||||
#define PROC_586 5
|
||||
#define PROC_686 6
|
||||
#define PROC_p2 7
|
||||
#define PROC_p3 8
|
||||
#define PROC_p4 9
|
||||
#define PROC_prescott 10
|
||||
#define PROC_conroe 11
|
||||
#define PROC_penryn 12
|
||||
#define PROC_nehalem 13
|
||||
|
||||
static void
|
||||
x86_cpu_intel(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Empty(cpu);
|
||||
|
||||
BitVector_Bit_On(cpu, CPU_Priv);
|
||||
if (data >= PROC_286)
|
||||
BitVector_Bit_On(cpu, CPU_Prot);
|
||||
if (data >= PROC_386)
|
||||
BitVector_Bit_On(cpu, CPU_SMM);
|
||||
if (data >= PROC_nehalem)
|
||||
BitVector_Bit_On(cpu, CPU_SSE42);
|
||||
if (data >= PROC_penryn)
|
||||
BitVector_Bit_On(cpu, CPU_SSE41);
|
||||
if (data >= PROC_conroe)
|
||||
BitVector_Bit_On(cpu, CPU_SSSE3);
|
||||
if (data >= PROC_prescott)
|
||||
BitVector_Bit_On(cpu, CPU_SSE3);
|
||||
if (data >= PROC_p4)
|
||||
BitVector_Bit_On(cpu, CPU_SSE2);
|
||||
if (data >= PROC_p3)
|
||||
BitVector_Bit_On(cpu, CPU_SSE);
|
||||
if (data >= PROC_p2)
|
||||
BitVector_Bit_On(cpu, CPU_MMX);
|
||||
if (data >= PROC_486)
|
||||
BitVector_Bit_On(cpu, CPU_FPU);
|
||||
if (data >= PROC_prescott)
|
||||
BitVector_Bit_On(cpu, CPU_EM64T);
|
||||
|
||||
if (data >= PROC_p4)
|
||||
BitVector_Bit_On(cpu, CPU_P4);
|
||||
if (data >= PROC_p3)
|
||||
BitVector_Bit_On(cpu, CPU_P3);
|
||||
if (data >= PROC_686)
|
||||
BitVector_Bit_On(cpu, CPU_686);
|
||||
if (data >= PROC_586)
|
||||
BitVector_Bit_On(cpu, CPU_586);
|
||||
if (data >= PROC_486)
|
||||
BitVector_Bit_On(cpu, CPU_486);
|
||||
if (data >= PROC_386)
|
||||
BitVector_Bit_On(cpu, CPU_386);
|
||||
if (data >= PROC_286)
|
||||
BitVector_Bit_On(cpu, CPU_286);
|
||||
if (data >= PROC_186)
|
||||
BitVector_Bit_On(cpu, CPU_186);
|
||||
BitVector_Bit_On(cpu, CPU_086);
|
||||
}
|
||||
|
||||
static void
|
||||
x86_cpu_ia64(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Empty(cpu);
|
||||
BitVector_Bit_On(cpu, CPU_Priv);
|
||||
BitVector_Bit_On(cpu, CPU_Prot);
|
||||
BitVector_Bit_On(cpu, CPU_SMM);
|
||||
BitVector_Bit_On(cpu, CPU_SSE2);
|
||||
BitVector_Bit_On(cpu, CPU_SSE);
|
||||
BitVector_Bit_On(cpu, CPU_MMX);
|
||||
BitVector_Bit_On(cpu, CPU_FPU);
|
||||
BitVector_Bit_On(cpu, CPU_IA64);
|
||||
BitVector_Bit_On(cpu, CPU_P4);
|
||||
BitVector_Bit_On(cpu, CPU_P3);
|
||||
BitVector_Bit_On(cpu, CPU_686);
|
||||
BitVector_Bit_On(cpu, CPU_586);
|
||||
BitVector_Bit_On(cpu, CPU_486);
|
||||
BitVector_Bit_On(cpu, CPU_386);
|
||||
BitVector_Bit_On(cpu, CPU_286);
|
||||
BitVector_Bit_On(cpu, CPU_186);
|
||||
BitVector_Bit_On(cpu, CPU_086);
|
||||
}
|
||||
|
||||
#define PROC_bulldozer 11
|
||||
#define PROC_k10 10
|
||||
#define PROC_venice 9
|
||||
#define PROC_hammer 8
|
||||
#define PROC_k7 7
|
||||
#define PROC_k6 6
|
||||
|
||||
static void
|
||||
x86_cpu_amd(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Empty(cpu);
|
||||
|
||||
BitVector_Bit_On(cpu, CPU_Priv);
|
||||
BitVector_Bit_On(cpu, CPU_Prot);
|
||||
BitVector_Bit_On(cpu, CPU_SMM);
|
||||
BitVector_Bit_On(cpu, CPU_3DNow);
|
||||
if (data >= PROC_bulldozer)
|
||||
BitVector_Bit_On(cpu, CPU_SSE5);
|
||||
if (data >= PROC_k10)
|
||||
BitVector_Bit_On(cpu, CPU_SSE4a);
|
||||
if (data >= PROC_venice)
|
||||
BitVector_Bit_On(cpu, CPU_SSE3);
|
||||
if (data >= PROC_hammer)
|
||||
BitVector_Bit_On(cpu, CPU_SSE2);
|
||||
if (data >= PROC_k7)
|
||||
BitVector_Bit_On(cpu, CPU_SSE);
|
||||
if (data >= PROC_k6)
|
||||
BitVector_Bit_On(cpu, CPU_MMX);
|
||||
BitVector_Bit_On(cpu, CPU_FPU);
|
||||
|
||||
if (data >= PROC_hammer)
|
||||
BitVector_Bit_On(cpu, CPU_Hammer);
|
||||
if (data >= PROC_k7)
|
||||
BitVector_Bit_On(cpu, CPU_Athlon);
|
||||
if (data >= PROC_k6)
|
||||
BitVector_Bit_On(cpu, CPU_K6);
|
||||
BitVector_Bit_On(cpu, CPU_686);
|
||||
BitVector_Bit_On(cpu, CPU_586);
|
||||
BitVector_Bit_On(cpu, CPU_486);
|
||||
BitVector_Bit_On(cpu, CPU_386);
|
||||
BitVector_Bit_On(cpu, CPU_286);
|
||||
BitVector_Bit_On(cpu, CPU_186);
|
||||
BitVector_Bit_On(cpu, CPU_086);
|
||||
}
|
||||
|
||||
static void
|
||||
x86_cpu_set(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Bit_On(cpu, data);
|
||||
}
|
||||
|
||||
static void
|
||||
x86_cpu_clear(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Bit_Off(cpu, data);
|
||||
}
|
||||
|
||||
static void
|
||||
x86_cpu_set_sse4(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Bit_On(cpu, CPU_SSE41);
|
||||
BitVector_Bit_On(cpu, CPU_SSE42);
|
||||
}
|
||||
|
||||
static void
|
||||
x86_cpu_clear_sse4(wordptr cpu, unsigned int data)
|
||||
{
|
||||
BitVector_Bit_Off(cpu, CPU_SSE41);
|
||||
BitVector_Bit_Off(cpu, CPU_SSE42);
|
||||
}
|
||||
|
||||
%}
|
||||
%ignore-case
|
||||
%language=ANSI-C
|
||||
%compare-strncmp
|
||||
%readonly-tables
|
||||
%enum
|
||||
%struct-type
|
||||
%define hash-function-name cpu_hash
|
||||
%define lookup-function-name cpu_find
|
||||
struct cpu_parse_data {
|
||||
const char *name;
|
||||
void (*handler) (wordptr cpu, unsigned int data);
|
||||
unsigned int data;
|
||||
};
|
||||
%%
|
||||
8086, x86_cpu_intel, PROC_8086
|
||||
186, x86_cpu_intel, PROC_186
|
||||
80186, x86_cpu_intel, PROC_186
|
||||
i186, x86_cpu_intel, PROC_186
|
||||
286, x86_cpu_intel, PROC_286
|
||||
80286, x86_cpu_intel, PROC_286
|
||||
i286, x86_cpu_intel, PROC_286
|
||||
386, x86_cpu_intel, PROC_386
|
||||
80386, x86_cpu_intel, PROC_386
|
||||
i386, x86_cpu_intel, PROC_386
|
||||
486, x86_cpu_intel, PROC_486
|
||||
80486, x86_cpu_intel, PROC_486
|
||||
i486, x86_cpu_intel, PROC_486
|
||||
586, x86_cpu_intel, PROC_586
|
||||
i586, x86_cpu_intel, PROC_586
|
||||
pentium, x86_cpu_intel, PROC_586
|
||||
p5, x86_cpu_intel, PROC_586
|
||||
686, x86_cpu_intel, PROC_686
|
||||
i686, x86_cpu_intel, PROC_686
|
||||
p6, x86_cpu_intel, PROC_686
|
||||
ppro, x86_cpu_intel, PROC_686
|
||||
pentiumpro, x86_cpu_intel, PROC_686
|
||||
p2, x86_cpu_intel, PROC_p2
|
||||
pentium2, x86_cpu_intel, PROC_p2
|
||||
pentium-2, x86_cpu_intel, PROC_p2
|
||||
pentiumii, x86_cpu_intel, PROC_p2
|
||||
pentium-ii, x86_cpu_intel, PROC_p2
|
||||
p3, x86_cpu_intel, PROC_p3
|
||||
pentium3, x86_cpu_intel, PROC_p3
|
||||
pentium-3, x86_cpu_intel, PROC_p3
|
||||
pentiumiii, x86_cpu_intel, PROC_p3
|
||||
pentium-iii, x86_cpu_intel, PROC_p3
|
||||
katmai, x86_cpu_intel, PROC_p3
|
||||
p4, x86_cpu_intel, PROC_p4
|
||||
pentium4, x86_cpu_intel, PROC_p4
|
||||
pentium-4, x86_cpu_intel, PROC_p4
|
||||
pentiumiv, x86_cpu_intel, PROC_p4
|
||||
pentium-iv, x86_cpu_intel, PROC_p4
|
||||
williamette, x86_cpu_intel, PROC_p4
|
||||
ia64, x86_cpu_ia64, 0
|
||||
ia-64, x86_cpu_ia64, 0
|
||||
itanium, x86_cpu_ia64, 0
|
||||
k6, x86_cpu_amd, PROC_k6
|
||||
k7, x86_cpu_amd, PROC_k7
|
||||
athlon, x86_cpu_amd, PROC_k7
|
||||
k8, x86_cpu_amd, PROC_hammer
|
||||
hammer, x86_cpu_amd, PROC_hammer
|
||||
clawhammer, x86_cpu_amd, PROC_hammer
|
||||
opteron, x86_cpu_amd, PROC_hammer
|
||||
athlon64, x86_cpu_amd, PROC_hammer
|
||||
athlon-64, x86_cpu_amd, PROC_hammer
|
||||
venice, x86_cpu_amd, PROC_venice
|
||||
k10, x86_cpu_amd, PROC_k10
|
||||
bulldozer, x86_cpu_amd, PROC_bulldozer
|
||||
prescott, x86_cpu_intel, PROC_prescott
|
||||
conroe, x86_cpu_intel, PROC_conroe
|
||||
penryn, x86_cpu_intel, PROC_penryn
|
||||
nehalem, x86_cpu_intel, PROC_nehalem
|
||||
#
|
||||
# Features have "no" versions to disable them, and only set/reset the
|
||||
# specific feature being changed. All other bits are left alone.
|
||||
#
|
||||
fpu, x86_cpu_set, CPU_FPU
|
||||
nofpu, x86_cpu_clear, CPU_FPU
|
||||
mmx, x86_cpu_set, CPU_MMX
|
||||
nommx, x86_cpu_clear, CPU_MMX
|
||||
sse, x86_cpu_set, CPU_SSE
|
||||
nosse, x86_cpu_clear, CPU_SSE
|
||||
sse2, x86_cpu_set, CPU_SSE2
|
||||
nosse2, x86_cpu_clear, CPU_SSE2
|
||||
sse3, x86_cpu_set, CPU_SSE3
|
||||
nosse3, x86_cpu_clear, CPU_SSE3
|
||||
#pni, x86_cpu_set, CPU_PNI
|
||||
#nopni, x86_cpu_clear, CPU_PNI
|
||||
3dnow, x86_cpu_set, CPU_3DNow
|
||||
no3dnow, x86_cpu_clear, CPU_3DNow
|
||||
cyrix, x86_cpu_set, CPU_Cyrix
|
||||
nocyrix, x86_cpu_clear, CPU_Cyrix
|
||||
amd, x86_cpu_set, CPU_AMD
|
||||
noamd, x86_cpu_clear, CPU_AMD
|
||||
smm, x86_cpu_set, CPU_SMM
|
||||
nosmm, x86_cpu_clear, CPU_SMM
|
||||
prot, x86_cpu_set, CPU_Prot
|
||||
noprot, x86_cpu_clear, CPU_Prot
|
||||
protected, x86_cpu_set, CPU_Prot
|
||||
noprotected, x86_cpu_clear, CPU_Prot
|
||||
undoc, x86_cpu_set, CPU_Undoc
|
||||
noundoc, x86_cpu_clear, CPU_Undoc
|
||||
undocumented, x86_cpu_set, CPU_Undoc
|
||||
noundocumented, x86_cpu_clear, CPU_Undoc
|
||||
obs, x86_cpu_set, CPU_Obs
|
||||
noobs, x86_cpu_clear, CPU_Obs
|
||||
obsolete, x86_cpu_set, CPU_Obs
|
||||
noobsolete, x86_cpu_clear, CPU_Obs
|
||||
priv, x86_cpu_set, CPU_Priv
|
||||
nopriv, x86_cpu_clear, CPU_Priv
|
||||
privileged, x86_cpu_set, CPU_Priv
|
||||
noprivileged, x86_cpu_clear, CPU_Priv
|
||||
svm, x86_cpu_set, CPU_SVM
|
||||
nosvm, x86_cpu_clear, CPU_SVM
|
||||
padlock, x86_cpu_set, CPU_PadLock
|
||||
nopadlock, x86_cpu_clear, CPU_PadLock
|
||||
em64t, x86_cpu_set, CPU_EM64T
|
||||
noem64t, x86_cpu_clear, CPU_EM64T
|
||||
ssse3, x86_cpu_set, CPU_SSSE3
|
||||
nossse3, x86_cpu_clear, CPU_SSSE3
|
||||
sse4.1, x86_cpu_set, CPU_SSE41
|
||||
nosse4.1, x86_cpu_clear, CPU_SSE41
|
||||
sse41, x86_cpu_set, CPU_SSE41
|
||||
nosse41, x86_cpu_clear, CPU_SSE41
|
||||
sse4.2, x86_cpu_set, CPU_SSE42
|
||||
nosse4.2, x86_cpu_clear, CPU_SSE42
|
||||
sse42, x86_cpu_set, CPU_SSE42
|
||||
nosse42, x86_cpu_clear, CPU_SSE42
|
||||
sse4a, x86_cpu_set, CPU_SSE4a
|
||||
nosse4a, x86_cpu_clear, CPU_SSE4a
|
||||
sse4, x86_cpu_set_sse4, 0
|
||||
nosse4, x86_cpu_clear_sse4, 0
|
||||
sse5, x86_cpu_set, CPU_SSE5
|
||||
nosse5, x86_cpu_clear, CPU_SSE5
|
||||
%%
|
||||
|
||||
void
|
||||
yasm_x86__parse_cpu(yasm_arch_x86 *arch_x86, const char *cpuid,
|
||||
size_t cpuid_len)
|
||||
{
|
||||
/*@null@*/ const struct cpu_parse_data *pdata;
|
||||
wordptr new_cpu;
|
||||
size_t i;
|
||||
static char lcaseid[16];
|
||||
|
||||
if (cpuid_len > 15)
|
||||
return;
|
||||
for (i=0; i<cpuid_len; i++)
|
||||
lcaseid[i] = tolower(cpuid[i]);
|
||||
lcaseid[cpuid_len] = '\0';
|
||||
|
||||
pdata = cpu_find(lcaseid, cpuid_len);
|
||||
if (!pdata) {
|
||||
yasm_warn_set(YASM_WARN_GENERAL,
|
||||
N_("unrecognized CPU identifier `%s'"), cpuid);
|
||||
return;
|
||||
}
|
||||
|
||||
new_cpu = BitVector_Clone(arch_x86->cpu_enables[arch_x86->active_cpu]);
|
||||
pdata->handler(new_cpu, pdata->data);
|
||||
|
||||
/* try to find an existing match in the CPU table first */
|
||||
for (i=0; i<arch_x86->cpu_enables_size; i++) {
|
||||
if (BitVector_equal(arch_x86->cpu_enables[i], new_cpu)) {
|
||||
arch_x86->active_cpu = i;
|
||||
BitVector_Destroy(new_cpu);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* not found, need to add a new entry */
|
||||
arch_x86->active_cpu = arch_x86->cpu_enables_size++;
|
||||
arch_x86->cpu_enables =
|
||||
yasm_xrealloc(arch_x86->cpu_enables,
|
||||
arch_x86->cpu_enables_size*sizeof(wordptr));
|
||||
arch_x86->cpu_enables[arch_x86->active_cpu] = new_cpu;
|
||||
}
|
||||
|
|
@ -549,6 +549,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize,
|
|||
yasm_bytecode *bc)
|
||||
{
|
||||
int retval;
|
||||
unsigned char *drex = x86_ea->need_drex ? &x86_ea->drex : NULL;
|
||||
|
||||
if (*addrsize == 0) {
|
||||
/* we need to figure out the address size from what we know about:
|
||||
|
|
@ -635,6 +636,12 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (x86_ea->ea.pc_rel && bits != 64) {
|
||||
yasm_warn_set(YASM_WARN_GENERAL,
|
||||
N_("RIP-relative directive ignored in non-64-bit mode"));
|
||||
x86_ea->ea.pc_rel = 0;
|
||||
}
|
||||
|
||||
reg3264_data.regs = reg3264mult;
|
||||
reg3264_data.bits = bits;
|
||||
reg3264_data.addrsize = *addrsize;
|
||||
|
|
@ -754,6 +761,15 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize,
|
|||
* (optional) SIB bytes.
|
||||
*/
|
||||
|
||||
/* If we're supposed to be RIP-relative and there's no register
|
||||
* usage, change to RIP-relative.
|
||||
*/
|
||||
if (basereg == REG3264_NONE && indexreg == REG3264_NONE &&
|
||||
x86_ea->ea.pc_rel) {
|
||||
basereg = REG64_RIP;
|
||||
yasm_value_set_curpos_rel(&x86_ea->ea.disp, bc, 1);
|
||||
}
|
||||
|
||||
/* First determine R/M (Mod is later determined from disp size) */
|
||||
x86_ea->need_modrm = 1; /* we always need ModRM */
|
||||
if (basereg == REG3264_NONE && indexreg == REG3264_NONE) {
|
||||
|
|
@ -784,7 +800,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize,
|
|||
* of register basereg is, as x86_set_rex_from_reg doesn't pay
|
||||
* much attention.
|
||||
*/
|
||||
if (yasm_x86__set_rex_from_reg(rex, &low3,
|
||||
if (yasm_x86__set_rex_from_reg(rex, drex, &low3,
|
||||
(unsigned int)(X86_REG64 | basereg),
|
||||
bits, X86_REX_B))
|
||||
return 1;
|
||||
|
|
@ -811,7 +827,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize,
|
|||
if (basereg == REG3264_NONE)
|
||||
x86_ea->sib |= 5;
|
||||
else {
|
||||
if (yasm_x86__set_rex_from_reg(rex, &low3, (unsigned int)
|
||||
if (yasm_x86__set_rex_from_reg(rex, drex, &low3, (unsigned int)
|
||||
(X86_REG64 | basereg), bits,
|
||||
X86_REX_B))
|
||||
return 1;
|
||||
|
|
@ -823,7 +839,7 @@ yasm_x86__expr_checkea(x86_effaddr *x86_ea, unsigned char *addrsize,
|
|||
x86_ea->sib |= 040;
|
||||
/* Any scale field is valid, just leave at 0. */
|
||||
else {
|
||||
if (yasm_x86__set_rex_from_reg(rex, &low3, (unsigned int)
|
||||
if (yasm_x86__set_rex_from_reg(rex, drex, &low3, (unsigned int)
|
||||
(X86_REG64 | indexreg), bits,
|
||||
X86_REX_X))
|
||||
return 1;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
280
modules/arch/x86/x86regtmod.gperf
Normal file
280
modules/arch/x86/x86regtmod.gperf
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
#
|
||||
# x86 register and target modifier recognition
|
||||
#
|
||||
# Copyright (C) 2002-2007 Peter Johnson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
%{
|
||||
#include <util.h>
|
||||
RCSID("$Id$");
|
||||
|
||||
#include <ctype.h>
|
||||
#include <libyasm.h>
|
||||
#include <libyasm/phash.h>
|
||||
|
||||
#include "modules/arch/x86/x86arch.h"
|
||||
|
||||
enum regtmod_type {
|
||||
REG = 1,
|
||||
REGGROUP,
|
||||
SEGREG,
|
||||
TARGETMOD
|
||||
};
|
||||
%}
|
||||
%ignore-case
|
||||
%language=ANSI-C
|
||||
%compare-strncmp
|
||||
%readonly-tables
|
||||
%enum
|
||||
%struct-type
|
||||
%define hash-function-name regtmod_hash
|
||||
%define lookup-function-name regtmod_find
|
||||
struct regtmod_parse_data {
|
||||
const char *name;
|
||||
unsigned int type:8; /* regtmod_type */
|
||||
|
||||
/* REG: register size
|
||||
* SEGREG: prefix encoding
|
||||
* Others: 0
|
||||
*/
|
||||
unsigned int size_prefix:8;
|
||||
|
||||
/* REG: register index
|
||||
* REGGROUP: register group type
|
||||
* SEGREG: register encoding
|
||||
* TARGETMOD: target modifier
|
||||
*/
|
||||
unsigned int data:8;
|
||||
|
||||
/* REG: required bits setting
|
||||
* SEGREG: BITS in which the segment is ignored
|
||||
* Others: 0
|
||||
*/
|
||||
unsigned int bits:8;
|
||||
};
|
||||
%%
|
||||
#
|
||||
# control, debug, and test registers
|
||||
#
|
||||
cr0, REG, X86_CRREG, 0, 0
|
||||
cr2, REG, X86_CRREG, 2, 0
|
||||
cr3, REG, X86_CRREG, 3, 0
|
||||
cr4, REG, X86_CRREG, 4, 0
|
||||
cr8, REG, X86_CRREG, 8, 64
|
||||
#
|
||||
dr0, REG, X86_DRREG, 0, 0
|
||||
dr1, REG, X86_DRREG, 1, 0
|
||||
dr2, REG, X86_DRREG, 2, 0
|
||||
dr3, REG, X86_DRREG, 3, 0
|
||||
dr4, REG, X86_DRREG, 4, 0
|
||||
dr5, REG, X86_DRREG, 5, 0
|
||||
dr6, REG, X86_DRREG, 6, 0
|
||||
dr7, REG, X86_DRREG, 7, 0
|
||||
#
|
||||
tr0, REG, X86_TRREG, 0, 0
|
||||
tr1, REG, X86_TRREG, 1, 0
|
||||
tr2, REG, X86_TRREG, 2, 0
|
||||
tr3, REG, X86_TRREG, 3, 0
|
||||
tr4, REG, X86_TRREG, 4, 0
|
||||
tr5, REG, X86_TRREG, 5, 0
|
||||
tr6, REG, X86_TRREG, 6, 0
|
||||
tr7, REG, X86_TRREG, 7, 0
|
||||
#
|
||||
# floating point, MMX, and SSE/SSE2 registers
|
||||
#
|
||||
st0, REG, X86_FPUREG, 0, 0
|
||||
st1, REG, X86_FPUREG, 1, 0
|
||||
st2, REG, X86_FPUREG, 2, 0
|
||||
st3, REG, X86_FPUREG, 3, 0
|
||||
st4, REG, X86_FPUREG, 4, 0
|
||||
st5, REG, X86_FPUREG, 5, 0
|
||||
st6, REG, X86_FPUREG, 6, 0
|
||||
st7, REG, X86_FPUREG, 7, 0
|
||||
#
|
||||
mm0, REG, X86_MMXREG, 0, 0
|
||||
mm1, REG, X86_MMXREG, 1, 0
|
||||
mm2, REG, X86_MMXREG, 2, 0
|
||||
mm3, REG, X86_MMXREG, 3, 0
|
||||
mm4, REG, X86_MMXREG, 4, 0
|
||||
mm5, REG, X86_MMXREG, 5, 0
|
||||
mm6, REG, X86_MMXREG, 6, 0
|
||||
mm7, REG, X86_MMXREG, 7, 0
|
||||
#
|
||||
xmm0, REG, X86_XMMREG, 0, 0
|
||||
xmm1, REG, X86_XMMREG, 1, 0
|
||||
xmm2, REG, X86_XMMREG, 2, 0
|
||||
xmm3, REG, X86_XMMREG, 3, 0
|
||||
xmm4, REG, X86_XMMREG, 4, 0
|
||||
xmm5, REG, X86_XMMREG, 5, 0
|
||||
xmm6, REG, X86_XMMREG, 6, 0
|
||||
xmm7, REG, X86_XMMREG, 7, 0
|
||||
xmm8, REG, X86_XMMREG, 8, 64
|
||||
xmm9, REG, X86_XMMREG, 9, 64
|
||||
xmm10, REG, X86_XMMREG, 10, 64
|
||||
xmm11, REG, X86_XMMREG, 11, 64
|
||||
xmm12, REG, X86_XMMREG, 12, 64
|
||||
xmm13, REG, X86_XMMREG, 13, 64
|
||||
xmm14, REG, X86_XMMREG, 14, 64
|
||||
xmm15, REG, X86_XMMREG, 15, 64
|
||||
#
|
||||
# integer registers
|
||||
#
|
||||
rax, REG, X86_REG64, 0, 64
|
||||
rcx, REG, X86_REG64, 1, 64
|
||||
rdx, REG, X86_REG64, 2, 64
|
||||
rbx, REG, X86_REG64, 3, 64
|
||||
rsp, REG, X86_REG64, 4, 64
|
||||
rbp, REG, X86_REG64, 5, 64
|
||||
rsi, REG, X86_REG64, 6, 64
|
||||
rdi, REG, X86_REG64, 7, 64
|
||||
r8, REG, X86_REG64, 8, 64
|
||||
r9, REG, X86_REG64, 9, 64
|
||||
r10, REG, X86_REG64, 10, 64
|
||||
r11, REG, X86_REG64, 11, 64
|
||||
r12, REG, X86_REG64, 12, 64
|
||||
r13, REG, X86_REG64, 13, 64
|
||||
r14, REG, X86_REG64, 14, 64
|
||||
r15, REG, X86_REG64, 15, 64
|
||||
#
|
||||
eax, REG, X86_REG32, 0, 0
|
||||
ecx, REG, X86_REG32, 1, 0
|
||||
edx, REG, X86_REG32, 2, 0
|
||||
ebx, REG, X86_REG32, 3, 0
|
||||
esp, REG, X86_REG32, 4, 0
|
||||
ebp, REG, X86_REG32, 5, 0
|
||||
esi, REG, X86_REG32, 6, 0
|
||||
edi, REG, X86_REG32, 7, 0
|
||||
r8d, REG, X86_REG32, 8, 64
|
||||
r9d, REG, X86_REG32, 9, 64
|
||||
r10d, REG, X86_REG32, 10, 64
|
||||
r11d, REG, X86_REG32, 11, 64
|
||||
r12d, REG, X86_REG32, 12, 64
|
||||
r13d, REG, X86_REG32, 13, 64
|
||||
r14d, REG, X86_REG32, 14, 64
|
||||
r15d, REG, X86_REG32, 15, 64
|
||||
#
|
||||
ax, REG, X86_REG16, 0, 0
|
||||
cx, REG, X86_REG16, 1, 0
|
||||
dx, REG, X86_REG16, 2, 0
|
||||
bx, REG, X86_REG16, 3, 0
|
||||
sp, REG, X86_REG16, 4, 0
|
||||
bp, REG, X86_REG16, 5, 0
|
||||
si, REG, X86_REG16, 6, 0
|
||||
di, REG, X86_REG16, 7, 0
|
||||
r8w, REG, X86_REG16, 8, 64
|
||||
r9w, REG, X86_REG16, 9, 64
|
||||
r10w, REG, X86_REG16, 10, 64
|
||||
r11w, REG, X86_REG16, 11, 64
|
||||
r12w, REG, X86_REG16, 12, 64
|
||||
r13w, REG, X86_REG16, 13, 64
|
||||
r14w, REG, X86_REG16, 14, 64
|
||||
r15w, REG, X86_REG16, 15, 64
|
||||
#
|
||||
al, REG, X86_REG8, 0, 0
|
||||
cl, REG, X86_REG8, 1, 0
|
||||
dl, REG, X86_REG8, 2, 0
|
||||
bl, REG, X86_REG8, 3, 0
|
||||
ah, REG, X86_REG8, 4, 0
|
||||
ch, REG, X86_REG8, 5, 0
|
||||
dh, REG, X86_REG8, 6, 0
|
||||
bh, REG, X86_REG8, 7, 0
|
||||
r8b, REG, X86_REG8, 8, 64
|
||||
r9b, REG, X86_REG8, 9, 64
|
||||
r10b, REG, X86_REG8, 10, 64
|
||||
r11b, REG, X86_REG8, 11, 64
|
||||
r12b, REG, X86_REG8, 12, 64
|
||||
r13b, REG, X86_REG8, 13, 64
|
||||
r14b, REG, X86_REG8, 14, 64
|
||||
r15b, REG, X86_REG8, 15, 64
|
||||
#
|
||||
spl, REG, X86_REG8X, 4, 64
|
||||
bpl, REG, X86_REG8X, 5, 64
|
||||
sil, REG, X86_REG8X, 6, 64
|
||||
dil, REG, X86_REG8X, 7, 64
|
||||
#
|
||||
rip, REG, X86_RIP, 0, 64
|
||||
#
|
||||
# floating point, MMX, and SSE/SSE2 registers
|
||||
#
|
||||
st, REGGROUP, 0, X86_FPUREG, 0
|
||||
mm, REGGROUP, 0, X86_MMXREG, 0
|
||||
xmm, REGGROUP, 0, X86_XMMREG, 0
|
||||
#
|
||||
# segment registers
|
||||
#
|
||||
es, SEGREG, 0x26, 0x00, 64
|
||||
cs, SEGREG, 0x2e, 0x01, 0
|
||||
ss, SEGREG, 0x36, 0x02, 64
|
||||
ds, SEGREG, 0x3e, 0x03, 64
|
||||
fs, SEGREG, 0x64, 0x04, 0
|
||||
gs, SEGREG, 0x65, 0x05, 0
|
||||
#
|
||||
# target modifiers
|
||||
#
|
||||
near, TARGETMOD, 0, X86_NEAR, 0
|
||||
short, TARGETMOD, 0, X86_SHORT, 0
|
||||
far, TARGETMOD, 0, X86_FAR, 0
|
||||
to, TARGETMOD, 0, X86_TO, 0
|
||||
%%
|
||||
|
||||
yasm_arch_regtmod
|
||||
yasm_x86__parse_check_regtmod(yasm_arch *arch, const char *id, size_t id_len,
|
||||
uintptr_t *data)
|
||||
{
|
||||
yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
|
||||
/*@null@*/ const struct regtmod_parse_data *pdata;
|
||||
size_t i;
|
||||
static char lcaseid[8];
|
||||
unsigned int bits;
|
||||
yasm_arch_regtmod type;
|
||||
|
||||
if (id_len > 7)
|
||||
return YASM_ARCH_NOTREGTMOD;
|
||||
for (i=0; i<id_len; i++)
|
||||
lcaseid[i] = tolower(id[i]);
|
||||
lcaseid[id_len] = '\0';
|
||||
|
||||
pdata = regtmod_find(lcaseid, id_len);
|
||||
if (!pdata)
|
||||
return YASM_ARCH_NOTREGTMOD;
|
||||
|
||||
type = (yasm_arch_regtmod)pdata->type;
|
||||
bits = pdata->bits;
|
||||
|
||||
if (type == YASM_ARCH_REG && bits != 0 && arch_x86->mode_bits != bits) {
|
||||
yasm_warn_set(YASM_WARN_GENERAL,
|
||||
N_("`%s' is a register in %u-bit mode"), id, bits);
|
||||
return YASM_ARCH_NOTREGTMOD;
|
||||
}
|
||||
|
||||
if (type == YASM_ARCH_SEGREG && bits != 0 && arch_x86->mode_bits == bits) {
|
||||
yasm_warn_set(YASM_WARN_GENERAL,
|
||||
N_("`%s' segment register ignored in %u-bit mode"), id,
|
||||
bits);
|
||||
}
|
||||
|
||||
if (type == YASM_ARCH_SEGREG)
|
||||
*data = (pdata->size_prefix<<8) | pdata->data;
|
||||
else
|
||||
*data = pdata->size_prefix | pdata->data;
|
||||
return type;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
; Tests illegal float handling
|
||||
db 1.2
|
||||
dw 3.14
|
||||
dw 3.14e500
|
||||
dd 5.12e100000
|
||||
dq 3.141592653589793e-158105
|
||||
dt 5653894745.318293470142875104710284019245e-1999
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
-:2: invalid floating point constant size
|
||||
-:3: invalid floating point constant size
|
||||
-:3: warning: overflow in floating point expression
|
||||
-:4: warning: overflow in floating point expression
|
||||
-:5: warning: underflow in floating point expression
|
||||
-:8: invalid floating point constant size
|
||||
-:9: invalid floating point constant size
|
||||
-:9: warning: overflow in floating point expression
|
||||
-:11: warning: overflow in floating point expression
|
||||
-:12: warning: underflow in floating point expression
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
; Tests float handling
|
||||
dw 3.14
|
||||
dd 5.12
|
||||
dq 3.141592653589793
|
||||
dt 5653894745.318293470142875104710284019245e335
|
||||
|
||||
dw -62000.0
|
||||
dd -47102940.467103581
|
||||
dq -45102571092751092341095.5827509174509178450917845019
|
||||
dt -1.e-1000
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
48
|
||||
42
|
||||
0a
|
||||
d7
|
||||
a3
|
||||
|
|
@ -20,6 +22,8 @@ f1
|
|||
97
|
||||
78
|
||||
44
|
||||
92
|
||||
fb
|
||||
f7
|
||||
ae
|
||||
33
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@ typedef void (*func_write_proghead)(unsigned char **bufpp,
|
|||
unsigned long secthead_count,
|
||||
elf_section_index shstrtab_index);
|
||||
|
||||
enum {
|
||||
ELF_SSYM_SYM_RELATIVE = 1 << 0,
|
||||
ELF_SSYM_CURPOS_ADJUST = 1 << 1
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char *name; /* should be something like ..name */
|
||||
const int sym_rel; /* symbol or section-relative? */
|
||||
|
|
|
|||
|
|
@ -514,6 +514,8 @@ elf_objfmt_output_value(yasm_value *value, unsigned char *buf,
|
|||
wrt = NULL;
|
||||
else if (wrt && elf_is_wrt_sym_relative(wrt))
|
||||
;
|
||||
else if (wrt && elf_is_wrt_pos_adjusted(wrt))
|
||||
intn_val = offset + bc->offset;
|
||||
else if (vis == YASM_SYM_LOCAL) {
|
||||
yasm_bytecode *sym_precbc;
|
||||
/* Local symbols need relocation to their section's start, and
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ elf_x86_amd64_write_proghead(unsigned char **bufpp,
|
|||
}
|
||||
|
||||
static elf_machine_ssym elf_x86_amd64_ssyms[] = {
|
||||
{"..gotpcrel", 1},
|
||||
{"..got", 1},
|
||||
{"..gotpcrel", ELF_SSYM_SYM_RELATIVE},
|
||||
{"..got", ELF_SSYM_SYM_RELATIVE},
|
||||
{"..plt", 0}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -194,9 +194,9 @@ elf_x86_x86_write_proghead(unsigned char **bufpp,
|
|||
}
|
||||
|
||||
static elf_machine_ssym elf_x86_x86_ssyms[] = {
|
||||
{"..gotpc", 0},
|
||||
{"..gotpc", ELF_SSYM_CURPOS_ADJUST},
|
||||
{"..gotoff", 0},
|
||||
{"..got", 1},
|
||||
{"..got", ELF_SSYM_SYM_RELATIVE},
|
||||
{"..plt", 0}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -99,13 +99,27 @@ elf_set_arch(yasm_arch *arch, yasm_symtab *symtab, int bits_pref)
|
|||
}
|
||||
|
||||
/* reloc functions */
|
||||
int elf_ssym_has_flag(yasm_symrec *wrt, int flag);
|
||||
|
||||
int
|
||||
elf_is_wrt_sym_relative(yasm_symrec *wrt)
|
||||
{
|
||||
return elf_ssym_has_flag(wrt, ELF_SSYM_SYM_RELATIVE);
|
||||
}
|
||||
|
||||
int
|
||||
elf_is_wrt_pos_adjusted(yasm_symrec *wrt)
|
||||
{
|
||||
return elf_ssym_has_flag(wrt, ELF_SSYM_CURPOS_ADJUST);
|
||||
}
|
||||
|
||||
int
|
||||
elf_ssym_has_flag(yasm_symrec *wrt, int flag)
|
||||
{
|
||||
int i;
|
||||
for (i=0; (unsigned int)i<elf_march->num_ssyms; i++) {
|
||||
if (elf_ssyms[i] == wrt)
|
||||
return elf_march->ssyms[i].sym_rel;
|
||||
return (elf_march->ssyms[i].sym_rel & flag) != 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,6 +412,7 @@ const elf_machine_handler *elf_set_arch(struct yasm_arch *arch,
|
|||
|
||||
/* reloc functions */
|
||||
int elf_is_wrt_sym_relative(yasm_symrec *wrt);
|
||||
int elf_is_wrt_pos_adjusted(yasm_symrec *wrt);
|
||||
elf_reloc_entry *elf_reloc_entry_create(yasm_symrec *sym,
|
||||
/*@null@*/ yasm_symrec *wrt,
|
||||
yasm_intnum *addr,
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ e8
|
|||
5b
|
||||
81
|
||||
c3
|
||||
e9
|
||||
ff
|
||||
ff
|
||||
ff
|
||||
03
|
||||
00
|
||||
00
|
||||
00
|
||||
8b
|
||||
83
|
||||
00
|
||||
|
|
|
|||
|
|
@ -755,8 +755,11 @@ parse_memaddr(yasm_parser_nasm *parser_nasm)
|
|||
}
|
||||
get_next_token();
|
||||
ea = parse_memaddr(parser_nasm);
|
||||
if (ea)
|
||||
if (ea) {
|
||||
yasm_ea_set_segreg(ea, segreg);
|
||||
ea->pc_rel = 0;
|
||||
ea->not_pc_rel = 1;
|
||||
}
|
||||
return ea;
|
||||
}
|
||||
case SIZE_OVERRIDE:
|
||||
|
|
@ -774,6 +777,22 @@ parse_memaddr(yasm_parser_nasm *parser_nasm)
|
|||
if (ea)
|
||||
ea->nosplit = 1;
|
||||
return ea;
|
||||
case REL:
|
||||
get_next_token();
|
||||
ea = parse_memaddr(parser_nasm);
|
||||
if (ea) {
|
||||
ea->pc_rel = 1;
|
||||
ea->not_pc_rel = 0;
|
||||
}
|
||||
return ea;
|
||||
case ABS:
|
||||
get_next_token();
|
||||
ea = parse_memaddr(parser_nasm);
|
||||
if (ea) {
|
||||
ea->pc_rel = 0;
|
||||
ea->not_pc_rel = 1;
|
||||
}
|
||||
return ea;
|
||||
default:
|
||||
{
|
||||
yasm_expr *e = parse_expr(parser_nasm, NORM_EXPR);
|
||||
|
|
@ -1131,15 +1150,21 @@ nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name,
|
|||
objext_valparams, line))
|
||||
;
|
||||
else if (yasm__strcasecmp(name, "absolute") == 0) {
|
||||
vp = yasm_vps_first(valparams);
|
||||
if (parser_nasm->absstart)
|
||||
yasm_expr_destroy(parser_nasm->absstart);
|
||||
if (parser_nasm->abspos)
|
||||
yasm_expr_destroy(parser_nasm->abspos);
|
||||
parser_nasm->absstart = yasm_vp_expr(vp, p_object->symtab, line);
|
||||
parser_nasm->abspos = yasm_expr_copy(parser_nasm->absstart);
|
||||
cursect = NULL;
|
||||
parser_nasm->prev_bc = NULL;
|
||||
if (!valparams) {
|
||||
yasm_error_set(YASM_ERROR_SYNTAX,
|
||||
N_("directive `%s' requires an argument"),
|
||||
"absolute");
|
||||
} else {
|
||||
vp = yasm_vps_first(valparams);
|
||||
if (parser_nasm->absstart)
|
||||
yasm_expr_destroy(parser_nasm->absstart);
|
||||
if (parser_nasm->abspos)
|
||||
yasm_expr_destroy(parser_nasm->abspos);
|
||||
parser_nasm->absstart = yasm_vp_expr(vp, p_object->symtab, line);
|
||||
parser_nasm->abspos = yasm_expr_copy(parser_nasm->absstart);
|
||||
cursect = NULL;
|
||||
parser_nasm->prev_bc = NULL;
|
||||
}
|
||||
} else if (yasm__strcasecmp(name, "align") == 0) {
|
||||
/* Really, we shouldn't end up with an align directive in an absolute
|
||||
* section (as it's supposed to be only used for nop fill), but handle
|
||||
|
|
@ -1166,6 +1191,27 @@ nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name,
|
|||
N_("directive `%s' requires an argument"), "align");
|
||||
} else
|
||||
dir_align(p_object, valparams, objext_valparams, line);
|
||||
} else if (yasm__strcasecmp(name, "default") == 0) {
|
||||
if (!valparams)
|
||||
;
|
||||
else {
|
||||
vp = yasm_vps_first(valparams);
|
||||
while (vp) {
|
||||
const char *id = yasm_vp_id(vp);
|
||||
if (id) {
|
||||
if (yasm__strcasecmp(id, "rel") == 0)
|
||||
yasm_arch_set_var(p_object->arch, "default_rel", 1);
|
||||
else if (yasm__strcasecmp(id, "abs") == 0)
|
||||
yasm_arch_set_var(p_object->arch, "default_rel", 0);
|
||||
else
|
||||
yasm_error_set(YASM_ERROR_SYNTAX,
|
||||
N_("unrecognized default `%s'"), id);
|
||||
} else
|
||||
yasm_error_set(YASM_ERROR_SYNTAX,
|
||||
N_("unrecognized default value"));
|
||||
vp = yasm_vps_next(vp);
|
||||
}
|
||||
}
|
||||
} else
|
||||
yasm_error_set(YASM_ERROR_SYNTAX, N_("unrecognized directive `%s'"),
|
||||
name);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ enum tokentype {
|
|||
TIMES,
|
||||
SEG,
|
||||
WRT,
|
||||
ABS,
|
||||
REL,
|
||||
NOSPLIT,
|
||||
STRICT,
|
||||
INSN,
|
||||
|
|
|
|||
|
|
@ -246,6 +246,10 @@ scan:
|
|||
lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8;
|
||||
RETURN(SIZE_OVERRIDE);
|
||||
}
|
||||
'oword' {
|
||||
lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8;
|
||||
RETURN(SIZE_OVERRIDE);
|
||||
}
|
||||
|
||||
/* pseudo-instructions */
|
||||
'db' { lvalp->int_info = 8; RETURN(DECLARE_DATA); }
|
||||
|
|
@ -270,6 +274,10 @@ scan:
|
|||
lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8;
|
||||
RETURN(DECLARE_DATA);
|
||||
}
|
||||
'do' {
|
||||
lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8;
|
||||
RETURN(DECLARE_DATA);
|
||||
}
|
||||
|
||||
'resb' { lvalp->int_info = 8; RETURN(RESERVE_SPACE); }
|
||||
'reshw' {
|
||||
|
|
@ -293,6 +301,10 @@ scan:
|
|||
lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8;
|
||||
RETURN(RESERVE_SPACE);
|
||||
}
|
||||
'reso' {
|
||||
lvalp->int_info = yasm_arch_wordsize(p_object->arch)*8;
|
||||
RETURN(RESERVE_SPACE);
|
||||
}
|
||||
|
||||
'incbin' { RETURN(INCBIN); }
|
||||
|
||||
|
|
@ -303,6 +315,9 @@ scan:
|
|||
'seg' { RETURN(SEG); }
|
||||
'wrt' { RETURN(WRT); }
|
||||
|
||||
'abs' { RETURN(ABS); }
|
||||
'rel' { RETURN(REL); }
|
||||
|
||||
'nosplit' { RETURN(NOSPLIT); }
|
||||
'strict' { RETURN(STRICT); }
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,10 @@ __SECT__
|
|||
[cpu %1]
|
||||
%endmacro
|
||||
|
||||
%imacro default 1+.nolist
|
||||
[default %1]
|
||||
%endmacro
|
||||
|
||||
; NASM compatibility shim
|
||||
%define __OUTPUT_FORMAT__ __YASM_OBJFMT__
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# $Id$
|
||||
|
||||
EXTRA_DIST += tools/re2c/Makefile.inc
|
||||
EXTRA_DIST += tools/gap/Makefile.inc
|
||||
EXTRA_DIST += tools/genperf/Makefile.inc
|
||||
EXTRA_DIST += tools/python-yasm/Makefile.inc
|
||||
|
||||
include tools/re2c/Makefile.inc
|
||||
include tools/gap/Makefile.inc
|
||||
include tools/genperf/Makefile.inc
|
||||
include tools/python-yasm/Makefile.inc
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
# $Id$
|
||||
|
||||
# These utility programs have to be built for BUILD host in cross-build.
|
||||
# This makes things rather non-standard automake
|
||||
|
||||
noinst_PROGRAMS += gap
|
||||
|
||||
gap_SOURCES =
|
||||
EXTRA_DIST += tools/gap/gap.c
|
||||
EXTRA_DIST += tools/gap/perfect.c
|
||||
EXTRA_DIST += tools/gap/perfect.h
|
||||
EXTRA_DIST += tools/gap/standard.h
|
||||
gap_LDADD = gap.$(OBJEXT)
|
||||
gap_LDADD += gap-perfect.$(OBJEXT)
|
||||
gap_LDADD += gap-phash.$(OBJEXT)
|
||||
gap_LDADD += gap-xmalloc.$(OBJEXT)
|
||||
gap_LDADD += gap-xstrdup.$(OBJEXT)
|
||||
gap_LINK = $(CCLD_FOR_BUILD) -o $@
|
||||
|
||||
gap.$(OBJEXT): tools/gap/gap.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/gap/gap.c || echo '$(srcdir)/'`tools/gap/gap.c
|
||||
|
||||
gap-perfect.$(OBJEXT): tools/gap/perfect.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/gap/perfect.c || echo '$(srcdir)/'`tools/gap/perfect.c
|
||||
|
||||
gap-phash.$(OBJEXT): libyasm/phash.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
|
||||
|
||||
gap-xmalloc.$(OBJEXT): libyasm/xmalloc.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
|
||||
|
||||
gap-xstrdup.$(OBJEXT): libyasm/xstrdup.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
|
||||
|
||||
854
tools/gap/gap.c
854
tools/gap/gap.c
|
|
@ -1,854 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* Generate Arch Parser (GAP): generates ARCHparse.c from ARCHparse.gap.
|
||||
*
|
||||
* Copyright (C) 2006-2007 Peter Johnson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "tools/gap/perfect.h"
|
||||
#include "libyasm/compat-queue.h"
|
||||
#include "libyasm/coretype.h"
|
||||
#include "libyasm/errwarn.h"
|
||||
|
||||
typedef STAILQ_HEAD(slist, sval) slist;
|
||||
typedef struct sval {
|
||||
STAILQ_ENTRY(sval) link;
|
||||
char *str;
|
||||
} sval;
|
||||
|
||||
typedef STAILQ_HEAD(dir_list, dir) dir_list;
|
||||
typedef struct dir {
|
||||
STAILQ_ENTRY(dir) link;
|
||||
char *name;
|
||||
const char *func;
|
||||
slist args;
|
||||
} dir;
|
||||
|
||||
typedef STAILQ_HEAD(dir_byp_list, dir_byp) dir_byp_list;
|
||||
typedef struct dir_byp {
|
||||
STAILQ_ENTRY(dir_byp) link;
|
||||
/*@null@*/ char *parser;
|
||||
dir_list dirs;
|
||||
} dir_byp;
|
||||
|
||||
typedef enum {
|
||||
ARCH = 0,
|
||||
PARSERS,
|
||||
INSN,
|
||||
CPU,
|
||||
CPU_ALIAS,
|
||||
CPU_FEATURE,
|
||||
TARGETMOD,
|
||||
PREFIX,
|
||||
REG,
|
||||
REGGROUP,
|
||||
SEGREG,
|
||||
NUM_DIRS
|
||||
} dir_type;
|
||||
|
||||
typedef struct {
|
||||
void (*parse_insn) (void); /* arch-specific parse_insn */
|
||||
int multi_parser[NUM_DIRS]; /* whether it has an initial parser field */
|
||||
} arch_handler;
|
||||
|
||||
static void x86_parse_insn(void);
|
||||
static const arch_handler arch_x86 = {
|
||||
x86_parse_insn,
|
||||
{0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0}
|
||||
};
|
||||
|
||||
static struct {
|
||||
const char *name;
|
||||
const arch_handler *arch;
|
||||
} archs[] = {
|
||||
{"x86", &arch_x86},
|
||||
};
|
||||
|
||||
static char line[1024];
|
||||
static unsigned int cur_line = 0, next_line = 1;
|
||||
static int errors = 0;
|
||||
static const arch_handler *arch = NULL;
|
||||
|
||||
/* Lists of directives, keyed by parser name */
|
||||
static dir_byp_list insnprefix_byp;
|
||||
static dir_byp_list cpu_byp;
|
||||
static dir_byp_list regtmod_byp;
|
||||
|
||||
static void
|
||||
report_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "%u: ", cur_line);
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
errors++;
|
||||
}
|
||||
|
||||
void
|
||||
yasm__fatal(const char *message, ...)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
static void
|
||||
dup_slist(slist *out, slist *in)
|
||||
{
|
||||
sval *sv;
|
||||
|
||||
STAILQ_INIT(out);
|
||||
STAILQ_FOREACH(sv, in, link) {
|
||||
sval *nsv = yasm_xmalloc(sizeof(sval));
|
||||
nsv->str = yasm__xstrdup(sv->str);
|
||||
STAILQ_INSERT_TAIL(out, nsv, link);
|
||||
}
|
||||
}
|
||||
|
||||
static dir *
|
||||
dup_dir(dir *in)
|
||||
{
|
||||
dir *out = yasm_xmalloc(sizeof(dir));
|
||||
out->name = yasm__xstrdup(in->name);
|
||||
out->func = in->func;
|
||||
dup_slist(&out->args, &in->args);
|
||||
return out;
|
||||
}
|
||||
|
||||
static dir_list *
|
||||
get_dirs(dir_byp_list *byp, /*@null@*/ const char *parser)
|
||||
{
|
||||
dir_list *found = NULL;
|
||||
dir_byp *db;
|
||||
|
||||
if (STAILQ_EMPTY(byp)) {
|
||||
report_error("PARSERS not yet specified");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STAILQ_FOREACH(db, byp, link) {
|
||||
if ((!parser && !db->parser) ||
|
||||
(parser && db->parser && strcmp(parser, db->parser) == 0)) {
|
||||
found = &db->dirs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Add a keyword/data to a slist of slist keyed by parser name.
|
||||
* Returns nonzero on error.
|
||||
*/
|
||||
static int
|
||||
add_dir(dir_byp_list *byp, /*@null@*/ const char *parser, dir *d)
|
||||
{
|
||||
dir_list *found = get_dirs(byp, parser);
|
||||
|
||||
if (found) {
|
||||
STAILQ_INSERT_TAIL(found, d, link);
|
||||
return 0;
|
||||
} else if (!parser) {
|
||||
/* Add separately to all */
|
||||
dir_byp *db;
|
||||
int first = 1;
|
||||
STAILQ_FOREACH(db, byp, link) {
|
||||
if (!first)
|
||||
d = dup_dir(d);
|
||||
first = 0;
|
||||
STAILQ_INSERT_TAIL(&db->dirs, d, link);
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
report_error("parser not found");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
check_parser(dir_type type)
|
||||
{
|
||||
char *parser = NULL;
|
||||
|
||||
if (arch->multi_parser[type]) {
|
||||
parser = strtok(NULL, " \t\n");
|
||||
if (strcmp(parser, "-") == 0)
|
||||
parser = NULL;
|
||||
}
|
||||
|
||||
return parser;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_args(slist *args)
|
||||
{
|
||||
char *tok;
|
||||
sval *sv;
|
||||
|
||||
STAILQ_INIT(args);
|
||||
|
||||
tok = strtok(NULL, " \t\n");
|
||||
if (!tok) {
|
||||
report_error("no args");
|
||||
return;
|
||||
}
|
||||
|
||||
while (tok) {
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup(tok);
|
||||
STAILQ_INSERT_TAIL(args, sv, link);
|
||||
tok = strtok(NULL, " \t\n");
|
||||
}
|
||||
}
|
||||
|
||||
static dir *
|
||||
parse_generic(dir_type type, const char *func, dir_byp_list *byp)
|
||||
{
|
||||
char *parser = check_parser(type);
|
||||
char *name = strtok(NULL, " \t\n");
|
||||
dir *d = yasm_xmalloc(sizeof(dir));
|
||||
|
||||
d->name = yasm__xstrdup(name);
|
||||
d->func = func;
|
||||
parse_args(&d->args);
|
||||
|
||||
add_dir(byp, parser, d);
|
||||
return d;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_arch(void)
|
||||
{
|
||||
size_t i;
|
||||
int found = 0;
|
||||
char *tok = strtok(NULL, " \t\n");
|
||||
|
||||
if (!tok) {
|
||||
report_error("ARCH requires an operand");
|
||||
return;
|
||||
}
|
||||
for (i=0; i<sizeof(archs)/sizeof(archs[0]); i++) {
|
||||
if (strcmp(archs[i].name, tok) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
report_error("unrecognized ARCH");
|
||||
return;
|
||||
}
|
||||
|
||||
arch = archs[i].arch;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_parsers(void)
|
||||
{
|
||||
dir_byp *db;
|
||||
char *tok;
|
||||
|
||||
if (!arch) {
|
||||
report_error("ARCH not specified before PARSERS");
|
||||
return;
|
||||
}
|
||||
|
||||
tok = strtok(NULL, " \t\n");
|
||||
if (!tok) {
|
||||
report_error("no PARSERS parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
while (tok) {
|
||||
/* Insert into each slist of slist if broken out by parser */
|
||||
if (arch->multi_parser[INSN] || arch->multi_parser[PREFIX]) {
|
||||
db = yasm_xmalloc(sizeof(dir_byp));
|
||||
db->parser = yasm__xstrdup(tok);
|
||||
STAILQ_INIT(&db->dirs);
|
||||
|
||||
STAILQ_INSERT_TAIL(&insnprefix_byp, db, link);
|
||||
}
|
||||
if (arch->multi_parser[CPU] || arch->multi_parser[CPU_ALIAS] ||
|
||||
arch->multi_parser[CPU_FEATURE]) {
|
||||
db = yasm_xmalloc(sizeof(dir_byp));
|
||||
db->parser = yasm__xstrdup(tok);
|
||||
STAILQ_INIT(&db->dirs);
|
||||
|
||||
STAILQ_INSERT_TAIL(&cpu_byp, db, link);
|
||||
}
|
||||
if (arch->multi_parser[TARGETMOD] || arch->multi_parser[REG] ||
|
||||
arch->multi_parser[REGGROUP] || arch->multi_parser[SEGREG]) {
|
||||
db = yasm_xmalloc(sizeof(dir_byp));
|
||||
db->parser = yasm__xstrdup(tok);
|
||||
STAILQ_INIT(&db->dirs);
|
||||
|
||||
STAILQ_INSERT_TAIL(®tmod_byp, db, link);
|
||||
}
|
||||
tok = strtok(NULL, " \t\n");
|
||||
}
|
||||
|
||||
/* Add NULL (global) versions if not already created */
|
||||
if (STAILQ_EMPTY(&insnprefix_byp)) {
|
||||
db = yasm_xmalloc(sizeof(dir_byp));
|
||||
db->parser = NULL;
|
||||
STAILQ_INIT(&db->dirs);
|
||||
|
||||
STAILQ_INSERT_TAIL(&insnprefix_byp, db, link);
|
||||
}
|
||||
if (STAILQ_EMPTY(&cpu_byp)) {
|
||||
db = yasm_xmalloc(sizeof(dir_byp));
|
||||
db->parser = NULL;
|
||||
STAILQ_INIT(&db->dirs);
|
||||
|
||||
STAILQ_INSERT_TAIL(&cpu_byp, db, link);
|
||||
}
|
||||
if (STAILQ_EMPTY(®tmod_byp)) {
|
||||
db = yasm_xmalloc(sizeof(dir_byp));
|
||||
db->parser = NULL;
|
||||
STAILQ_INIT(&db->dirs);
|
||||
|
||||
STAILQ_INSERT_TAIL(®tmod_byp, db, link);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
x86_parse_insn(void)
|
||||
{
|
||||
char *parser = check_parser(INSN);
|
||||
char *bname = strtok(NULL, " \t\n");
|
||||
char *suffix = strtok(NULL, " \t\n");
|
||||
dir *d;
|
||||
slist args;
|
||||
sval *sv;
|
||||
|
||||
if (!suffix) {
|
||||
report_error("INSN requires suffix");
|
||||
return;
|
||||
}
|
||||
|
||||
/* save the remainder of args */
|
||||
parse_args(&args);
|
||||
|
||||
if (suffix[0] != '"') {
|
||||
/* Just one instruction to generate */
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup(suffix);
|
||||
STAILQ_INSERT_HEAD(&args, sv, link);
|
||||
|
||||
d = yasm_xmalloc(sizeof(dir));
|
||||
d->name = yasm__xstrdup(bname);
|
||||
d->func = "INSN";
|
||||
d->args = args;
|
||||
add_dir(&insnprefix_byp, parser, d);
|
||||
} else {
|
||||
/* Need to generate with suffixes for gas */
|
||||
char *p;
|
||||
char sufstr[6];
|
||||
size_t bnamelen = strlen(bname);
|
||||
|
||||
strcpy(sufstr, "SUF_X");
|
||||
|
||||
for (p = &suffix[1]; *p != '"'; p++) {
|
||||
sufstr[4] = toupper(*p);
|
||||
|
||||
d = yasm_xmalloc(sizeof(dir));
|
||||
|
||||
d->name = yasm_xmalloc(bnamelen+2);
|
||||
strcpy(d->name, bname);
|
||||
d->name[bnamelen] = tolower(*p);
|
||||
d->name[bnamelen+1] = '\0';
|
||||
|
||||
d->func = "INSN";
|
||||
dup_slist(&d->args, &args);
|
||||
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup(sufstr);
|
||||
STAILQ_INSERT_HEAD(&d->args, sv, link);
|
||||
|
||||
add_dir(&insnprefix_byp, "gas", d);
|
||||
}
|
||||
|
||||
/* And finally the version sans suffix */
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup("NONE");
|
||||
STAILQ_INSERT_HEAD(&args, sv, link);
|
||||
|
||||
d = yasm_xmalloc(sizeof(dir));
|
||||
d->name = yasm__xstrdup(bname);
|
||||
d->func = "INSN";
|
||||
d->args = args;
|
||||
add_dir(&insnprefix_byp, parser, d);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
parse_insn(void)
|
||||
{
|
||||
if (!arch) {
|
||||
report_error("ARCH not defined prior to INSN");
|
||||
return;
|
||||
}
|
||||
arch->parse_insn();
|
||||
}
|
||||
|
||||
static void
|
||||
parse_cpu(void)
|
||||
{
|
||||
dir *d = parse_generic(CPU, "CPU", &cpu_byp);
|
||||
sval *sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup("CPU_MODE_VERBATIM");
|
||||
STAILQ_INSERT_TAIL(&d->args, sv, link);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_cpu_alias(void)
|
||||
{
|
||||
char *parser = check_parser(CPU_ALIAS);
|
||||
char *name = strtok(NULL, " \t\n");
|
||||
char *alias = strtok(NULL, " \t\n");
|
||||
dir_list *dirs = get_dirs(&cpu_byp, parser);
|
||||
dir *aliasd, *d;
|
||||
|
||||
if (!alias) {
|
||||
report_error("CPU_ALIAS requires an operand");
|
||||
return;
|
||||
}
|
||||
|
||||
STAILQ_FOREACH(aliasd, dirs, link) {
|
||||
if (strcmp(aliasd->name, alias) == 0)
|
||||
break;
|
||||
}
|
||||
if (!aliasd) {
|
||||
report_error("could not find `%s'", alias);
|
||||
return;
|
||||
}
|
||||
|
||||
d = yasm_xmalloc(sizeof(dir));
|
||||
d->name = yasm__xstrdup(name);
|
||||
d->func = "CPU";
|
||||
dup_slist(&d->args, &aliasd->args);
|
||||
|
||||
add_dir(&cpu_byp, parser, d);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_cpu_feature(void)
|
||||
{
|
||||
char *parser = check_parser(CPU_FEATURE);
|
||||
char *name = strtok(NULL, " \t\n");
|
||||
dir *name_dir = yasm_xmalloc(sizeof(dir));
|
||||
dir *noname_dir = yasm_xmalloc(sizeof(dir));
|
||||
sval *sv;
|
||||
|
||||
name_dir->name = yasm__xstrdup(name);
|
||||
name_dir->func = "CPU_FEATURE";
|
||||
parse_args(&name_dir->args);
|
||||
|
||||
noname_dir->name = yasm_xmalloc(strlen(name)+3);
|
||||
strcpy(noname_dir->name, "no");
|
||||
strcat(noname_dir->name, name);
|
||||
noname_dir->func = name_dir->func;
|
||||
dup_slist(&noname_dir->args, &name_dir->args);
|
||||
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup("CPU_MODE_SET");
|
||||
STAILQ_INSERT_TAIL(&name_dir->args, sv, link);
|
||||
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup("CPU_MODE_CLEAR");
|
||||
STAILQ_INSERT_TAIL(&noname_dir->args, sv, link);
|
||||
|
||||
add_dir(&cpu_byp, parser, name_dir);
|
||||
add_dir(&cpu_byp, parser, noname_dir);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_targetmod(void)
|
||||
{
|
||||
parse_generic(TARGETMOD, "TARGETMOD", ®tmod_byp);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_prefix(void)
|
||||
{
|
||||
parse_generic(PREFIX, "PREFIX", &insnprefix_byp);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_reg(void)
|
||||
{
|
||||
parse_generic(REG, "REG", ®tmod_byp);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_reggroup(void)
|
||||
{
|
||||
parse_generic(REGGROUP, "REGGROUP", ®tmod_byp);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_segreg(void)
|
||||
{
|
||||
parse_generic(SEGREG, "SEGREG", ®tmod_byp);
|
||||
}
|
||||
|
||||
/* make the c output for the perfect hash tab array */
|
||||
static void
|
||||
make_c_tab(
|
||||
FILE *f,
|
||||
const char *which,
|
||||
const char *parser,
|
||||
bstuff *tab, /* table indexed by b */
|
||||
ub4 smax, /* range of scramble[] */
|
||||
ub4 blen, /* b in 0..blen-1, power of 2 */
|
||||
ub4 *scramble) /* used in final hash */
|
||||
{
|
||||
ub4 i;
|
||||
/* table for the mapping for the perfect hash */
|
||||
if (blen >= USE_SCRAMBLE) {
|
||||
/* A way to make the 1-byte values in tab bigger */
|
||||
if (smax > UB2MAXVAL+1) {
|
||||
fprintf(f, "static const unsigned long %s_", which);
|
||||
if (parser)
|
||||
fprintf(f, "%s_", parser);
|
||||
fprintf(f, "scramble[] = {\n");
|
||||
for (i=0; i<=UB1MAXVAL; i+=4)
|
||||
fprintf(f, "0x%.8lx, 0x%.8lx, 0x%.8lx, 0x%.8lx,\n",
|
||||
scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3]);
|
||||
} else {
|
||||
fprintf(f, "static const unsigned short %s_", which);
|
||||
if (parser)
|
||||
fprintf(f, "%s_", parser);
|
||||
fprintf(f, "scramble[] = {\n");
|
||||
for (i=0; i<=UB1MAXVAL; i+=8)
|
||||
fprintf(f,
|
||||
"0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx,\n",
|
||||
scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3],
|
||||
scramble[i+4], scramble[i+5], scramble[i+6], scramble[i+7]);
|
||||
}
|
||||
fprintf(f, "};\n");
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
if (blen > 0) {
|
||||
/* small adjustments to _a_ to make values distinct */
|
||||
if (smax <= UB1MAXVAL+1 || blen >= USE_SCRAMBLE)
|
||||
fprintf(f, "static const unsigned char %s_", which);
|
||||
else
|
||||
fprintf(f, "static const unsigned short %s_", which);
|
||||
if (parser)
|
||||
fprintf(f, "%s_", parser);
|
||||
fprintf(f, "tab[] = {\n");
|
||||
|
||||
if (blen < 16) {
|
||||
for (i=0; i<blen; ++i)
|
||||
fprintf(f, "%3ld,", scramble[tab[i].val_b]);
|
||||
} else if (blen <= 1024) {
|
||||
for (i=0; i<blen; i+=16)
|
||||
fprintf(f, "%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,\n",
|
||||
scramble[tab[i+0].val_b], scramble[tab[i+1].val_b],
|
||||
scramble[tab[i+2].val_b], scramble[tab[i+3].val_b],
|
||||
scramble[tab[i+4].val_b], scramble[tab[i+5].val_b],
|
||||
scramble[tab[i+6].val_b], scramble[tab[i+7].val_b],
|
||||
scramble[tab[i+8].val_b], scramble[tab[i+9].val_b],
|
||||
scramble[tab[i+10].val_b], scramble[tab[i+11].val_b],
|
||||
scramble[tab[i+12].val_b], scramble[tab[i+13].val_b],
|
||||
scramble[tab[i+14].val_b], scramble[tab[i+15].val_b]);
|
||||
} else if (blen < USE_SCRAMBLE) {
|
||||
for (i=0; i<blen; i+=8)
|
||||
fprintf(f, "%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,\n",
|
||||
scramble[tab[i+0].val_b], scramble[tab[i+1].val_b],
|
||||
scramble[tab[i+2].val_b], scramble[tab[i+3].val_b],
|
||||
scramble[tab[i+4].val_b], scramble[tab[i+5].val_b],
|
||||
scramble[tab[i+6].val_b], scramble[tab[i+7].val_b]);
|
||||
} else {
|
||||
for (i=0; i<blen; i+=16)
|
||||
fprintf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n",
|
||||
tab[i+0].val_b, tab[i+1].val_b,
|
||||
tab[i+2].val_b, tab[i+3].val_b,
|
||||
tab[i+4].val_b, tab[i+5].val_b,
|
||||
tab[i+6].val_b, tab[i+7].val_b,
|
||||
tab[i+8].val_b, tab[i+9].val_b,
|
||||
tab[i+10].val_b, tab[i+11].val_b,
|
||||
tab[i+12].val_b, tab[i+13].val_b,
|
||||
tab[i+14].val_b, tab[i+15].val_b);
|
||||
}
|
||||
fprintf(f, "};\n");
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
perfect_dir(FILE *out, const char *which, const char *parser, dir_list *dirs)
|
||||
{
|
||||
ub4 nkeys;
|
||||
key *keys;
|
||||
hashform form;
|
||||
bstuff *tab; /* table indexed by b */
|
||||
hstuff *tabh; /* table indexed by hash value */
|
||||
ub4 smax; /* scramble[] values in 0..smax-1, a power of 2 */
|
||||
ub4 alen; /* a in 0..alen-1, a power of 2 */
|
||||
ub4 blen; /* b in 0..blen-1, a power of 2 */
|
||||
ub4 salt; /* a parameter to the hash function */
|
||||
gencode final; /* code for final hash */
|
||||
ub4 i;
|
||||
ub4 scramble[SCRAMBLE_LEN]; /* used in final hash function */
|
||||
char buf[10][80]; /* buffer for generated code */
|
||||
char *buf2[10]; /* also for generated code */
|
||||
int cpumode = strcmp(which, "cpu") == 0;
|
||||
dir *d;
|
||||
|
||||
/* perfect hash configuration */
|
||||
form.mode = NORMAL_HM;
|
||||
form.hashtype = STRING_HT;
|
||||
form.perfect = MINIMAL_HP;
|
||||
form.speed = SLOW_HS;
|
||||
|
||||
/* set up code for final hash */
|
||||
final.line = buf2;
|
||||
final.used = 0;
|
||||
final.len = 10;
|
||||
for (i=0; i<10; i++)
|
||||
final.line[i] = buf[i];
|
||||
|
||||
/* build list of keys */
|
||||
nkeys = 0;
|
||||
keys = NULL;
|
||||
STAILQ_FOREACH(d, dirs, link) {
|
||||
key *k = yasm_xmalloc(sizeof(key));
|
||||
|
||||
k->name_k = yasm__xstrdup(d->name);
|
||||
k->len_k = (ub4)strlen(d->name);
|
||||
k->next_k = keys;
|
||||
keys = k;
|
||||
nkeys++;
|
||||
}
|
||||
|
||||
/* find the hash */
|
||||
findhash(&tab, &tabh, &alen, &blen, &salt, &final,
|
||||
scramble, &smax, keys, nkeys, &form);
|
||||
|
||||
/* output the dir table: this should loop up to smax for NORMAL_HP,
|
||||
* or up to pakd.nkeys for MINIMAL_HP.
|
||||
*/
|
||||
fprintf(out, "static const %s_parse_data %s_", which, which);
|
||||
if (parser)
|
||||
fprintf(out, "%s_", parser);
|
||||
fprintf(out, "pd[%lu] = {\n", nkeys);
|
||||
for (i=0; i<nkeys; i++) {
|
||||
if (tabh[i].key_h) {
|
||||
sval *sv;
|
||||
STAILQ_FOREACH(d, dirs, link) {
|
||||
if (strcmp(d->name, tabh[i].key_h->name_k) == 0)
|
||||
break;
|
||||
}
|
||||
if (!d) {
|
||||
report_error("internal error: could not find `%s'",
|
||||
tabh[i].key_h->name_k);
|
||||
break;
|
||||
}
|
||||
if (cpumode)
|
||||
fprintf(out, "{\"%s\",", d->name);
|
||||
else
|
||||
fprintf(out, "%s(\"%s\",", d->func, d->name);
|
||||
STAILQ_FOREACH(sv, &d->args, link) {
|
||||
fprintf(out, " %s", sv->str);
|
||||
if (STAILQ_NEXT(sv, link))
|
||||
fprintf(out, ",");
|
||||
}
|
||||
fprintf(out, cpumode ? "}" : ")");
|
||||
} else
|
||||
fprintf(out, " { NULL }");
|
||||
|
||||
if (i < nkeys-1)
|
||||
fprintf(out, ",");
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
fprintf(out, "};\n");
|
||||
|
||||
/* output the hash tab[] array */
|
||||
make_c_tab(out, which, parser, tab, smax, blen, scramble);
|
||||
|
||||
/* The hash function */
|
||||
fprintf(out, "#define tab %s_", which);
|
||||
if (parser)
|
||||
fprintf(out, "%s_", parser);
|
||||
fprintf(out, "tab\n");
|
||||
fprintf(out, "static const %s_parse_data *\n%s_", which, which);
|
||||
if (parser)
|
||||
fprintf(out, "%s_", parser);
|
||||
fprintf(out, "find(const char *key, size_t len)\n");
|
||||
fprintf(out, "{\n");
|
||||
fprintf(out, " const %s_parse_data *ret;\n", which);
|
||||
for (i=0; i<final.used; ++i)
|
||||
fprintf(out, final.line[i]);
|
||||
fprintf(out, " if (rsl >= %lu) return NULL;\n", nkeys);
|
||||
fprintf(out, " ret = &%s_", which);
|
||||
if (parser)
|
||||
fprintf(out, "%s_", parser);
|
||||
fprintf(out, "pd[rsl];\n");
|
||||
fprintf(out, " if (strcmp(key, ret->name) != 0) return NULL;\n");
|
||||
fprintf(out, " return ret;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "#undef tab\n\n");
|
||||
|
||||
free(tab);
|
||||
free(tabh);
|
||||
}
|
||||
|
||||
/* Get an entire "real" line from the input file by combining any
|
||||
* \\\n continuations.
|
||||
*/
|
||||
static int get_line(FILE *in)
|
||||
{
|
||||
char *p = line;
|
||||
cur_line = next_line;
|
||||
|
||||
if (feof(in))
|
||||
return 0;
|
||||
|
||||
while (p < &line[1023-128]) {
|
||||
if (!fgets(p, 128, in))
|
||||
return 1;
|
||||
next_line++;
|
||||
/* if continuation, strip out leading whitespace */
|
||||
if (p > line) {
|
||||
char *p2 = p;
|
||||
while (isspace(*p2)) p2++;
|
||||
if (p2 > p)
|
||||
memmove(p, p2, strlen(p2)+1);
|
||||
}
|
||||
while (*p) p++;
|
||||
if (p[-2] != '\\' || p[-1] != '\n') {
|
||||
if (p[-1] == '\n')
|
||||
p[-1] = '\0';
|
||||
return 1;
|
||||
}
|
||||
p -= 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct {
|
||||
const char *name;
|
||||
int indx;
|
||||
void (*handler) (void);
|
||||
} directives[] = {
|
||||
{"ARCH", ARCH, parse_arch},
|
||||
{"PARSERS", PARSERS, parse_parsers},
|
||||
{"INSN", INSN, parse_insn},
|
||||
{"CPU", CPU, parse_cpu},
|
||||
{"CPU_ALIAS", CPU_ALIAS, parse_cpu_alias},
|
||||
{"CPU_FEATURE", CPU_FEATURE, parse_cpu_feature},
|
||||
{"TARGETMOD", TARGETMOD, parse_targetmod},
|
||||
{"PREFIX", PREFIX, parse_prefix},
|
||||
{"REG", REG, parse_reg},
|
||||
{"REGGROUP", REGGROUP, parse_reggroup},
|
||||
{"SEGREG", SEGREG, parse_segreg},
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *in, *out;
|
||||
size_t i;
|
||||
char *tok;
|
||||
int count[NUM_DIRS];
|
||||
dir_byp *db;
|
||||
|
||||
for (i=0; i<NUM_DIRS; i++)
|
||||
count[i] = 0;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "Usage: gap <in> <out>\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
in = fopen(argv[1], "rt");
|
||||
if (!in) {
|
||||
fprintf(stderr, "Could not open `%s' for reading\n", argv[1]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
STAILQ_INIT(&insnprefix_byp);
|
||||
STAILQ_INIT(&cpu_byp);
|
||||
STAILQ_INIT(®tmod_byp);
|
||||
|
||||
/* Parse input file */
|
||||
while (get_line(in)) {
|
||||
int found;
|
||||
/*printf("%s\n", line);*/
|
||||
tok = strtok(line, " \t\n");
|
||||
if (!tok)
|
||||
continue;
|
||||
|
||||
/* Comments start with # as the first thing on a line */
|
||||
if (tok[0] == '#')
|
||||
continue;
|
||||
|
||||
/* Look for directive */
|
||||
found = 0;
|
||||
for (i=0; i<sizeof(directives)/sizeof(directives[0]); i++) {
|
||||
if (strcmp(tok, directives[i].name) == 0) {
|
||||
count[directives[i].indx]++;
|
||||
directives[i].handler();
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
report_error("unknown directive `%s'\n", tok);
|
||||
}
|
||||
|
||||
/* Output some informational statistics */
|
||||
printf("Directives read:\n");
|
||||
for (i=0; i<sizeof(directives)/sizeof(directives[0]); i++)
|
||||
printf("\t%d\t%s\n", count[directives[i].indx], directives[i].name);
|
||||
|
||||
if (errors > 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
out = fopen(argv[2], "wt");
|
||||
if (!out) {
|
||||
fprintf(stderr, "Could not open `%s' for writing\n", argv[2]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Get perfect hashes for the three lists of directives */
|
||||
STAILQ_FOREACH(db, &insnprefix_byp, link)
|
||||
perfect_dir(out, "insnprefix", db->parser, &db->dirs);
|
||||
STAILQ_FOREACH(db, &cpu_byp, link)
|
||||
perfect_dir(out, "cpu", db->parser, &db->dirs);
|
||||
STAILQ_FOREACH(db, ®tmod_byp, link)
|
||||
perfect_dir(out, "regtmod", db->parser, &db->dirs);
|
||||
|
||||
if (errors > 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
39
tools/genperf/Makefile.inc
Normal file
39
tools/genperf/Makefile.inc
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# $Id$
|
||||
|
||||
# These utility programs have to be built for BUILD host in cross-build.
|
||||
# This makes things rather non-standard automake
|
||||
|
||||
noinst_PROGRAMS += genperf
|
||||
|
||||
# Suffix rule for genperf
|
||||
SUFFIXES += .gperf
|
||||
.gperf.c: genperf$(EXEEXT)
|
||||
$(top_builddir)/genperf$(EXEEXT) $< $@
|
||||
|
||||
genperf_SOURCES =
|
||||
EXTRA_DIST += tools/genperf/genperf.c
|
||||
EXTRA_DIST += tools/genperf/perfect.c
|
||||
EXTRA_DIST += tools/genperf/perfect.h
|
||||
EXTRA_DIST += tools/genperf/standard.h
|
||||
genperf_LDADD = genperf.$(OBJEXT)
|
||||
genperf_LDADD += gp-perfect.$(OBJEXT)
|
||||
genperf_LDADD += gp-phash.$(OBJEXT)
|
||||
genperf_LDADD += gp-xmalloc.$(OBJEXT)
|
||||
genperf_LDADD += gp-xstrdup.$(OBJEXT)
|
||||
genperf_LINK = $(CCLD_FOR_BUILD) -o $@
|
||||
|
||||
genperf.$(OBJEXT): tools/genperf/genperf.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
|
||||
|
||||
gp-perfect.$(OBJEXT): tools/genperf/perfect.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
|
||||
|
||||
gp-phash.$(OBJEXT): libyasm/phash.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
|
||||
|
||||
gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
|
||||
|
||||
gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
|
||||
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
|
||||
|
||||
540
tools/genperf/genperf.c
Normal file
540
tools/genperf/genperf.c
Normal file
|
|
@ -0,0 +1,540 @@
|
|||
/* $Id$
|
||||
*
|
||||
* Generate Minimal Perfect Hash (genperf)
|
||||
*
|
||||
* Copyright (C) 2006-2007 Peter Johnson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "tools/genperf/perfect.h"
|
||||
#include "libyasm/compat-queue.h"
|
||||
#include "libyasm/coretype.h"
|
||||
#include "libyasm/errwarn.h"
|
||||
|
||||
typedef STAILQ_HEAD(slist, sval) slist;
|
||||
typedef struct sval {
|
||||
STAILQ_ENTRY(sval) link;
|
||||
char *str;
|
||||
} sval;
|
||||
|
||||
typedef STAILQ_HEAD(keyword_list, keyword) keyword_list;
|
||||
typedef struct keyword {
|
||||
STAILQ_ENTRY(keyword) link;
|
||||
char *name;
|
||||
char *args;
|
||||
unsigned int line;
|
||||
} keyword;
|
||||
|
||||
static unsigned int cur_line = 1;
|
||||
static int errors = 0;
|
||||
|
||||
static void
|
||||
report_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "%u: ", cur_line);
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
errors++;
|
||||
}
|
||||
|
||||
void
|
||||
yasm__fatal(const char *message, ...)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
/* make the c output for the perfect hash tab array */
|
||||
static void
|
||||
make_c_tab(
|
||||
FILE *f,
|
||||
bstuff *tab, /* table indexed by b */
|
||||
ub4 smax, /* range of scramble[] */
|
||||
ub4 blen, /* b in 0..blen-1, power of 2 */
|
||||
ub4 *scramble) /* used in final hash */
|
||||
{
|
||||
ub4 i;
|
||||
/* table for the mapping for the perfect hash */
|
||||
if (blen >= USE_SCRAMBLE) {
|
||||
/* A way to make the 1-byte values in tab bigger */
|
||||
if (smax > UB2MAXVAL+1) {
|
||||
fprintf(f, " static const unsigned long scramble[] = {\n");
|
||||
for (i=0; i<=UB1MAXVAL; i+=4)
|
||||
fprintf(f, " 0x%.8lx, 0x%.8lx, 0x%.8lx, 0x%.8lx,\n",
|
||||
scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3]);
|
||||
} else {
|
||||
fprintf(f, " static const unsigned short scramble[] = {\n");
|
||||
for (i=0; i<=UB1MAXVAL; i+=8)
|
||||
fprintf(f,
|
||||
" 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx, 0x%.4lx,\n",
|
||||
scramble[i+0], scramble[i+1], scramble[i+2], scramble[i+3],
|
||||
scramble[i+4], scramble[i+5], scramble[i+6], scramble[i+7]);
|
||||
}
|
||||
fprintf(f, " };\n");
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
if (blen > 0) {
|
||||
/* small adjustments to _a_ to make values distinct */
|
||||
if (smax <= UB1MAXVAL+1 || blen >= USE_SCRAMBLE)
|
||||
fprintf(f, " static const unsigned char ");
|
||||
else
|
||||
fprintf(f, " static const unsigned short ");
|
||||
fprintf(f, "tab[] = {\n");
|
||||
|
||||
if (blen < 16) {
|
||||
for (i=0; i<blen; ++i)
|
||||
fprintf(f, "%3ld,", scramble[tab[i].val_b]);
|
||||
} else if (blen <= 1024) {
|
||||
for (i=0; i<blen; i+=16)
|
||||
fprintf(f, " %ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,\n",
|
||||
scramble[tab[i+0].val_b], scramble[tab[i+1].val_b],
|
||||
scramble[tab[i+2].val_b], scramble[tab[i+3].val_b],
|
||||
scramble[tab[i+4].val_b], scramble[tab[i+5].val_b],
|
||||
scramble[tab[i+6].val_b], scramble[tab[i+7].val_b],
|
||||
scramble[tab[i+8].val_b], scramble[tab[i+9].val_b],
|
||||
scramble[tab[i+10].val_b], scramble[tab[i+11].val_b],
|
||||
scramble[tab[i+12].val_b], scramble[tab[i+13].val_b],
|
||||
scramble[tab[i+14].val_b], scramble[tab[i+15].val_b]);
|
||||
} else if (blen < USE_SCRAMBLE) {
|
||||
for (i=0; i<blen; i+=8)
|
||||
fprintf(f, " %ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,\n",
|
||||
scramble[tab[i+0].val_b], scramble[tab[i+1].val_b],
|
||||
scramble[tab[i+2].val_b], scramble[tab[i+3].val_b],
|
||||
scramble[tab[i+4].val_b], scramble[tab[i+5].val_b],
|
||||
scramble[tab[i+6].val_b], scramble[tab[i+7].val_b]);
|
||||
} else {
|
||||
for (i=0; i<blen; i+=16)
|
||||
fprintf(f, " %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n",
|
||||
tab[i+0].val_b, tab[i+1].val_b,
|
||||
tab[i+2].val_b, tab[i+3].val_b,
|
||||
tab[i+4].val_b, tab[i+5].val_b,
|
||||
tab[i+6].val_b, tab[i+7].val_b,
|
||||
tab[i+8].val_b, tab[i+9].val_b,
|
||||
tab[i+10].val_b, tab[i+11].val_b,
|
||||
tab[i+12].val_b, tab[i+13].val_b,
|
||||
tab[i+14].val_b, tab[i+15].val_b);
|
||||
}
|
||||
fprintf(f, " };\n");
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
perfect_gen(FILE *out, const char *lookup_function_name,
|
||||
const char *struct_name, keyword_list *kws,
|
||||
const char *filename)
|
||||
{
|
||||
ub4 nkeys;
|
||||
key *keys;
|
||||
hashform form;
|
||||
bstuff *tab; /* table indexed by b */
|
||||
hstuff *tabh; /* table indexed by hash value */
|
||||
ub4 smax; /* scramble[] values in 0..smax-1, a power of 2 */
|
||||
ub4 alen; /* a in 0..alen-1, a power of 2 */
|
||||
ub4 blen; /* b in 0..blen-1, a power of 2 */
|
||||
ub4 salt; /* a parameter to the hash function */
|
||||
gencode final; /* code for final hash */
|
||||
ub4 i;
|
||||
ub4 scramble[SCRAMBLE_LEN]; /* used in final hash function */
|
||||
char buf[10][80]; /* buffer for generated code */
|
||||
char *buf2[10]; /* also for generated code */
|
||||
keyword *kw;
|
||||
|
||||
/* perfect hash configuration */
|
||||
form.mode = NORMAL_HM;
|
||||
form.hashtype = STRING_HT;
|
||||
form.perfect = MINIMAL_HP;
|
||||
form.speed = SLOW_HS;
|
||||
|
||||
/* set up code for final hash */
|
||||
final.line = buf2;
|
||||
final.used = 0;
|
||||
final.len = 10;
|
||||
for (i=0; i<10; i++)
|
||||
final.line[i] = buf[i];
|
||||
|
||||
/* build list of keys */
|
||||
nkeys = 0;
|
||||
keys = NULL;
|
||||
STAILQ_FOREACH(kw, kws, link) {
|
||||
key *k = yasm_xmalloc(sizeof(key));
|
||||
|
||||
k->name_k = yasm__xstrdup(kw->name);
|
||||
k->len_k = (ub4)strlen(kw->name);
|
||||
k->next_k = keys;
|
||||
keys = k;
|
||||
nkeys++;
|
||||
}
|
||||
|
||||
/* find the hash */
|
||||
findhash(&tab, &tabh, &alen, &blen, &salt, &final,
|
||||
scramble, &smax, keys, nkeys, &form);
|
||||
|
||||
/* The hash function beginning */
|
||||
fprintf(out, "static const struct %s *\n", struct_name);
|
||||
fprintf(out, "%s(const char *key, size_t len)\n", lookup_function_name);
|
||||
fprintf(out, "{\n");
|
||||
|
||||
/* output the dir table: this should loop up to smax for NORMAL_HP,
|
||||
* or up to pakd.nkeys for MINIMAL_HP.
|
||||
*/
|
||||
fprintf(out, " static const struct %s pd[%lu] = {\n", struct_name, nkeys);
|
||||
for (i=0; i<nkeys; i++) {
|
||||
if (tabh[i].key_h) {
|
||||
STAILQ_FOREACH(kw, kws, link) {
|
||||
if (strcmp(kw->name, tabh[i].key_h->name_k) == 0)
|
||||
break;
|
||||
}
|
||||
if (!kw) {
|
||||
report_error("internal error: could not find `%s'",
|
||||
tabh[i].key_h->name_k);
|
||||
break;
|
||||
}
|
||||
fprintf(out, "#line %u \"%s\"\n", kw->line, filename);
|
||||
fprintf(out, " {\"%s\"%s}", kw->name, kw->args);
|
||||
} else
|
||||
fprintf(out, " { NULL }");
|
||||
|
||||
if (i < nkeys-1)
|
||||
fprintf(out, ",");
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
fprintf(out, " };\n");
|
||||
|
||||
/* output the hash tab[] array */
|
||||
make_c_tab(out, tab, smax, blen, scramble);
|
||||
|
||||
/* The hash function body */
|
||||
fprintf(out, " const struct %s *ret;\n", struct_name);
|
||||
for (i=0; i<final.used; ++i)
|
||||
fprintf(out, final.line[i]);
|
||||
fprintf(out, " if (rsl >= %lu) return NULL;\n", nkeys);
|
||||
fprintf(out, " ret = &pd[rsl];\n");
|
||||
fprintf(out, " if (strcmp(key, ret->name) != 0) return NULL;\n");
|
||||
fprintf(out, " return ret;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "\n");
|
||||
|
||||
free(tab);
|
||||
free(tabh);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *in, *out;
|
||||
size_t i;
|
||||
char *ch;
|
||||
static char line[1024], tmp[1024];
|
||||
static char struct_name[128] = "";
|
||||
static char lookup_function_name[128] = "in_word_set";
|
||||
static char language[16] = "";
|
||||
static char delimiters[16] = ",\r\n";
|
||||
static char name[128];
|
||||
static char filename[768];
|
||||
int need_struct = 0;
|
||||
int have_struct = 0;
|
||||
int go_keywords = 0;
|
||||
int ignore_case = 0;
|
||||
int compare_strncmp = 0;
|
||||
int readonly_tables = 0;
|
||||
slist usercode, usercode2;
|
||||
keyword_list keywords;
|
||||
sval *sv;
|
||||
keyword *kw;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "Usage: genperf <in> <out>\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
in = fopen(argv[1], "rt");
|
||||
if (!in) {
|
||||
fprintf(stderr, "Could not open `%s' for reading\n", argv[1]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
ch = argv[1];
|
||||
i = 0;
|
||||
while (*ch && i < 767) {
|
||||
if (*ch == '\\') {
|
||||
filename[i++] = '/';
|
||||
ch++;
|
||||
} else
|
||||
filename[i++] = *ch++;
|
||||
}
|
||||
filename[i] = '\0';
|
||||
|
||||
STAILQ_INIT(&usercode);
|
||||
STAILQ_INIT(&usercode2);
|
||||
STAILQ_INIT(&keywords);
|
||||
|
||||
/* Parse declarations section */
|
||||
while (fgets(line, 1024, in)) {
|
||||
/* Comments start with # as the first thing on a line */
|
||||
if (line[0] == '#') {
|
||||
cur_line++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Handle structure declaration */
|
||||
if (strncmp(line, "struct", 6) == 0) {
|
||||
int braces;
|
||||
|
||||
if (!need_struct) {
|
||||
report_error("struct without %%struct-type declaration");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (have_struct) {
|
||||
report_error("more than one struct declaration");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
have_struct = 1;
|
||||
|
||||
/* copy struct name */
|
||||
ch = &line[6];
|
||||
while (isspace(*ch))
|
||||
ch++;
|
||||
i = 0;
|
||||
while ((isalnum(*ch) || *ch == '_') && i < 127)
|
||||
struct_name[i++] = *ch++;
|
||||
if (i == 127) {
|
||||
report_error("struct name too long");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
struct_name[i] = '\0';
|
||||
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sprintf(tmp, "#line %u \"%s\"\n", cur_line, filename);
|
||||
sv->str = yasm__xstrdup(tmp);
|
||||
STAILQ_INSERT_TAIL(&usercode, sv, link);
|
||||
|
||||
braces = 0;
|
||||
do {
|
||||
/* count braces to determine when we're done */
|
||||
ch = line;
|
||||
while (*ch != '\0') {
|
||||
if (*ch == '{')
|
||||
braces++;
|
||||
if (*ch == '}')
|
||||
braces--;
|
||||
ch++;
|
||||
}
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup(line);
|
||||
STAILQ_INSERT_TAIL(&usercode, sv, link);
|
||||
cur_line++;
|
||||
if (braces <= 0)
|
||||
break;
|
||||
} while (fgets(line, 1024, in));
|
||||
cur_line++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Ignore non-declaration lines */
|
||||
if (line[0] != '%') {
|
||||
cur_line++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* %% terminates declarations section */
|
||||
if (line[1] == '%') {
|
||||
if (need_struct && !have_struct) {
|
||||
report_error("%%struct-type declaration, but no struct found");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
go_keywords = 1;
|
||||
break; /* move on to keywords section */
|
||||
}
|
||||
|
||||
/* %{ begins a verbatim code section that ends with %} */
|
||||
if (line[1] == '{') {
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sprintf(tmp, "#line %u \"%s\"\n\n", cur_line, filename);
|
||||
sv->str = yasm__xstrdup(tmp);
|
||||
STAILQ_INSERT_TAIL(&usercode, sv, link);
|
||||
|
||||
while (fgets(line, 1024, in)) {
|
||||
cur_line++;
|
||||
if (line[0] == '%' && line[1] == '}')
|
||||
break;
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup(line);
|
||||
STAILQ_INSERT_TAIL(&usercode, sv, link);
|
||||
}
|
||||
cur_line++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp(&line[1], "ignore-case", 11) == 0) {
|
||||
ignore_case = 1;
|
||||
} else if (strncmp(&line[1], "compare-strncmp", 15) == 0) {
|
||||
compare_strncmp = 1;
|
||||
} else if (strncmp(&line[1], "readonly-tables", 15) == 0) {
|
||||
readonly_tables = 1;
|
||||
} else if (strncmp(&line[1], "language=", 9) == 0) {
|
||||
ch = &line[10];
|
||||
i = 0;
|
||||
while (*ch != '\n' && i<15)
|
||||
language[i++] = *ch++;
|
||||
language[i] = '\0';
|
||||
} else if (strncmp(&line[1], "delimiters=", 11) == 0) {
|
||||
ch = &line[12];
|
||||
i = 0;
|
||||
while (i<15)
|
||||
delimiters[i++] = *ch++;
|
||||
delimiters[i] = '\0';
|
||||
} else if (strncmp(&line[1], "enum", 4) == 0) {
|
||||
/* unused */
|
||||
} else if (strncmp(&line[1], "struct-type", 11) == 0) {
|
||||
need_struct = 1;
|
||||
} else if (strncmp(&line[1], "define", 6) == 0) {
|
||||
/* Several different defines we need to handle */
|
||||
ch = &line[7];
|
||||
while (isspace(*ch))
|
||||
ch++;
|
||||
|
||||
if (strncmp(ch, "hash-function-name", 18) == 0) {
|
||||
/* unused */
|
||||
} else if (strncmp(ch, "lookup-function-name", 20) == 0) {
|
||||
ch = &line[7+20+1];
|
||||
while (isspace(*ch))
|
||||
ch++;
|
||||
i = 0;
|
||||
while ((isalnum(*ch) || *ch == '_') && i < 127)
|
||||
lookup_function_name[i++] = *ch++;
|
||||
if (i == 127) {
|
||||
report_error("struct name too long");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
lookup_function_name[i] = '\0';
|
||||
} else {
|
||||
fprintf(stderr, "%u: unrecognized define `%s'\n", cur_line,
|
||||
line);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%u: unrecognized declaration `%s'\n", cur_line,
|
||||
line);
|
||||
}
|
||||
|
||||
cur_line++;
|
||||
}
|
||||
|
||||
if (!go_keywords) {
|
||||
report_error("no keywords section found");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Parse keywords section */
|
||||
while (fgets(line, 1024, in)) {
|
||||
char *d;
|
||||
|
||||
/* Comments start with # as the first thing on a line */
|
||||
if (line[0] == '#') {
|
||||
cur_line++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Keywords section terminated with %% */
|
||||
if (line[0] == '%' && line[1] == '%')
|
||||
break;
|
||||
|
||||
/* Look for name */
|
||||
ch = &line[0];
|
||||
i = 0;
|
||||
while (strchr(delimiters, *ch) == NULL && i < 127)
|
||||
name[i++] = *ch++;
|
||||
if (i == 127) {
|
||||
report_error("keyword name too long");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
name[i] = '\0';
|
||||
|
||||
/* Strip EOL */
|
||||
d = strrchr(ch, '\n');
|
||||
if (d)
|
||||
*d = '\0';
|
||||
d = strrchr(ch, '\r');
|
||||
if (d)
|
||||
*d = '\0';
|
||||
kw = yasm_xmalloc(sizeof(keyword));
|
||||
kw->name = yasm__xstrdup(name);
|
||||
kw->args = yasm__xstrdup(ch);
|
||||
kw->line = cur_line;
|
||||
STAILQ_INSERT_TAIL(&keywords, kw, link);
|
||||
cur_line++;
|
||||
}
|
||||
|
||||
if (errors > 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
/* Pull in any end code */
|
||||
if (!feof(in)) {
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sprintf(tmp, "#line %u \"%s\"\n\n", cur_line, filename);
|
||||
sv->str = yasm__xstrdup(tmp);
|
||||
STAILQ_INSERT_TAIL(&usercode2, sv, link);
|
||||
|
||||
while (fgets(line, 1024, in)) {
|
||||
sv = yasm_xmalloc(sizeof(sval));
|
||||
sv->str = yasm__xstrdup(line);
|
||||
STAILQ_INSERT_TAIL(&usercode2, sv, link);
|
||||
}
|
||||
}
|
||||
|
||||
/* output code */
|
||||
out = fopen(argv[2], "wt");
|
||||
if (!out) {
|
||||
fprintf(stderr, "Could not open `%s' for writing\n", argv[2]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
fprintf(out, "/* %s code produced by genperf */\n", language);
|
||||
fprintf(out, "/* Command-line: genperf %s %s */\n", argv[1], argv[2]);
|
||||
|
||||
STAILQ_FOREACH(sv, &usercode, link)
|
||||
fprintf(out, "%s", sv->str);
|
||||
|
||||
/* Get perfect hash */
|
||||
perfect_gen(out, lookup_function_name, struct_name, &keywords, filename);
|
||||
|
||||
STAILQ_FOREACH(sv, &usercode2, link)
|
||||
fprintf(out, "%s", sv->str);
|
||||
|
||||
fclose(out);
|
||||
|
||||
if (errors > 0) {
|
||||
remove(argv[2]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -50,10 +50,10 @@ determined a perfect hash for the whole set of keys.
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "tools/gap/standard.h"
|
||||
#include "tools/genperf/standard.h"
|
||||
#include "libyasm/coretype.h"
|
||||
#include "libyasm/phash.h"
|
||||
#include "tools/gap/perfect.h"
|
||||
#include "tools/genperf/perfect.h"
|
||||
|
||||
#define CHECKSTATE 8
|
||||
|
||||
|
|
@ -565,7 +565,7 @@ static int perfect(
|
|||
if (!augment(tabb, tabh, tabq, blen, scramble, smax, &tabb[i], nkeys,
|
||||
i+1, form))
|
||||
{
|
||||
printf("fail to map group of size %ld for tab size %ld\n", j, blen);
|
||||
fprintf(stderr, "fail to map group of size %ld for tab size %ld\n", j, blen);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -631,7 +631,7 @@ static void hash_ab(
|
|||
{
|
||||
if (form->perfect == MINIMAL_HP)
|
||||
{
|
||||
printf("fatal error: Cannot find perfect hash for user (A,B) pairs\n");
|
||||
fprintf(stderr, "fatal error: Cannot find perfect hash for user (A,B) pairs\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
|
|
@ -644,7 +644,7 @@ static void hash_ab(
|
|||
nkeys : *smax));
|
||||
if (!perfect(*tabb, tabh, tabq, *blen, *smax, scramble, nkeys, form))
|
||||
{
|
||||
printf("fatal error: Cannot find perfect hash for user (A,B) pairs\n");
|
||||
fprintf(stderr, "fatal error: Cannot find perfect hash for user (A,B) pairs\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
@ -894,7 +894,7 @@ void findhash(
|
|||
else
|
||||
{
|
||||
duplicates(*tabb, *blen, keys, form); /* check for duplicates */
|
||||
printf("fatal error: Cannot perfect hash: cannot find distinct (A,B)\n");
|
||||
fprintf(stderr, "fatal error: Cannot perfect hash: cannot find distinct (A,B)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
bad_initkey = 0;
|
||||
|
|
@ -922,7 +922,7 @@ void findhash(
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("fatal error: Cannot perfect hash: cannot build tab[]\n");
|
||||
fprintf(stderr, "fatal error: Cannot perfect hash: cannot build tab[]\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
bad_perfect = 0;
|
||||
|
|
@ -20,7 +20,7 @@ EXTRA_DIST += tools/python-yasm/setup.py
|
|||
EXTRA_DIST += tools/python-yasm/yasm.pyx
|
||||
EXTRA_DIST += $(PYBINDING_DEPS)
|
||||
|
||||
if HAVE_PYTHON
|
||||
if HAVE_PYTHON_BINDINGS
|
||||
|
||||
# Use Pyxelator to generate Pyrex function headers.
|
||||
_yasm.pxi: ${HEADERS}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ def mk_tao(CPPFLAGS = "", CPP = "gcc -E", modname = '_yasm', oname = None, YASM_
|
|||
CPPFLAGS += " -DYASM_LIB_INTERNAL"
|
||||
CPPFLAGS += " -DYASM_BC_INTERNAL"
|
||||
CPPFLAGS += " -DYASM_EXPR_INTERNAL"
|
||||
files = [ 'libyasm.h', 'libyasm/assocdat.h' ]
|
||||
files = [ 'libyasm.h', 'libyasm/assocdat.h', 'libyasm/bitvect.h' ]
|
||||
|
||||
syms = get_syms( ['yasm'], [YASM_DIR] )
|
||||
def cb(trans_unit, node, *args):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ EXTRA_DIST += tools/python-yasm/tests/test_expr.py
|
|||
EXTRA_DIST += tools/python-yasm/tests/test_intnum.py
|
||||
EXTRA_DIST += tools/python-yasm/tests/test_symrec.py
|
||||
|
||||
if HAVE_PYTHON
|
||||
if HAVE_PYTHON_BINDINGS
|
||||
|
||||
TESTS_ENVIRONMENT += PYTHON=${PYTHON}
|
||||
TESTS += tools/python-yasm/tests/python_test.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue