Revision 2 not available (showing current revision instead)

proj-plbook-plChTargetLanguagesConcordance2

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:

Memory access:

Stack ops:

Atomics and Sync:

Control flow:

Data structures:

Misc:

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.

PC-relative instructions

RISC-V has an instruction to load PC-relative constant, and ARM has PC-relative addition.

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].

Add, subtract, multiply, divide

LLVM, CIL, ARM have 32-bit signed integer addition and subtraction with overflow. Only LLVM, CIL have multiplication with overflow, as well as unsigned and 64-bit variants of addition, subtraction, multiplication with overflow.

LLVM offers 'constrained' floating point operations, which means that the rounding and exception modes are respected when those instructions are used. RISC-V provides a similar facility through its rounding mode and exception mode special registers; except that RISC-V does not provide a floating-point mod/remainder instruction.

integer addition with overflow (64-bit and unsigned variants):

integer subtraction with overflow (64-bit and unsigned variants):

integer multiplication, lower bits, with overflow:

floating point constrained operations (similar to corresponding RISC-V operations, not shown):

Moves (copies)

None.

Shifts

WASM and ARM provide right rotate.

Rotate right:

Logical

None.

Compares

WASM and LLVM provide inequality (integer and floating point), integer greater-than-or-equal-to, less-than-or-equal-to, floating point greater-than-or-equal-to (they also provide that for integer, but so do other platforms, so those are listed above rather than here).

Note that some other platforms provide these operations, but only as branches rather than vanilla compares.

Integer inequality:

Integer greater-than-or-equal-to, less-than-or-equal-to:

Floating point:

Misc integer arith

CLZ, CTZ, POPCNT are provided by WASM and LLVM (but only as LLVM intrinsics).

LLVM and ARM provide various byteswaps.

byte swap:

Floating-point-specific

WASM and LLVM provide abs(-olute-value), although LLVM abs is an intrinsic.

RISC-V and LLVM provide rounding in the form of conversion operations and rounding modes (LLVM requires the 'constrained' intrinsics to use these). WASM and LLVM provide rounding in the form of ceil, floor, trunc, nearest instructions (but WASM does not provide rounding mode control for other instructions; see [4] and [5]).

RISC-V and LLVM support IEEE exception flags and rounding modes (but LLVM only supports these with 'constrained' intrinsics. Because two platforms support this functionality it is included here, but note that some of the LLVM 'constrained' intrinsics are listed above, in the section 'Add, subtract, multiply, divide'.

Andreas Olofsson of Adapteva noted in a blog post that the Epiphany ISA does not include operations like RISC-V's exception flags, coercion operations, and rounding modes, because they were not needed for Epiphany's use case [6].

RISC-V provides an FCLASS instruction to report the attributes of a floating-point number. Andreas Olofsson of Adapteva said in a blog post that he felt that this instruction was "not essential" [7]. CIL provides ckfinite to check if a floating-point number is finite.

Fused multiply-add is provided by RISC-V and LLVM (but only as an LLVM intrinsic).

pow is provided by LLVM as an intrinsic and by LuaJIT?2.

some notes on the default rounding mode of other platforms: " WebAssembly? uses “non-stop” mode, and floating point exceptions are not otherwise observable. In particular, neither alternate floating point exception handling attributes nor the non-computational operators on status flags are supported. There is no observable difference between quiet and signalling NaN?. However, positive infinity, negative infinity, and NaN? are still always produced as result values to indicate overflow, invalid, and divide-by-zero conditions, as specified by IEEE 754-2008.

WebAssembly?