Skip to main content

Mojo struct

CompilationTarget

@register_passable(trivial) struct CompilationTarget[value: target = _current_target()]

A struct that provides information about a target architecture.

This struct encapsulates various methods to query target-specific information such as architecture features, OS details, endianness, and memory characteristics.

Parameters

  • value (target): The target architecture to query. Defaults to the current target.

Implemented traits

AnyType, Copyable, Movable, UnknownDestructibility

Methods

has_sse4

static has_sse4() -> Bool

Checks if the target supports SSE4 instructions.

Returns:

True if the target supports SSE4, False otherwise.

has_avx

static has_avx() -> Bool

Returns True if the host system has AVX, otherwise returns False.

Returns:

True if the host system has AVX, otherwise returns False.

has_avx2

static has_avx2() -> Bool

Returns True if the host system has AVX2, otherwise returns False.

Returns:

True if the host system has AVX2, otherwise returns False.

has_avx512f

static has_avx512f() -> Bool

Returns True if the host system has AVX512, otherwise returns False.

Returns:

True if the host system has AVX512, otherwise returns False.

is_x86

static is_x86() -> Bool

Checks if the target is an x86 architecture.

Returns:

True if the target is x86, False otherwise.

Was this page helpful?