daily update on 20230320 by nitload youmu
This commit is contained in:
@@ -1,15 +1,69 @@
|
||||
.386 ; 编译器指令,使用386指令集
|
||||
.model flat, stdcall ; model汇编指令,程序的内存模式, flat是windows程序,没有远近指针,stdcall是windows函数用的参数方式,即参数从右向左传递
|
||||
option casemap :none ; 标签是否区分大小写
|
||||
include \masm32\include\windows.inc ; 包含了Win32 API 的一些常量和函数定义
|
||||
include \masm32\include\kernel32.inc ; 包含了后面使用的ExitProcess函数
|
||||
include \masm32\include\masm32.inc ; 包含了后面使用的StdOut函数,不是标准的Win32函数,由MASM提供
|
||||
includelib \masm32\lib\kernel32.lib ; 库文件
|
||||
includelib \masm32\lib\masm32.lib
|
||||
.data
|
||||
HelloWorld db "Hello World!", 0 ; 定义使用的字符串常量,db代表define byte。最后跟一个NUL,表示ANSI字符集结束符
|
||||
.code ; 开始代码区
|
||||
start: ; 所有的代码要在start标签后、end start前
|
||||
invoke StdOut, addr HelloWorld ; 调用函数StdOut,参数量HelloWorld的地址。注意StdOut是MASM提供的宏。其它编辑器里可以使用WriteConsole之类win32函数代替。
|
||||
invoke ExitProcess, 0 ; 调用ExitProcess
|
||||
end start
|
||||
; Attributes: bp-based frame fpd=1A0h
|
||||
|
||||
; int main(...)
|
||||
main proc near
|
||||
|
||||
frame= byte ptr -1C0h
|
||||
var_1A0= byte ptr -1A0h
|
||||
var_19C= dword ptr -19Ch
|
||||
var_178= dword ptr -178h
|
||||
var_148= qword ptr -148h
|
||||
var_120= xmmword ptr -120h
|
||||
var_F0= xmmword ptr -0F0h
|
||||
var_18= qword ptr -18h
|
||||
|
||||
; __unwind { // j___GSHandlerCheck
|
||||
push rbp
|
||||
push rdi
|
||||
sub rsp, 1B8h
|
||||
lea rbp, [rsp+20h]
|
||||
|
||||
__$EncStackInitStart:
|
||||
lea rdi, [rsp+1C0h+var_1A0]
|
||||
mov ecx, 36h ; '6'
|
||||
mov eax, 0CCCCCCCCh
|
||||
rep stosd
|
||||
|
||||
__$EncStackInitEnd:
|
||||
mov rax, cs:__security_cookie
|
||||
xor rax, rbp
|
||||
mov [rbp+1A0h+var_18], rax
|
||||
lea rcx, __41B3B322_AsmSqrt@c ; JMC_flag
|
||||
call j___CheckForDebuggerJustMyCode
|
||||
movss xmm0, cs:__real@40800000
|
||||
movss [rbp+1A0h+var_19C], xmm0
|
||||
lea rax, [rbp+1A0h+var_19C]
|
||||
mov [rbp+1A0h+var_148], rax
|
||||
mov rax, [rbp+1A0h+var_148]
|
||||
movss xmm0, dword ptr [rax]
|
||||
xorps xmm1, xmm1
|
||||
movss xmm1, xmm0
|
||||
movaps xmm0, xmm1
|
||||
movaps [rbp+1A0h+var_120], xmm0
|
||||
movaps xmm0, [rbp+1A0h+var_120]
|
||||
sqrtss xmm0, xmm0
|
||||
movaps [rbp+1A0h+var_F0], xmm0
|
||||
movaps xmm0, [rbp+1A0h+var_F0]
|
||||
movss [rbp+1A0h+var_178], xmm0
|
||||
mov eax, 4
|
||||
imul rax, 0
|
||||
cvtss2sd xmm0, [rbp+rax+1A0h+var_178]
|
||||
movaps xmm1, xmm0
|
||||
movq rdx, xmm1
|
||||
lea rcx, _Format ; "%f"
|
||||
call j_printf
|
||||
xor eax, eax
|
||||
mov edi, eax
|
||||
lea rcx, [rbp+1A0h+frame] ; frame
|
||||
lea rdx, v ; v
|
||||
call j__RTC_CheckStackVars
|
||||
mov eax, edi
|
||||
mov rcx, [rbp+1A0h+var_18]
|
||||
xor rcx, rbp ; StackCookie
|
||||
call j___security_check_cookie
|
||||
lea rsp, [rbp+198h]
|
||||
pop rdi
|
||||
pop rbp
|
||||
retn
|
||||
; } // starts at 140011870
|
||||
main endp
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32825.248
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{9C0FD617-CD38-48B5-A16C-909FBA56BBF5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project2", "Project2\Project2.vcxproj", "{3575C925-9280-4453-8D67-2BFD4E76A1D8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -21,6 +23,14 @@ Global
|
||||
{9C0FD617-CD38-48B5-A16C-909FBA56BBF5}.Release|x64.Build.0 = Release|x64
|
||||
{9C0FD617-CD38-48B5-A16C-909FBA56BBF5}.Release|x86.ActiveCfg = Release|Win32
|
||||
{9C0FD617-CD38-48B5-A16C-909FBA56BBF5}.Release|x86.Build.0 = Release|Win32
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Debug|x64.Build.0 = Debug|x64
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Debug|x86.Build.0 = Debug|Win32
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Release|x64.ActiveCfg = Release|x64
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Release|x64.Build.0 = Release|x64
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Release|x86.ActiveCfg = Release|Win32
|
||||
{3575C925-9280-4453-8D67-2BFD4E76A1D8}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -5,27 +5,43 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
float a = sseSqrt(4.0f);
|
||||
|
||||
int b = (int)a;
|
||||
/*
|
||||
float z = 4.00f;
|
||||
float* a = &z;
|
||||
float b = sseSqrt(z);
|
||||
|
||||
printf(b);
|
||||
}
|
||||
printf("%f", b);
|
||||
|
||||
/**/
|
||||
|
||||
float sseSqrt(float x)
|
||||
{
|
||||
|
||||
float* pa = &x;
|
||||
float result[4];
|
||||
|
||||
float a = 4.0f;
|
||||
float r[4];
|
||||
float* pa = &a;
|
||||
|
||||
__m128 b;
|
||||
__m128 c;
|
||||
|
||||
b = _mm_load_ss(pa);
|
||||
c = _mm_sqrt_ss(b);
|
||||
_mm_store_ss(r, c);
|
||||
|
||||
printf("%f", r[0]);
|
||||
/**/
|
||||
}
|
||||
|
||||
/*
|
||||
float sseSqrt(float x)
|
||||
{
|
||||
float* a = &x;
|
||||
float result[4];
|
||||
|
||||
__m128 b = _mm_load_ss(a);
|
||||
__m128 c = _mm_sqrt_ss(b);
|
||||
|
||||
_mm_store_ss(result, c);
|
||||
|
||||
return result[3];
|
||||
}
|
||||
return result[0];
|
||||
}
|
||||
/**/
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,2 @@
|
||||
AsmSqrt.c
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\Project1\AsmSqrt.c(8,12): warning C4013: “sseSqrt”未定义;假设外部返回 int
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\Project1\AsmSqrt.c(12,10): warning C4047: “函数”:“const char *const ”与“int”的间接级别不同
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\Project1\AsmSqrt.c(12,9): warning C4024: “printf”: 形参和实参 1 的类型不同
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\Project1\AsmSqrt.c(8,12): warning C4244: “初始化”: 从“int”转换到“float”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\Project1\AsmSqrt.c(17,1): warning C4142: "sseSqrt": 类型的良性重定义
|
||||
MSVCRTD.lib(exe_main.obj) : error LNK2019: 无法解析的外部符号 main,函数 "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 中引用了该符号
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\x64\Debug\Project1.exe : fatal error LNK1120: 1 个无法解析的外部命令
|
||||
Project1.vcxproj -> D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\Math\C\Project1\x64\Debug\Project1.exe
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{3575c925-9280-4453-8d67-2bfd4e76a1d8}</ProjectGuid>
|
||||
<RootNamespace>Project2</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="源.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="源.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
#include<stdio.h>
|
||||
#include <xmmintrin.h>
|
||||
#include <immintrin.h>
|
||||
#include <intrin.h>
|
||||
|
||||
void main()
|
||||
{
|
||||
float a = 4.00f;
|
||||
float* pa = &a;
|
||||
|
||||
_asm
|
||||
(
|
||||
MOVSS xmm1,%0
|
||||
|
||||
);
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user