VirtualBox

Changeset 104039 in vbox for trunk


Ignore:
Timestamp:
Mar 25, 2024 1:36:30 PM (10 months ago)
Author:
vboxsync
Message:

iprt/armv8.h: Data processing instructions with to register inputs. bugref:10376

File:
1 edited

Legend:

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

    r104013 r104039  
    27982798}
    27992799
     2800
     2801
     2802/*
     2803 * Data processing instructions with two source register operands.
     2804 */
     2805
     2806
     2807/** A64: Encodes an SUBP instruction. */
     2808DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrSubP(uint32_t iRegResult, uint32_t iRegMinuend, uint32_t iRegSubtrahend)
     2809{
     2810    Assert(iRegResult < 32);  Assert(iRegMinuend < 32); Assert(iRegSubtrahend < 32);
     2811    return UINT32_C(0x80000000)
     2812         | UINT32_C(0x1ac00000)
     2813         | (UINT32_C(0)      << 10)
     2814         | (iRegSubtrahend   << 16)
     2815         | (iRegMinuend      << 5)
     2816         | iRegResult;
     2817}
     2818
     2819
     2820/** A64: Encodes an SUBPS instruction. */
     2821DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrSubPS(uint32_t iRegResult, uint32_t iRegMinuend, uint32_t iRegSubtrahend)
     2822{
     2823    Assert(iRegResult < 32);  Assert(iRegMinuend < 32); Assert(iRegSubtrahend < 32);
     2824    return UINT32_C(0x80000000)
     2825         | UINT32_C(0x20000000)
     2826         | UINT32_C(0x1ac00000)
     2827         | (UINT32_C(0)      << 10)
     2828         | (iRegSubtrahend   << 16)
     2829         | (iRegMinuend      << 5)
     2830         | iRegResult;
     2831}
     2832
     2833
     2834/** A64: Encodes an UDIV instruction. */
     2835DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrUDiv(uint32_t iRegResult, uint32_t iRegDividend, uint32_t iRegDivisor, bool f64Bit = true)
     2836{
     2837    Assert(iRegResult < 32);  Assert(iRegDividend < 32); Assert(iRegDivisor < 32);
     2838    return ((uint32_t)f64Bit << 31)
     2839         | UINT32_C(0x1ac00000)
     2840         | (UINT32_C(2)      << 10)
     2841         | (iRegDivisor      << 16)
     2842         | (iRegDividend     << 5)
     2843         | iRegResult;
     2844}
     2845
     2846
     2847/** A64: Encodes an SDIV instruction. */
     2848DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrSDiv(uint32_t iRegResult, uint32_t iRegDividend, uint32_t iRegDivisor, bool f64Bit = true)
     2849{
     2850    Assert(iRegResult < 32);  Assert(iRegDividend < 32); Assert(iRegDivisor < 32);
     2851    return ((uint32_t)f64Bit << 31)
     2852         | UINT32_C(0x1ac00000)
     2853         | (UINT32_C(3)      << 10)
     2854         | (iRegDivisor      << 16)
     2855         | (iRegDividend     << 5)
     2856         | iRegResult;
     2857}
     2858
     2859
     2860/** A64: Encodes an IRG instruction. */
     2861DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrIrg(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2)
     2862{
     2863    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     2864    return UINT32_C(0x80000000)
     2865         | UINT32_C(0x1ac00000)
     2866         | (UINT32_C(4)      << 10)
     2867         | (iRegSrc2         << 16)
     2868         | (iRegSrc1         << 5)
     2869         | iRegResult;
     2870}
     2871
     2872
     2873/** A64: Encodes a GMI instruction. */
     2874DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrGmi(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2)
     2875{
     2876    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     2877    return UINT32_C(0x80000000)
     2878         | UINT32_C(0x1ac00000)
     2879         | (UINT32_C(5)      << 10)
     2880         | (iRegSrc2         << 16)
     2881         | (iRegSrc1         << 5)
     2882         | iRegResult;
     2883}
     2884
     2885
     2886/** A64: Encodes an LSLV instruction. */
     2887DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrLslv(uint32_t iRegResult, uint32_t iRegSrc, uint32_t iRegCount, bool f64Bit = true)
     2888{
     2889    Assert(iRegResult < 32);  Assert(iRegSrc < 32); Assert(iRegCount < 32);
     2890    return ((uint32_t)f64Bit << 31)
     2891         | UINT32_C(0x1ac00000)
     2892         | (UINT32_C(8)      << 10)
     2893         | (iRegCount        << 16)
     2894         | (iRegSrc          << 5)
     2895         | iRegResult;
     2896}
     2897
     2898
     2899/** A64: Encodes an LSRV instruction. */
     2900DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrLsrv(uint32_t iRegResult, uint32_t iRegSrc, uint32_t iRegCount, bool f64Bit = true)
     2901{
     2902    Assert(iRegResult < 32);  Assert(iRegSrc < 32); Assert(iRegCount < 32);
     2903    return ((uint32_t)f64Bit << 31)
     2904         | UINT32_C(0x1ac00000)
     2905         | (UINT32_C(9)      << 10)
     2906         | (iRegCount        << 16)
     2907         | (iRegSrc          << 5)
     2908         | iRegResult;
     2909}
     2910
     2911
     2912/** A64: Encodes an ASRV instruction. */
     2913DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrAsrv(uint32_t iRegResult, uint32_t iRegSrc, uint32_t iRegCount, bool f64Bit = true)
     2914{
     2915    Assert(iRegResult < 32);  Assert(iRegSrc < 32); Assert(iRegCount < 32);
     2916    return ((uint32_t)f64Bit << 31)
     2917         | UINT32_C(0x1ac00000)
     2918         | (UINT32_C(10)     << 10)
     2919         | (iRegCount        << 16)
     2920         | (iRegSrc          << 5)
     2921         | iRegResult;
     2922}
     2923
     2924
     2925/** A64: Encodes a RORV instruction. */
     2926DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrRorv(uint32_t iRegResult, uint32_t iRegSrc, uint32_t iRegCount, bool f64Bit = true)
     2927{
     2928    Assert(iRegResult < 32);  Assert(iRegSrc < 32); Assert(iRegCount < 32);
     2929    return ((uint32_t)f64Bit << 31)
     2930         | UINT32_C(0x1ac00000)
     2931         | (UINT32_C(11)     << 10)
     2932         | (iRegCount        << 16)
     2933         | (iRegSrc          << 5)
     2934         | iRegResult;
     2935}
     2936
     2937
     2938/** A64: Encodes a PACGA instruction. */
     2939DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrPacga(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2)
     2940{
     2941    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     2942    return UINT32_C(0x80000000)
     2943         | UINT32_C(0x1ac00000)
     2944         | (UINT32_C(12)     << 10)
     2945         | (iRegSrc2         << 16)
     2946         | (iRegSrc1         << 5)
     2947         | iRegResult;
     2948}
     2949
     2950
     2951/** A64: Encodes a CRC32* instruction. */
     2952DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue, uint32_t uSize)
     2953{
     2954    Assert(iRegResult < 32);  Assert(iRegCrc < 32); Assert(iRegValue < 32); Assert(uSize < 4);
     2955    return ((uint32_t)(uSize == 3) << 31)
     2956         | UINT32_C(0x1ac00000)
     2957         | (UINT32_C(16)           << 10)
     2958         | (uSize                  << 10)
     2959         | (iRegValue              << 16)
     2960         | (iRegCrc                << 5)
     2961         | iRegResult;
     2962}
     2963
     2964
     2965/** A64: Encodes a CRC32B instruction. */
     2966DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32B(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     2967{
     2968    return ArmvA64MkInstrCrc32(iRegResult, iRegCrc, iRegValue, 0);
     2969}
     2970
     2971
     2972/** A64: Encodes a CRC32H instruction. */
     2973DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32H(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     2974{
     2975    return ArmvA64MkInstrCrc32(iRegResult, iRegCrc, iRegValue, 1);
     2976}
     2977
     2978
     2979/** A64: Encodes a CRC32W instruction. */
     2980DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32W(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     2981{
     2982    return ArmvA64MkInstrCrc32(iRegResult, iRegCrc, iRegValue, 2);
     2983}
     2984
     2985
     2986/** A64: Encodes a CRC32X instruction. */
     2987DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32X(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     2988{
     2989    return ArmvA64MkInstrCrc32(iRegResult, iRegCrc, iRegValue, 3);
     2990}
     2991
     2992
     2993/** A64: Encodes a CRC32C* instruction. */
     2994DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32c(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue, uint32_t uSize)
     2995{
     2996    Assert(iRegResult < 32);  Assert(iRegCrc < 32); Assert(iRegValue < 32); Assert(uSize < 4);
     2997    return ((uint32_t)(uSize == 3) << 31)
     2998         | UINT32_C(0x1ac00000)
     2999         | (UINT32_C(20)           << 10)
     3000         | (uSize                  << 10)
     3001         | (iRegValue              << 16)
     3002         | (iRegCrc                << 5)
     3003         | iRegResult;
     3004}
     3005
     3006
     3007/** A64: Encodes a CRC32B instruction. */
     3008DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32cB(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     3009{
     3010    return ArmvA64MkInstrCrc32c(iRegResult, iRegCrc, iRegValue, 0);
     3011}
     3012
     3013
     3014/** A64: Encodes a CRC32CH instruction. */
     3015DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32cH(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     3016{
     3017    return ArmvA64MkInstrCrc32c(iRegResult, iRegCrc, iRegValue, 1);
     3018}
     3019
     3020
     3021/** A64: Encodes a CRC32CW instruction. */
     3022DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32cW(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     3023{
     3024    return ArmvA64MkInstrCrc32c(iRegResult, iRegCrc, iRegValue, 2);
     3025}
     3026
     3027
     3028/** A64: Encodes a CRC32CX instruction. */
     3029DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrCrc32cX(uint32_t iRegResult, uint32_t iRegCrc, uint32_t iRegValue)
     3030{
     3031    return ArmvA64MkInstrCrc32c(iRegResult, iRegCrc, iRegValue, 3);
     3032}
     3033
     3034
     3035/** A64: Encodes an SMAX instruction. */
     3036DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrSMax(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2, bool f64Bit = true)
     3037{
     3038    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     3039    return ((uint32_t)f64Bit << 31)
     3040         | UINT32_C(0x1ac00000)
     3041         | (UINT32_C(24)     << 10)
     3042         | (iRegSrc2         << 16)
     3043         | (iRegSrc1         << 5)
     3044         | iRegResult;
     3045}
     3046
     3047
     3048/** A64: Encodes an UMAX instruction. */
     3049DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrUMax(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2, bool f64Bit = true)
     3050{
     3051    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     3052    return ((uint32_t)f64Bit << 31)
     3053         | UINT32_C(0x1ac00000)
     3054         | (UINT32_C(25)     << 10)
     3055         | (iRegSrc2         << 16)
     3056         | (iRegSrc1         << 5)
     3057         | iRegResult;
     3058}
     3059
     3060
     3061/** A64: Encodes an SMIN instruction. */
     3062DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrSMin(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2, bool f64Bit = true)
     3063{
     3064    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     3065    return ((uint32_t)f64Bit << 31)
     3066         | UINT32_C(0x1ac00000)
     3067         | (UINT32_C(26)     << 10)
     3068         | (iRegSrc2         << 16)
     3069         | (iRegSrc1         << 5)
     3070         | iRegResult;
     3071}
     3072
     3073
     3074/** A64: Encodes an UMIN instruction. */
     3075DECL_FORCE_INLINE(uint32_t) ArmvA64MkInstrUMin(uint32_t iRegResult, uint32_t iRegSrc1, uint32_t iRegSrc2, bool f64Bit = true)
     3076{
     3077    Assert(iRegResult < 32);  Assert(iRegSrc1 < 32); Assert(iRegSrc2 < 32);
     3078    return ((uint32_t)f64Bit << 31)
     3079         | UINT32_C(0x1ac00000)
     3080         | (UINT32_C(27)     << 10)
     3081         | (iRegSrc2         << 16)
     3082         | (iRegSrc1         << 5)
     3083         | iRegResult;
     3084}
     3085
     3086
    28003087# ifdef IPRT_INCLUDED_asm_h /* don't want this to be automatically included here. */
    28013088
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