Document that b8 etc. are intended for use as SIMD elements.

This commit is contained in:
Dan Gohman
2018-09-05 14:23:03 -07:00
parent 1e0c9b546b
commit 608e74d8cb
2 changed files with 15 additions and 8 deletions

View File

@@ -96,12 +96,16 @@ different types.
Boolean types Boolean types
------------- -------------
Boolean values are either true or false. While this only requires a single bit Boolean values are either true or false.
to represent, more bits are often used when holding a boolean value in a
register or in memory. The :type:`b1` type represents an abstract boolean The :type:`b1` type represents an abstract boolean value. It can only exist as
value. It can only exist as an SSA value, it can't be stored in memory or an SSA value, and can't be directly stored in memory. It can, however, be
converted to another type. The larger boolean types can be stored in memory. converted into an integer with value 0 or 1 by the :inst:`bint` instruction (and
They are represented as either all zero bits or all one bits. converted back with :inst:`icmp_imm` with 0).
Several larger boolean types are also defined, primarily to be used as SIMD
element types. They can be stored in memory, and are represented as either all
zero bits or all one bits.
.. autocliftype:: b1 .. autocliftype:: b1
.. autocliftype:: b8 .. autocliftype:: b8

View File

@@ -4,13 +4,16 @@ The base.types module predefines all the Cranelift scalar types.
from __future__ import absolute_import from __future__ import absolute_import
from cdsl.types import IntType, FloatType, BoolType, FlagsType from cdsl.types import IntType, FloatType, BoolType, FlagsType
#: Boolean. #: Abstract boolean (can't be stored in memory, use bint to convert to 0 or 1).
b1 = BoolType(1) #: 1-bit bool. Type is abstract (can't be stored in mem) b1 = BoolType(1) #: 1-bit bool.
#: Booleans used as SIMD elements (can be stored in memory, true is all-ones).
b8 = BoolType(8) #: 8-bit bool. b8 = BoolType(8) #: 8-bit bool.
b16 = BoolType(16) #: 16-bit bool. b16 = BoolType(16) #: 16-bit bool.
b32 = BoolType(32) #: 32-bit bool. b32 = BoolType(32) #: 32-bit bool.
b64 = BoolType(64) #: 64-bit bool. b64 = BoolType(64) #: 64-bit bool.
# Integers.
i8 = IntType(8) #: 8-bit int. i8 = IntType(8) #: 8-bit int.
i16 = IntType(16) #: 16-bit int. i16 = IntType(16) #: 16-bit int.
i32 = IntType(32) #: 32-bit int. i32 = IntType(32) #: 32-bit int.