Continued from Target Languages Concordance part I
Concordance of instructions supported by two platforms
In addition to the above, instructions or intrinsics for each of the following is provided by two platforms in this study:
Arithmetic:
- instructions to load various higher-level data structure constants such as strings
- constant tables/constant pools
- PC-relative arithmetic
- multiplication with overflow (signed and unsigned, 32- and 64-bit)
- unsigned, 64-bit variants of addition, subtraction, multiplication with overflow
- right rotate
- integer compares: inequality, greater-than-or-equal-to, less-than-or-equal-to,
- floating point compares: inequality, greater-than-or-equal-to
- clz ctz popcnt
- byteswaps
- integer conversions from 8-bit or 16-bit to larger
- floating point:
- abs
- ceil, floor, trunc, nearest
- rounding modes and exception modes
- classify
- fused multiply-add
- pow
Memory access:
- global variable loads/stores
- short instructions to load/store the first 4 variables
Stack ops:
Atomics and Sync:
- AMOs: SWAP, ADD, AND, OR, XOR, MIN, MAX, MINU, MAXU
- either load-release/store-conditional, or compare-and-swap
Control flow:
- jump with link register
- unconstrained indirect branch
- branches: <0, >=0, unsigned <, unsigned >=
- select
- tail calls
- structured control flow loops
- invoke instructions for object-oriented calling.
Data structures:
Misc:
- cycle counters
- special registers
- memory ops such as memcpy
Arithmetic
Constant loads
LuaJIT?2 and CIL have instructions to load various higher-level data structures such as strings.
JVM and LuaJIT?2 use constant tables/constant pools. (i think that LuaJIT?2's constant load instructions can be used for both immediate constants and constant tables, depending on if their argumens is negative or not). Note: CIL does not have a runtime-accessible constant table; it has a constant table for use at compile-time but "Compilers inspect this information, at compile time, when importing metadata, but the value of the constant itself, if used, becomes embedded into the CIL stream the compiler emits. There are no CIL instructions to access the Constant table at runtime" ([1] section II.22.9, page 216).
JVM provides instructions to push constants of null, or 0,1 sometimes 2, or -1...5, depending on type. CIL provides instructions to load -1..8 to i32 as well as null.
- aconst_null dconst_0 dconst_1 fconst_0 fconst_1 fconst_2 iconst_m1 iconst_0 iconst_1 iconst_2 iconst_3 iconst_4 iconst_5 lconst_0 lconst_1 (JVM)
- ldc ldc_w ldc2_w (JVM)
- kstr (LuaJIT?2)
- ldstr (CIL)
- kdata kshort knum kpri knil (LuaJIT?2)
- ldc.i4.0 ldc.i4.1 ldc.i4.2 ldc.i4.3 ldc.i4.4 ldc.i4.5 ldc.i4.6 ldc.i4.7 ldc.i4.8 ldc.i4.m1 ldc.i4.M1 ldnull (CIL)
PC-relative instructions
RISC-V has an instruction to load PC-relative constant, and ARM has PC-relative addition.
- AUIPC (RISC-V RV32I)
- adr (ARM)
Andreas Olofsson of Adapteva said on a blog that he is "not convinced that ((AUIPC)) is essential" [2], however a commenter, Chris, from the RISC-V project explained that it was useful [3]