龙芯平台指令集简介及现有处理器的支持特性

LoongISA里包括MIPS部分指令集,其中有MIPS64 Release 2全套指令集和MIPS64 Release 5中的MSA向量指令模块、DSP指令模块和VZ虚拟化指令模块。
LoongISA 1.0的浮点遵守IEEE754-1989标准,使用Legacy NaN的QNaN/SNaN定义。但是其MADD指令则按IEEE754-2008的Fused MADD标准实现,与MIPS64 Release2不同。
LoongISA 2.0则全部遵循IEEE754-2008标准,使用IEEE754-2008规定的NaN2008的QNaN/SNaN定义,依照MIPS64 Release5实现浮点运算单元。
LoongMMI(简称MMl)指令集是龙芯多媒体扩展指令集(MMI即为MultiMedialnstruction的缩写)。用于多媒体加速,现已用于龙芯的ffmpeg媒体编解码库中,gcc社区也支持了此指令集的优化选项。MMI指令集对于多媒体编解码的性能是成倍地提升。
LoongEXT(简称LEXT)是龙芯通用扩展指令集。LoongEXT现在最新版为3.0,按照指令长度分LoongEXT32和LoongEXT64两种类别。LoongEXT指令集已提交了对gcc社区的支持,可在编译中选用此指令集的优化选项。
LoongVZ(简称LVZP)是龙芯针对MIPS64 Release 5中的VZ虚拟化模块指令集的扩展,现已在龙芯中科的KVM、QEMU和libvirt库中有所运用。

一、编译参数

  1. 指定cpu 类型 -march=loongson3a, gs464, gs464e, gs264e
  2. 使用优化参数 -O2 或 -O3
  3. 如果需要编译mips64r2 n64的目标文件: 添加参数"-mips64r2 -mabi=64".
  4. 指令集 msa :-mmsa
  5. 指令集 msa2 :-mmsa2
  6. 指令集 mipsfpu :-mmipsfpu
  7. 指令集 Loongson MMI :-mloongson-mmi
  8. 指令集 Loongson CAM :-mloongson-cam
  9. 指令集 Loongson EXT :-mloongson-ext
  10. 指令集 Loongson EXT2 :-mloongson-ext2
  11. 指令集 Loongson EXT3 :-mloongson-ext3
  12. 指令集 Loongson AMO :-mloongson-amo
  13. 指令集 Loongson CSR :-mmloongson-csr

指令集说明:

virt            Recognize the virtualization ASE instructions.

loongson-mmi    Recognize the Loongson MultiMedia extensions Instructions (MMI) ASE instructions.

loongson-cam    Recognize the Loongson Content Address Memory (CAM) instructions.

loongson-ext    Recognize the Loongson EXTensions (EXT) instructions.

loongson-ext2   Recognize the Loongson EXTensions R2 (EXT2) instructions.

loongson-ext3   Recognize the Loongson EXTend R3 (EXT3) ASE instructions.

loongson-amo    Recognize the Loongson Atomic Memory Operation (AMO) ASE instructions.

loongson-csr    Recognize the Loongson Ctrl Status Register (CSR) ASE instructions.

gpr-names=ABI   Print GPR names according to  specified ABI.Default: based on binary being disassembled.

fpr-names=ABI   Print FPR names according to specified ABI. Default: numeric.

cp0-names=ARCH  Print CP0 register names according to specified architecture. Default: based on binary being disassembled.

hwr-names=ARCH  Print HWR names according to specified architecture. Default: based on binary being disassembled.

reg-names=ABI   Print GPR and FPR names according to specified ABI.

reg-names=ARCH  Print CP0 register and HWR names according to specified architecture.

说明:

binutils 2.32 开始支持 mmi, ext, ext2, cam 等指令集。

使用龙芯维护的binutils 2.24 ,所有指令集均支持, msa2 的gcc 内置函数,目前只有龙芯自已维护的编译器支持。

二、查找热点函数进行代码优化

在x86平台使用intel vtune 进行热点函数分析,在龙芯平台使用Oprofile 进行热点函数分析,采用汇编对热点函数进行重写。使用时汇编时根据应用特点使用相应的加速指令。

或者采用 perf top -p pid 来查看热点函数。

目前龙芯全面支持MIPS64R2,其他扩展指令见下表:

处理器

IP CORE

MMI

CAM

EXT

EXT2

EXT3

mipsfpu

MSA

MSA2

AMO

CSR

LS2K1000

gs264e

 

 

 

 

LS3A1000

LS3B1500

gs464

 

 

 

 

 

 

 

LS3A2000

gs464e

 

 

 

 

 

LS3A3000

gs464e

 

 

 

 

 

LS3A4000

gs464v

 

 

 

 

 

 

 

参考链接:

http://www.loongnix.org/index.php/Cross-compile

http://cgit.loongnix.org/cgit/binutils-2.24/

https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/5c806d5b54a7a261569b4d3c2053a321dcf4445f

https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/a45e8ade2d2d46fde48ee0567ab18e23dc8c71d1

https://www.phoronix.com/scan.php?page=news_item&px=GNU-Binutils-2.32-Branched

 

 

你可能感兴趣的:(龙芯)