Cretonne base instruction set. This module defines the basic Cretonne instruction set that all targets support. """ from __future__ import absolute_import from cdsl.operands import Operand, VARIABLE_ARGS from cdsl.typevar import TypeVar from cdsl.instructions import Instruction, InstructionGroup from base.types import i8, f32, f64, b1 from base.immediates import imm64, uimm8, ieee32, ieee64, immvector from base.immediates import intcc, floatcc from base import entities import base.formats # noqa GROUP = InstructionGroup("base", "Shared base instruction set") Int = TypeVar('Int', 'A scalar or vector integer type', ints=True, simd=True) iB = TypeVar('iB', 'A scalar integer type', ints=True) iPtr = TypeVar('iB', 'An integer address type', ints=(32, 64)) Testable = TypeVar( 'Testable', 'A scalar boolean or integer type', ints=True, bools=True) TxN = TypeVar( 'TxN', 'A SIMD vector type', ints=True, floats=True, bools=True, scalars=False, simd=True) Any = TypeVar( 'Any', 'Any integer, float, or boolean scalar or vector type', ints=True, floats=True, bools=True, scalars=True, simd=True) #
""" Supplementary instruction definitions for Intel. This module defines additional instructions that are useful only to the Intel target ISA. """ from cdsl.operands import Operand from cdsl.typevar import TypeVar from cdsl.instructions import Instruction, InstructionGroup GROUP = InstructionGroup("x86", "Intel-specific instruction set") iWord = TypeVar('iWord', 'A scalar integer machine word', ints=(32, 64)) nlo = Operand('nlo', iWord, doc='Low part of numerator') nhi = Operand('nhi', iWord, doc='High part of numerator') d = Operand('d', iWord, doc='Denominator') q = Operand('q', iWord, doc='Quotient') r = Operand('r', iWord, doc='Remainder') udivmodx = Instruction('x86_udivmodx', r""" Extended unsigned division. Concatenate the bits in `nhi` and `nlo` to form the numerator. Interpret the bits as an unsigned number and divide by the unsigned denominator `d`. Trap when `d` is zero or if the quotient is larger than the range of the output. Return both quotient and remainder.
Cranelift primitive instruction set. This module defines a primitive instruction set, in terms of which the base set is described. Most instructions in this set correspond 1-1 with an SMTLIB bitvector function. """ from __future__ import absolute_import from cdsl.operands import Operand from cdsl.typevar import TypeVar from cdsl.instructions import Instruction, InstructionGroup from cdsl.ti import WiderOrEq from base.types import b1 from base.immediates import imm64 import base.formats # noqa GROUP = InstructionGroup("primitive", "Primitive instruction set") BV = TypeVar('BV', 'A bitvector type.', bitvecs=True) BV1 = TypeVar('BV1', 'A single bit bitvector.', bitvecs=(1, 1)) Real = TypeVar('Real', 'Any real type.', ints=True, floats=True, bools=True, simd=True) x = Operand('x', BV, doc="A semantic value X") y = Operand('x', BV, doc="A semantic value Y (same width as X)") a = Operand('a', BV, doc="A semantic value A (same width as X)") cond = Operand('b', TypeVar.singleton(b1), doc='A b1 value')
""" Useful semantics "macro" instructions built on top of the primitives. """ from __future__ import absolute_import from cdsl.operands import Operand from cdsl.typevar import TypeVar from cdsl.instructions import Instruction, InstructionGroup from base.types import b1 from base.immediates import imm64 from cdsl.ast import Var from cdsl.xform import Rtl from semantics.primitives import bv_from_imm64, bvite import base.formats # noqa GROUP = InstructionGroup("primitive_macros", "Semantic macros instruction set") AnyBV = TypeVar('AnyBV', bitvecs=True, doc="") x = Var('x') y = Var('y') imm = Var('imm') a = Var('a') # # Bool-to-bv1 # BV1 = TypeVar("BV1", bitvecs=(1, 1), doc="") bv1_op = Operand('bv1_op', BV1, doc="") cond_op = Operand("cond", b1, doc="") bool2bv = Instruction('bool2bv', r"""Convert a b1 value to a 1-bit BV""", ins=cond_op,
Cretonne base instruction set. This module defines the basic Cretonne instruction set that all targets support. """ from __future__ import absolute_import from cdsl.operands import Operand, VARIABLE_ARGS from cdsl.typevar import TypeVar from cdsl.instructions import Instruction, InstructionGroup from base.types import i8, f32, f64, b1 from base.immediates import imm64, uimm8, ieee32, ieee64, immvector from base.immediates import intcc, floatcc from base import entities import base.formats # noqa GROUP = InstructionGroup("base", "Shared base instruction set") Int = TypeVar('Int', 'A scalar or vector integer type', ints=True, simd=True) iB = TypeVar('iB', 'A scalar integer type', ints=True) iAddr = TypeVar('iAddr', 'An integer address type', ints=(32, 64)) Testable = TypeVar('Testable', 'A scalar boolean or integer type', ints=True, bools=True) TxN = TypeVar('TxN', 'A SIMD vector type', ints=True, floats=True, bools=True, scalars=False, simd=True)