Presentation is loading. Please wait.

Presentation is loading. Please wait.

ARM Architecture & NEON

Similar presentations


Presentation on theme: "ARM Architecture & NEON"— Presentation transcript:

1 ARM Architecture & NEON
Bo-Jyu Lee

2 Outline Introduction NEON Instruction VFP Instruction
ARM Cortex-A9 Processor Microarchitecture Cortex-A9 MPCore Multicore Structure NEON Instruction VFP Instruction

3 Introduction ARM features All instructions are 32 bits long.
Most instructions execute in a single cycle. Every instruction can be conditionally executed. A load/store architecture Data processing instructions act only on registers Combined ALU and shifter for high speed bit manipulation Instruction set extension via coprocessors

4 Cortex-A9 Processor Microarchitecture
Introduces out-of-order instruction issue and completion Register renaming to enable execution speculation Non-blocking memory system with load-store forwarding Fast loop mode in instruction prefetch to lower power consumption

5 Cortex-A9 MPCore Multicore Structure
ARM architecture

6 Floating Point Performance
Million Floating-point Operations per Second

7 ARM Architecture Evolution
Million Floating-point Operations per Second

8 What is NEON? NEON is a wide SIMD data processing architecture
Extension of the ARM instruction set 32 registers, 64-bits wide (dual view as 16 registers, 128-bits wide) NEON Instructions perform Packed SIMD processing Registers are considered as vectors of elements of the same data type Data types can be: signed/unsigned 8-bit, 16-bit, 32-bit, 64-bit, single prec. Float Instructions perform the same operation in all lanes

9 Registers NEON provides a 256-byte register file
Distinct from the core registers Extension to the VFPv2 register file (VFPv3) Two explicitly aliased views 32 x 64-bit registers (D0-D31) 16 x 128-bit registers (Q0-Q15) Enables register trade-off Vector length Available registers Also uses the summary flags in the VFP FPSCR Adds a QC integer saturation summary flag No per-lane flags, so ‘carry’ handled using wider result (16bit+16bit -> 32-bit)

10 Vectors and Scalars Registers hold one or more elements of the same data type Vn can be used to reference either a 64-bit Dn or 128-bit Qn register A register, data type combination describes a vector of elements Some instructions can reference individual scalar elements Scalar elements are referenced using the array notation Vn[x] Array ordering is always from the least significant bit

11 ARM RVDS & gcc vectorising compiler

12 Many different levels of parallelism
Multi-issue parallelism NEON SIMD parallelism Multi-core parallelism

13 NEON logical and compare operations
VAND, VBIC, VEOR, VORN, and VORR VBIC: Specific bits cleared to 0 Syntax: Vop{cond}{.datatype} {Qd}, Qn, Qm Vop{cond}{.datatype} {Dd}, Dn, Dm VBIC and VORR both have immediate version Vop{cond}.datatype Qd, #imm Vop{cond}.datatype Dd, #imm Quadword operation or Doubleword operation VORR with the same register for both operands is a VMOV instruction. Vop{cond}{.datatype} {Qd}, Qn, Qm Vop{cond}{.datatype} {Dd}, Dn, Dm Vop{cond}.datatype Qd, #imm Vop{cond}.datatype Dd, #imm op must be either BIC or ORR. cond is an optional condition code. datatype must be either I8, I16, I32, or I64. Qd or Dd is the NEON register for the source and result. imm is the immediate value.

14 NEON logical and compare operations
VMOV,VMVN(register) Vector Move (register) copies a value from the source register into the destination register. Vector Move Not (register) inverts the value of each bit from the source register and places the results into the destination register. Syntax: VopV{cond}{.datatype} Qd, Qm VopV{cond}{.datatype} Dd, Dm

15 NEON logical and compare operations
VACGE and VACGT Vector Absolute Compare takes the absolute value of each element in a vector, and compares it with the absolute value of the corresponding element of a second vector. If the condition is true, the corresponding element in the destination vector is set to all ones. Otherwise, it is set to all zeros. Syntax: VACop{cond}.F32 {Qd}, Qn, Qm VACop{cond}.F32 {Dd}, Dn, Dm

