龍芯平臺指令集簡介及現有處理器的支持特性

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

 

 

發佈了35 篇原創文章 · 獲贊 5 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章