Indices and tables

Todo list

Todo

Clarify the representation of larger boolean types.

The multi-bit boolean types can be interpreted in different ways. We could declare that zero means false and non-zero means true. This may require unwanted normalization code in some places.

We could specify a fixed encoding like all ones for true. This would then lead to undefined behavior if untrusted code uses the multibit booleans incorrectly.

Something like this:

  • External code is not allowed to load/store multi-bit booleans or otherwise expose the representation.
  • Each target specifies the exact representation of a multi-bit boolean.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/docs/langref.rst, line 103.)

Todo

Define safe indirect function calls.

The call_indirect instruction is dangerous to use in a sandboxed environment since it is not easy to verify the callee address. We need a table-driven indirect call instruction, similar to br_table.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/docs/langref.rst, line 415.)

Todo

Larger multiplication results.

For example, smulx which multiplies i32 operands to produce a i64 result. Alternatively, smulhi and smullo pairs.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/docs/langref.rst, line 615.)

Todo

Integer remainder vs modulus.

Clarify whether the result has the sign of the divisor or the dividend. Should we add a smod instruction for the case where the result has the same sign as the divisor?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/lib/cretonne/meta/cdsl/instructions.py:docstring of base.instructions.srem, line 5.)

Todo

Minimum / maximum.

NEON has smin, smax, umin, and umax instructions. We should replicate those for both scalar and vector integer types. Even if the target ISA doesn’t have scalar operations, these are good pattern matching targets.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/docs/langref.rst, line 629.)

Todo

Saturating arithmetic.

Mostly for SIMD use, but again these are good patterns for contraction. Something like usatadd, usatsub, ssatadd, and ssatsub is a good start.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/docs/langref.rst, line 636.)

Todo

Redundant bitwise operators.

ARM has instructions like bic(x,y) = x & ~y, orn(x,y) = x | ~y, and eon(x,y) = x ^ ~y.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/cretonne/checkouts/latest/docs/langref.rst, line 658.)