16 NEON logical and compare operations
VCEQ, VCGE, VCGT, VCLE, and VCLT Vector Compare takes the value of each element in a vector, and compares it with the value of the corresponding element of a second vector, or zero. If the condition is true, the corresponding element in the destination vector is set to all ones. Otherwise, it is set to all zeros. Syntax: VCop{cond}.datatype {Qd}, Qn, Qm VCop{cond}.datatype {Dd}, Dn, Dm VCop{cond}.datatype {Qd}, Qn, #0 VCop{cond}.datatype {Dd}, Dn, #0

17 NEON logical and compare operations
VTST VTST (Vector Test Bits) takes each element in a vector, and bitwise logical ANDs them with the corresponding element of a second vector. If the result is not zero, the corresponding element in the destination vector is set to all ones. Otherwise, it is set to all zeros. Syntax: VTST{cond}.size {Qd}, Qn, Qm VTST{cond}.size {Dd}, Dn, Dm size must be one of 8, 16, or 32. 以vector為單位

18 NEON general data processing instructions
VCVT(between fixed-point or integer, and floating-point) VCVT (Vector Convert) converts each element in a vector in one of the following ways, and places the results in the destination vector: from floating-point to integer from integer to floating-point from floating-point to fixed-point from fixed-point to floating-point. Integer or fixed-point to floating-point conversions use round to nearest. Floating-point to integer or fixed-point conversions use round towards zero. Syntax: VCVT{cond}.type Qd, Qm {, #fbits} VCVT{cond}.type Dd, Dm {, #fbits} fbits if present, specifies the number of fraction bits in the fixed point number. Otherwise, the conversion is between floating-point and integer. fbits must lie in the range If fbits is omitted, the number of fraction bits is 0.

19 NEON general data processing instructions
VCVT(between half-precision and single-precision floating-point) VCVT (Vector Convert), with half-precision extension, converts each element in a vector in one of the following ways, and places the results in the destination vector: from half-precision floating-point to single-precision floating-point (F32.F16) from single-precision floating-point to half-precision floating-point (F16.F32). This instruction is only available in NEON systems with the half-precision extension Syntax VCVT{cond}.F32.F16 Qd, Dm VCVT{cond}.F16.F32 Dd, Qm

20 NEON general data processing instructions
VDUP VDUP (Vector Duplicate) duplicates a scalar into every element of the destination vector. The source can be a NEON scalar or an ARM register. Syntax VDUP{cond}.size Qd, Dm[x] VDUP{cond}.size Dd, Dm[x] VDUP{cond}.size Qd, Rm VDUP{cond}.size Dd, Rm size must be 8, 16, or 32. Dm[x] specifies the NEON scalar. Rm specifies the ARM register. Rm must not be the R15.

21 NEON general data processing instructions
VEXT VEXT (Vector Extract) extracts 8-bit elements from the bottom end of the second operand vector and the top end of the first, concatenates them, and places the result in the destination vector. Syntax: VEXT{cond}.8 {Qd}, Qn, Qm, #imm VEXT{cond}.8 {Dd}, Dn, Dm, #imm imm is the number of 8-bit elements to extract from the bottom of the second operand vector, in the range 0-7 for doubleword operations, or 0-15 for quadword operations.

22 NEON general data processing instructions
VMOV, VMVN (immediate) VMOV (Vector Move) and VMVN (Vector Move Negative) immediate generate an immediate value into the destination register. Syntax: Vop{cond}.datatype Qd, #imm Vop{cond}.datatype Dd, #imm imm is an immediate value of the type specified by datatype. This is replicated to fill the destination register. datatype must be one of I8, I16, I32, I64, or F32.

23 NEON general data processing instructions
VMOVL, V{Q}MOVN, VQMOVUN VMOVL (Vector Move Long) doubleword vector sign or zero extends them to twice original length VMOVN (Vector Move and Narrow) least significant half of each element of a quadword into doubleword VQMOVN (Vector Saturating Move and Narrow) VQMOVUN (Vector Saturating Move and Narrow, signed operand with Unsigned result) Syntax: VMOVL{cond}.datatype Qd, Dm V{Q}MOVN{cond}.datatype Dd, Qm VQMOVUN{cond}.datatype Dd, Qm Q if present, specifies that the results are saturated. datatype must be one of: S8, S16, S32 for VMOVL U8, U16, U62 for VMOVL I16, I32, I64 for VMOVN S16, S32, S64 for VQMOVN or VQMOVUN U16, U32, U64 for VQMOVN VMOVL : 2 -> 4 VMOVN: 4 -> 2 (element取一半放進去 ) VQMOVN (element全部放進去 飽和模式) Datatype 不一樣而已

24 NEON general data processing instructions
VREV VREV16 (Vector Reverse within halfwords) reverses the order of 8-bit elements, and places the result in the destination vector. VREV32 (Vector Reverse within words) reverses the order of 8-bit or 16-bit elements, and places the result in the destination vector. VREV64 (Vector Reverse within doublewords) reverses the order of 8-bit, 16-bit, or 32-bit elements, and places the result in the destination vector Syntax: VREVn{cond}.size Qd, Qm VREVn{cond}.size Dd, Dm

25 NEON general data processing instructions
VREV16 .8 Dd,Dm Vector 3 Vector 2 Vector 1 Vector 0 Dm 8-bit Dd NEON general data processing instructions VSWP VSWP (Vector Swap) exchanges the contents of two vectors. The vectors can be either doubleword or quadword. There is no distinction between data types. Syntax VSWP{cond}{.datatype} Qd, Qm VSWP{cond}{.datatype} Dd, Dm

26 NEON general data processing instructions
1 4 8 13 26 3 D3 p o n m l k j i h g f e d c b a {D1,D2} l e i n a d D3 VTBL .8 D0, {D1 , D2}, D3 VTBL : out of range indexes generate 0 result VTBX : out of range indexes leave destination unchanged NEON general data processing instructions VTBL,VTBX VTBL (Vector Table Lookup) uses byte indexes in a control vector to look up byte values in a table and generate a new vector. Indexes out of range return 0. VTBX (Vector Table Extension) works in the same way, except that indexes out of range leave the destination element unchanged. Uses byte indexes to control byte look up in a table Syntax: Vop{cond}.8 Dd, list, Dm List at most be {Dn,D(n+1),D(n+2),D(n+3)}

27 NEON general data processing instructions
7 6 5 4 3 2 1 Dm VTRN VTRN (Vector Transpose) treats the elements of its operand vectors as elements of 2 x 2 matrices, and transposes the matrices. Syntax VTRN{cond}.size Qd, Qm VTRN{cond}.size Dd, Dm Dd VTRN .8 Dd,Dm 1 VTRN .32 Dd,Dm

28 NEON general data processing instructions
VUZP, VZIP VZIP (Vector Zip) interleaves the elements of two vectors. VUZP (Vector Unzip) de-interleaves the elements of two vectors Syntax: Vop{cond}.size Qd, Qm Vop{cond}.size Dd, Dm size must be one of 8, 16, or 32.

29 Dd Dm Qd Qm Register state before operation
Register state after operation Dd Dm A7 A6 A5 A4 A3 A2 A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 B3 A3 B2 A2 B1 A1 B0 A0 B7 A7 B6 A6 B5 A5 B4 A4 VZIP .8 Dd, Dm Register state before operation Register state after operation Qd Qm A3 A2 A1 A0 B3 B2 B1 B0 B1 A1 B0 A0 B3 A3 B2 A2 VZIP .32 Qd, Qm

30 Dd Dm Qd Qm Register state before operation
Register state after operation Dd Dm A7 A6 A5 A4 A3 A2 A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 B6 B4 B2 B0 A5 A4 A2 A0 B7 B5 B3 B1 A7 A3 A1 VUZP .8 Dd, Dm Register state before operation Register state after operation Qd Qm A3 A2 A1 A0 B3 B2 B1 B0 B2 B0 A2 A0 B3 B1 A3 A1 VUZP .32 Qd, Qm

31 NEON shift instructions
VSHL, VQSHL, VQSHLU, and VSHLL (by immediate) For VSHL (Vector Shift Left), bits shifted out of the left of each element are lost. For VSHLL (Vector Shift Left Long), values are sign or zero extended. Syntax: V{Q}SHL{U}{cond}.datatype {Qd}, Qm, #imm V{Q}SHL{U}{cond}.datatype {Dd}, Dm, #imm VSHLL{cond}.datatype Qd, Dm, #imm Q:if present,they are saturated U:only permitted if Q is also present.Indicates that the results are unsigned.

32 NEON shift instructions
V{Q}{R}SHL (by signed variable) VSHL (Vector Shift Left by signed variable) takes each element in a vector, shifts them by a value from the least significant byte of the corresponding element of a second vector, and places the results in the destination vector. If the shift value is positive, the operation is a left shift. Otherwise, it is a right shift. Syntax: V{Q}{R}SHL{cond}.datatype {Qd}, Qm, Qn V{Q}{R}SHL{cond}.datatype {Dd}, Dm, Dn R if present, indicates that each result is rounded. Otherwise, each result is truncated.

33 NEON shift instructions
V{R}SHR{N}, V{R}SRA (by immediate) V{R}SHR{N} (Vector Shift Right by immediate value) takes each element in a vector, right shifts them by an immediate value, and places the results in the destination vector. The results can be optionally rounded, or narrowed, or both. V{R}SRA (Vector Shift Right by immediate value and Accumulate) takes each element in a vector, right shifts them by an immediate value, and accumulates the results into the destination vector. The results can be optionally rounded. V{R}SHR{N}, V{R}SRA (by immediate) Syntax: V{R}SHR{cond}.datatype {Qd}, Qm, #imm V{R}SHR{cond}.datatype {Dd}, Dm, #imm V{R}SRA{cond}.datatype {Qd}, Qm, #imm V{R}SRA{cond}.datatype {Dd}, Dm, #imm V{R}SHRN{cond}.datatype Dd, Qm, #imm R if present, indicates that the results are rounded. Otherwise, the results are truncated.

34 NEON shift instructions
VQ{R}SHR{U}N (by immediate) VQ{R}SHR{U}N (Vector Saturating Shift Right, Narrow, by immediate value, with optional Rounding) takes each element in a quadword vector of integers, right shifts them by an immediate value, and places the results in a doubleword vector. Syntax: VQ{R}SHR{U}N{cond}.datatype Dd, Qm, #imm

35 NEON shift instructions
VSLI and VSRI VSLI (Vector Shift Left and Insert) takes each element in a vector, left shifts them by an immediate value, and inserts the results in the destination vector. Bits shifted out of the left of each element are lost. VSRI (Vector Shift Right and Insert) takes each element in a vector, right shifts them by an immediate value, and inserts the results in the destination vector. Bits shifted out of the right of each element are lost. Syntax: Vop{cond}.size {Qd}, Qm, #imm Vop{cond}.size {Dd}, Dm, #imm

36 NEON shift instructions
VSHL, VQSHL, VQSHLU, and VSHLL (by immediate) Element 0 Dm Dd VSLI .64 Dd, Dm, #2

37 NEON general arithmetic instructions
VABA{L} and VABD{L} VABA (Vector Absolute Difference and Accumulate) subtracts the elements of one vector from the corresponding elements of another vector, and accumulates the absolute values of the results into the elements of the destination vector. VABD (Vector Absolute Difference) subtracts the elements of one vector from the corresponding elements of another vector, and places the absolute values of the results into the elements of the destination vector.

38 NEON general arithmetic instructions
VABA{L} and VABD{L} Syntax: Vop{cond}.datatype {Qd}, Qn, Qm Vop{cond}.datatype {Dd}, Dn, Dm VopL{cond}.datatype Qd, Dn, Dm datatype must be one of: S8, S16, S32, U8, U16, or U32 for VABA,VABAL,or VABDL S8, S16, S32, U8, U16, U32 or F32 for VABD.

39 NEON general arithmetic instructions
V{Q}ABS and V{Q}NEG VABS (Vector Absolute) takes the absolute value of each element in a vector, and places the results in a second vector. (The floating-point version only clears the sign bit.) VNEG (Vector Negate) negates each element in a vector, and places the results in a second vector. (The floating-point version only inverts the sign bit.)

40 NEON general arithmetic instructions
V{Q}ADD, VADDL, VADDW, V{Q}SUB, VSUBL, VSUBW VADD (Vector Add) adds corresponding elements in two vectors, and places the results in the destination vector. VSUB (Vector Subtract) subtracts the elements of one vector from the corresponding elements of another vector, and places the results in the destination vector. Syntax: V{Q}op{cond}.datatype {Qd}, Qn, Qm ; Saturating instruction V{Q}op{cond}.datatype {Dd}, Dn, Dm ; Saturating instruction VopL{cond}.datatype Qd, Dn, Dm ; Long instruction VopW{cond}.datatype {Qd}, Qn, Dm ; Wide instruction

41 NEON general arithmetic instructions
V{R}ADDHN and V{R}SUBHN V{R}ADDH (Vector Add and Narrow, selecting High half) adds corresponding elements in two vectors, selects the most significant halves of the results V{R}SUBH (Vector Subtract and Narrow, selecting High half) subtracts the elements of one vector from the corresponding elements of another vector, selects the most significant halves of the results Syntax: V{R}opHN{cond}.datatype Dd, Qn, Qm R if present, indicates that each result is rounded. Otherwise, each result is truncated. datatype must be one of I16, I32, or I64.

42 NEON general arithmetic instructions
V{R}HADD and VHSUB VHADD (Vector Halving Add) adds corresponding elements in two vectors, shifts each result right one bit, and places the results in the destination vector. Results can be either rounded or truncated. VHSUB (Vector Halving Subtract) Subtract, results are always truncated Syntax: V{R}HADD{cond}.datatype {Qd}, Qn, Qm V{R}HADD{cond}.datatype {Dd}, Dn, Dm VHSUB{cond}.datatype {Qd}, Qn, Qm VHSUB{cond}.datatype {Dd}, Dn, Dm

43 NEON general arithmetic instructions
VPADD{L}, VPADAL VPADD (Vector Pairwise Add) adds adjacent pairs of elements of two vectors, and places the results in the destination vector. VPADDL (Vector Pairwise Add Long) adds adjacent pairs of elements of a vector, sign or zero extends the results to twice their original width, and places the final results in the destination vector. Syntax: VPADD{cond}.datatype {Dd}, Dn, Dm VPopL{cond}.datatype Qd, Qm VPopL{cond}.datatype Dd, Dm

44 NEON general arithmetic instructions
VPADD{L}, VPADAL

45 NEON general arithmetic instructions
VPADD{L}, VPADAL

46 Dm Dn Dm + + + + + + Dd Dd VPADD .I16 Dd, Dn, Dm VPADAL .S16 Dd, Dm

47 NEON general arithmetic instructions
VMAX, VMIN, VPMAX, and VPMIN VMAX (Vector Maximum) compares corresponding elements in two vectors, and copies the larger of each pair into the corresponding element in the destination vector. VMIN (Vector Minimum) VPMAX (Vector Pairwise Maximum) compares adjacent pairs of elements in two vectors, and copies the larger of each pair into the corresponding element in the destination vector. Operands and results must be doubleword vectors. VPMIN (Vector Pairwise Minimum)

48 NEON general arithmetic instructions
VMAX, VMIN, VPMAX, and VPMIN Syntax: Vop{cond}.datatype Qd, Qn, Qm Vop{cond}.datatype Dd, Dn, Dm VPop{cond}.datatype Dd, Dn, Dm op must be either MAX or MIN. datatype must be one of S8, S16, S32, U8, U16, U32, or F32. Floating-point maximum and minimum max(+0.0, –0.0) = +0.0. min(+0.0, –0.0) = –0.0 If any input is a NaN, the corresponding result element is the default NaN.

49 NEON general arithmetic instructions
VSHL, VQSHL, VQSHLU, and VSHLL (by immediate) Dm Dn Dm Dn Max ….. Max Max Max Dd Dd VMAX .U16 Dd, Dn, Dm VPMAX .U16 Dd, Dn, Dm

50 NEON general arithmetic instructions
VCLS, VCLZ, and VCNT VCLS (Vector Count Leading Sign bits) counts the number of consecutive bits following the topmost bit, same as the topmost bit. VCLZ (Vector Count Leading Zeros) VCNT (Vector Count set bits) Syntax: Vop{cond}.datatype Qd, Qm Vop{cond}.datatype Dd, Dm

51 NEON general arithmetic instructions
VRECPE and VRSQRTE VRECPE (Vector Reciprocal Estimate) finds an approximate reciprocal of each element in a vector, and places the results in a second vector. VRSQRTE (Vector Reciprocal Square Root Estimate) finds an approximate reciprocal square root of each element in a vector, and places the results in a second vector. Ex: x-½ Syntax: Vop{cond}.datatype Qd, Qm Vop{cond}.datatype Dd, Dm reciprocal [re·cip·ro·cal || rɪ'sɪprəkl] n. 互相作用的事物; 倒數; 對應的事物 adj. 相互的, 交互的; 相互補償的; 互惠的, 對等的; 回報的, 報答的 fast inverse square root (平方根倒數) 原理是牛頓法,避開了開根號和除法運算,節省了很多計算時間。除此之外還使用了很多神奇的技巧,包括電腦結構和程式語言的冷知識。 3D 繪圖經常要計算平方根倒數。相傳是原作者在開發電腦遊戲「雷神之鎚」時,所發明的方法。 is a method of calculating x-½

52 NEON general arithmetic instructions
VRECPS and VRSQRTS VRECPS (Vector Reciprocal Step) multiplies the elements of one vector by the corresponding elements of another vector, subtracts each of the results from 2, and places the final results into the elements of the destination vector. VRSQRTS (Vector Reciprocal Square Root Step) subtracts each of the results from 3, divides these results by two, and places the final results into the elements of the destination vector. Syntax: Vop{cond}.F32 {Qd}, Qn, Qm Vop{cond}.F32 {Dd}, Dn, Dm VRECPS (向量倒数步进)将一个向量的元素与另一个向量的相应元素相乘,用 2 减去每个相乘结果,并将最终结果存放到目标向量的元素中。 VRSQRTS (向量平方根倒数步进)将一个向量的元素与另一个向量的相应元素相 乘,用 3 减去每个相乘结果,再将这些结果除以 2,并将最终结果存放到目标向 量的元素中。

53 NEON multiply instructions
VMUL{L}, VMLA{L}, and VMLS{L} VMUL (Vector Multiply) multiplies corresponding elements in two vectors, and places the results in the destination vector. VMLA (Vector Multiply Accumulate) multiplies corresponding elements in two vectors, and accumulates the results into the elements of the destination vector. VMLS (Vector Multiply Subtract) multiplies corresponding elements in two vectors, subtracts the results from corresponding elements of the destination vector, and places the final results in the destination vector. VMUL (向量乘法)将两个向量中的相应元素相乘,并将结果存放到目标向量 中。 VMLA (向量乘加)将两个向量中的相应元素相乘,并将结果累加到目标向量的 元素中。 VMLS (向量乘减)将两个向量中的相应元素相乘,从目标向量的相应元素中减 去相乘的结果,并将最终结果放入目标向量中。

54 NEON multiply instructions
VMUL{L}, VMLA{L}, and VMLS{L} (by scalar) Syntax: Vop{cond}.datatype {Qd}, Qn, Qm Vop{cond}.datatype {Dd}, Dn, Dm VopL{cond}.datatype Qd, Dn, Dm Syntax(by scalar): Vop{cond}.datatype {Qd}, Qn, Dm[x] Vop{cond}.datatype {Dd}, Dn, Dm[x] VopL{cond}.datatype Qd, Dn, Dm[x] datatype must be one of: I16, I32, F32 for VMUL, VMLA, or VMLS S16, S32 for VMULL, VMLAL, or VMLSL U16, U32 for VMULL, VMLAL, or VMLSL.

55 NEON multiply instructions
VFMA, VFMS VFMA (Vector Fused Multiply Accumulate) multiplies corresponding elements in the two operand vectors, and accumulates the results into the elements of the destination vector. The result of the multiply is not rounded before the accumulation. VFMS (Vector Fused Multiply Subtract) The result of the multiply is not rounded before the subtraction. Syntax: Vop{cond}.F32 {Qd}, Qn, Qm Vop{cond}.F32 {Dd}, Dn, Dm Vop{cond}.F64 {Dd}, Dn, Dm Vop{cond}.F32 {Sd}, Sn, Sm 浮點數 相乘後 Not rounded (進位), 與destination相加 後在做 或者是 相乘後 destination 減去相乘結果, 也是減完後再進位

56 NEON multiply instructions
VQDMULL, VQDMLAL, and VQDMLSL (by vector or by scalar) Vector Saturating Doubling Multiply instructions multiply their operands and double the results. VQDMULL places the results in the destination register. VQDMLAL adds the results to the values in the destination register. VQDMLSL subtracts the results from the values in the destination register. Syntax: VQDopL{cond}.datatype Qd, Dn, Dm VQDopL{cond}.datatype Qd, Dn, Dm[x] 乘完將結果 double後放入destination 乘完後與destination相加 後將結果double 後 放到destination Destination減掉相乘後的結果 在把這個結果double 後放到 destination By vector or scalar

57 NEON multiply instructions
VQ{R}DMULH (by vector or by scalar) Vector Saturating Doubling Multiply instructions multiply their operands and double the results. They return only the high half of the results. Syntax: VQ{R}DMULH{cond}.datatype {Qd}, Qn, Qm VQ{R}DMULH{cond}.datatype {Dd}, Dn, Dm VQ{R}DMULH{cond}.datatype {Qd}, Qn, Dm[x] VQ{R}DMULH{cond}.datatype {Dd}, Dn, Dm[x] 乘完以後, double結果(也就是結果加倍) ,取結果的最高的那半部分

58 NEON load and store element and structure instructions
Interleaving Many instructions in this group provide interleaving when structures are stored to memory, and de-interleaving when structures are loaded from memory. Interleaving is the inverse process.

59 De-interleaving an array of 3-element structures
A[0].x A[0].y A[0].z A[1].x A[1].y A[1].z A[2].x A[2].y A[2].z A[3].x A[3].y A[3].z X3 X2 X1 X0 D0 Y3 Y2 Y1 Y0 D1 Z3 Z2 Z1 Z0 D2 De-interleaving an array of 3-element structures

60 NEON load and store element and structure instructions
VLDn and VSTn (single n-element structure to one lane) Vector Load single n-element structure to one lane. It loads one n-element structure from memory into one or more NEON registers. Vector Store single n-element structure to one lane. It stores one n-element structure into memory from one or more NEON registers. Syntax: Vopn{cond}.datatype list, Vopn{cond}.datatype list, Rm

61 NEON load and store element and structure instructions
VLDn and VSTn (single n-element structure to one lane) Syntax: Vopn{cond}.datatype list, Vopn{cond}.datatype list, Rm n must be one of 1, 2, 3, or 4. list specifies the NEON register list. align specifies an optional alignment. If ! is present, Rn is updated to (Rn + the number of bytes transferred by the instruction) If Rm is present, Rn is updated to (Rn + Rm) after the address is used to access memory

62 x0 y0 z0 x1 y1 z1 x2 y3 z3 [R1] +2 +4 x0 x1 x2 x3 +6 [R4] +8 x3 x2 x1 x0 D0 +2 +10 +R3 D1 +4 +12 +6 y3 y2 y1 y0 D2 x3 x2 x1 x0 D7 +20 D3 VLD1 .16 {D7}, [R4], R3 +22 z3 z2 z1 z0 D4 R4 will  R4 + R3 VLD3 .16 {D0,D2,D4}, [R1] !

63 VFP instructions VABS, VNEG, and VSQRT
Floating-point absolute value, negate, and square root. These instructions can be scalar, vector, or mixed. Syntax: Vop{cond}.F32 Sd, Sm Vop{cond}.F64 Dd, Dm op is one of ABS, NEG, or SQRT. VABS: clear the sigh bit VNEG: changes the sign bit VSQRT: square root

64 VFP instructions VADD, VSUB, and VDIV
Floating-point add, subtract, and divide. These instructions can be scalar, vector, or mixed. Syntax: Vop{cond}.F32 {Sd}, Sn, Sm Vop{cond}.F64 {Dd}, Dn, Dm S* single-precision registers D* double-precision registers

65 VFP instructions VMUL, VMLA, VMLS, VNMUL, VNMLA, and VNMLS
Floating-point multiply and multiply accumulate, with optional negation. Syntax: V{N}MUL{cond}.F32 {Sd,} Sn, Sm V{N}MUL{cond}.F64 {Dd,} Dn, Dm V{N}MLA{cond}.F32 Sd, Sn, Sm V{N}MLA{cond}.F64 Dd, Dn, Dm V{N}MLS{cond}.F32 Sd, Sn, Sm V{N}MLS{cond}.F64 Dd, Dn, Dm N negates the final result.

66 VFP instructions VFP instructions
Fused floating-point multiply accumulate and fused floating-point multiply subtract with optional negation. Syntax: VF{N}op{cond}.F64 {Dd}, Dn, Dm VF{N}op{cond}.F32 {Sd}, Sn, Sm VFMA multiplies the values in the operand registers, adds the value in the destination register, and places the final result in the destination register. The result of the multiply is not rounded before the accumulation. VFMS multiplies the values in the operand registers, subtracts the product from the value in the destination register, and places the final result in the destination register. The result of the multiply is not rounded before the subtraction.

67 VFP instructions VCMP Floating-point compare. VCMP is always scalar.
Syntax: VCMP{cond}.F32 Sd, Sm VCMP{cond}.F32 Sd, #0 VCMP{cond}.F64 Dd, Dm VCMP{cond}.F64 Dd, #0 The VCMP instruction subtracts the value in the second operand register (or 0 if the second operand is #0) from the value in the first operand register, and sets the VFP condition flags on the result.

68 VFP instructions VCVT (between single-precision and double-precision)
VCVT{cond}.F64.F32 Dd, Sm VCVT{cond}.F32.F64 Sd, Dm VCVT (between floating-point and integer) VCVT{R}{cond}.type.F64 Sd, Dm VCVT{R}{cond}.type.F32 Sd, Sm VCVT{cond}.F64.type Dd, Sm VCVT{cond}.F32.type Sd, Sm VCVT (between floating-point and fixed-point) VCVT{cond}.type.F64 Dd, Dd, #fbits VCVT{cond}.type.F32 Sd, Sd, #fbits VCVT{cond}.F64.type Dd, Dd, #fbits VCVT{cond}.F32.type Sd, Sd, #fbits

69 VFP instructions VCVTB, VCVTT (half-precision extension)
Converts between half-precision and single-precision floating-point numbers VCVTB uses the bottom half (bits[15:0]) of the single word register to obtain or store the half-precision value VCVTT uses the top half (bits[31:16]) of the single word register to obtain or store the half-precision value. VCVTB and VCVTT are always scalar. Syntax: VCVTB{cond}.type Sd, Sm VCVTT{cond}.type Sd, Sm

70 VFP instructions VMOV Insert a floating-point immediate value in a single-precision or double-precision register, or copy one register into another register. This instruction is always scalar. Syntax: VMOV{cond}.F32 Sd, #imm VMOV{cond}.F64 Dd, #imm VMOV{cond}.F32 Sd, Sm VMOV{cond}.F64 Dd, Dm


Download ppt "ARM Architecture & NEON"

Similar presentations


Ads by Google