VirtualBox

Changeset 105174 in vbox for trunk/include


Ignore:
Timestamp:
Jul 7, 2024 1:05:54 PM (7 months ago)
Author:
vboxsync
Message:

include/iprt/armv8.h: Add helper for 3 operand floating point instructions, bugref:10652

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/armv8.h

    r105173 r105174  
    49654965}
    49664966
     4967
     4968/** Armv8 floating point size. */
     4969typedef enum
     4970{
     4971    kArmv8VecInstrFpSz_2x_Single = 0,                             /**< 2x single precision values in the low 64-bit of the 128-bit register. */
     4972    kArmv8VecInstrFpSz_4x_Single = RT_BIT_32(30),                 /**< 4x single precision values in the 128-bit register. */
     4973    kArmv8VecInstrFpSz_2x_Double = RT_BIT_32(30) | RT_BIT_32(22), /**< 2x double precision values in the 128-bit register. */
     4974} ARMV8INSTRVECFPSZ;
     4975
     4976
     4977/** Armv8 3 operand floating point operation. */
     4978typedef enum
     4979{
     4980                                        /*   insn[29]          insn[23]      insn[15:11]     */
     4981    kArmv8VecInstrFpOp_Add               =                                 UINT32_C(0xd000), /**< FADD    */
     4982    kArmv8VecInstrFpOp_Sub               =                 RT_BIT_32(23) | UINT32_C(0xd000), /**< FADD    */
     4983    kArmv8VecInstrFpOp_AddPairwise       = RT_BIT_32(29) |                 UINT32_C(0xd000), /**< FADDP   */
     4984    kArmv8VecInstrFpOp_Mul               = RT_BIT_32(29) |                 UINT32_C(0xd800), /**< FMUL    */
     4985    kArmv8VecInstrFpOp_Div               = RT_BIT_32(29) |                 UINT32_C(0xf800), /**< FDIV    */
     4986
     4987    kArmv8VecInstrFpOp_Max               =                                 UINT32_C(0xf000), /**< FMAX    */
     4988    kArmv8VecInstrFpOp_MaxNumber         =                                 UINT32_C(0xc000), /**< FMAXNM  */
     4989    kArmv8VecInstrFpOp_MaxNumberPairwise = RT_BIT_32(29) |                 UINT32_C(0xc000), /**< FMAXNMP */
     4990    kArmv8VecInstrFpOp_MaxPairwise       = RT_BIT_32(29) |                 UINT32_C(0xf000), /**< FMAXP   */
     4991
     4992    kArmv8VecInstrFpOp_Min               =                 RT_BIT_32(23) | UINT32_C(0xf000), /**< FMIN    */
     4993    kArmv8VecInstrFpOp_MinNumber         =                 RT_BIT_32(23) | UINT32_C(0xc000), /**< FMINNM  */
     4994    kArmv8VecInstrFpOp_MinNumberPairwise = RT_BIT_32(29) | RT_BIT_32(23) | UINT32_C(0xc000), /**< FMINNMP */
     4995    kArmv8VecInstrFpOp_MinPairwise       = RT_BIT_32(29) | RT_BIT_32(23) | UINT32_C(0xf000), /**< FMINP   */
     4996
     4997    kArmv8VecInstrFpOp_Fmla              =                                 UINT32_C(0xc800), /**< FMLA    */
     4998    kArmv8VecInstrFpOp_Fmls              =                 RT_BIT_32(23) | UINT32_C(0xc800), /**< FMLS    */
     4999} ARMV8INSTRVECFPOP;
     5000
     5001/**
     5002 * A64: Encodes a 3 operand floating point operation (vector, register).
     5003 *
     5004 * @returns The encoded instruction.
     5005 * @param   enmOp       The operation to perform.
     5006 * @param   enmSz       The size to operate on.
     5007 * @param   iVecRegDst  The vector register to put the result into.
     5008 * @param   iVecRegSrc1 The first vector source register.
     5009 * @param   iVecRegSrc2 The second vector source register.
     5010 */
     5011DECL_FORCE_INLINE(uint32_t) Armv8A64MkVecInstrFp3Op(ARMV8INSTRVECFPOP enmOp, ARMV8INSTRVECFPSZ enmSz, uint32_t iVecRegDst,
     5012                                                    uint32_t iVecRegSrc1, uint32_t iVecRegSrc2)
     5013{
     5014    Assert(iVecRegDst < 32); Assert(iVecRegSrc1 < 32); Assert(iVecRegSrc2 < 32);
     5015
     5016    return UINT32_C(0x0e200400)
     5017         | ((uint32_t)enmOp)
     5018         | ((uint32_t)enmSz)
     5019         | (iVecRegSrc2 << 16)
     5020         | (iVecRegSrc1 << 5)
     5021         | iVecRegDst;
     5022}
     5023
     5024
    49675025/** @} */
    49685026
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette