diff --git a/stdlib/src/bit/bit.mojo b/stdlib/src/bit/bit.mojo index 5405411ab1..7f798ea101 100644 --- a/stdlib/src/bit/bit.mojo +++ b/stdlib/src/bit/bit.mojo @@ -283,7 +283,7 @@ fn bit_not[ """ constrained[type.is_integral(), "must be integral"]() var neg_one = SIMD[type, width](-1) - return __mlir_op.`pop.simd.xor`(val.value, neg_one.value) + return __mlir_op.`pop.simd.xor`(val._value, neg_one._value) # ===----------------------------------------------------------------------===# diff --git a/stdlib/src/builtin/dtype.mojo b/stdlib/src/builtin/dtype.mojo index 1391914b55..fa882f6df8 100644 --- a/stdlib/src/builtin/dtype.mojo +++ b/stdlib/src/builtin/dtype.mojo @@ -329,8 +329,8 @@ struct DType( return False return Bool( __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - __mlir_op.`pop.simd.and`(self._as_i8(), _mIsSigned.value), - UInt8(0).value, + __mlir_op.`pop.simd.and`(self._as_i8(), _mIsSigned._value), + UInt8(0)._value, ) ) @@ -347,8 +347,8 @@ struct DType( return False return Bool( __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - __mlir_op.`pop.simd.and`(self._as_i8(), _mIsSigned.value), - UInt8(0).value, + __mlir_op.`pop.simd.and`(self._as_i8(), _mIsSigned._value), + UInt8(0)._value, ) ) @@ -361,8 +361,8 @@ struct DType( """ return Bool( __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - __mlir_op.`pop.simd.and`(self._as_i8(), _mIsInteger.value), - UInt8(0).value, + __mlir_op.`pop.simd.and`(self._as_i8(), _mIsInteger._value), + UInt8(0)._value, ) ) @@ -389,8 +389,8 @@ struct DType( return False return Bool( __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - __mlir_op.`pop.simd.and`(self._as_i8(), _mIsFloat.value), - UInt8(0).value, + __mlir_op.`pop.simd.and`(self._as_i8(), _mIsFloat._value), + UInt8(0)._value, ) ) @@ -439,15 +439,15 @@ struct DType( return int( UInt8( __mlir_op.`pop.shl`( - UInt8(1).value, + UInt8(1)._value, __mlir_op.`pop.sub`( __mlir_op.`pop.shr`( __mlir_op.`pop.simd.and`( - self._as_i8(), _mIsNotInteger.value + self._as_i8(), _mIsNotInteger._value ), - UInt8(1).value, + UInt8(1)._value, ), - UInt8(3).value, + UInt8(3)._value, ), ) ) diff --git a/stdlib/src/builtin/file.mojo b/stdlib/src/builtin/file.mojo index 8313f1ed65..c90456c2c7 100644 --- a/stdlib/src/builtin/file.mojo +++ b/stdlib/src/builtin/file.mojo @@ -466,7 +466,7 @@ struct FileHandle: "KGEN_CompilerRT_IO_GetFD", Int64, ](self.handle) - return Int(i64_res.value) + return Int(i64_res._value) fn open[ diff --git a/stdlib/src/builtin/io.mojo b/stdlib/src/builtin/io.mojo index f859133386..d7c88fcf1b 100644 --- a/stdlib/src/builtin/io.mojo +++ b/stdlib/src/builtin/io.mojo @@ -260,7 +260,7 @@ fn _float_repr[ # Using `%.17g` with decimal check is equivalent to CPython's fallback path # when its more complex dtoa library (forked from # https://github.com/dtolnay/dtoa) is not available. - var n = _snprintf[fmt](buffer, size, x.value) + var n = _snprintf[fmt](buffer, size, x._value) # If the buffer isn't big enough to add anything, then just return. if n + 2 >= size: return n diff --git a/stdlib/src/builtin/math.mojo b/stdlib/src/builtin/math.mojo index 2506699f9d..0914eeb478 100644 --- a/stdlib/src/builtin/math.mojo +++ b/stdlib/src/builtin/math.mojo @@ -192,7 +192,7 @@ fn max(x: SIMD, y: __type_of(x), /) -> __type_of(x): A SIMD vector containing the elementwise maximum of x and y. """ constrained[x.type.is_numeric(), "the SIMD type must be numeric"]() - return __mlir_op.`pop.max`(x.value, y.value) + return __mlir_op.`pop.max`(x._value, y._value) # ===----------------------------------------------------------------------=== # @@ -246,7 +246,7 @@ fn min(x: SIMD, y: __type_of(x), /) -> __type_of(x): A SIMD vector containing the elementwise minimum of x and y. """ constrained[x.type.is_numeric(), "the SIMD type must be numeric"]() - return __mlir_op.`pop.min`(x.value, y.value) + return __mlir_op.`pop.min`(x._value, y._value) # ===----------------------------------------------------------------------=== # diff --git a/stdlib/src/builtin/object.mojo b/stdlib/src/builtin/object.mojo index f7587a8ac6..52938daf90 100644 --- a/stdlib/src/builtin/object.mojo +++ b/stdlib/src/builtin/object.mojo @@ -1802,10 +1802,10 @@ struct object( @always_inline fn _convert_index_to_int(i: object) raises -> Int: if i._value.is_bool(): - return i._value.convert_bool_to_int().get_as_int().value + return i._value.convert_bool_to_int().get_as_int()._value elif not i._value.is_int(): raise Error("TypeError: string indices must be integers") - return i._value.get_as_int().value + return i._value.get_as_int()._value @always_inline fn __getitem__(self, i: object) raises -> object: @@ -1831,7 +1831,7 @@ struct object( var char = self._value.get_as_string().data[index] impl.data.init_pointee_move(char) return _ObjectImpl(impl) - return self._value.get_list_element(i._value.get_as_int().value) + return self._value.get_list_element(i._value.get_as_int()._value) @always_inline fn __getitem__(self, *index: object) raises -> object: diff --git a/stdlib/src/builtin/simd.mojo b/stdlib/src/builtin/simd.mojo index e8eafc1525..3f60a7e23f 100644 --- a/stdlib/src/builtin/simd.mojo +++ b/stdlib/src/builtin/simd.mojo @@ -142,9 +142,9 @@ fn _unchecked_zero[type: DType, size: Int]() -> SIMD[type, size]: ]() ) return SIMD[type, size] { - value: __mlir_op.`pop.simd.splat`[ - _type = __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`] - ](zero) + _value: __mlir_op.`pop.simd.splat`[_type = SIMD[type, size]._mlir_type]( + zero + ) } @@ -201,9 +201,12 @@ struct SIMD[type: DType, size: Int]( # Fields alias _Mask = SIMD[DType.bool, size] - alias element_type = type - var value: __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`] + alias _mlir_type = __mlir_type[ + `!pop.simd<`, size.value, `, `, type.value, `>` + ] + + var _value: Self._mlir_type """The underlying storage for the vector.""" alias MAX = Self(_max_or_inf[type]()) @@ -280,9 +283,9 @@ struct SIMD[type: DType, size: Int]( var casted = __mlir_op.`pop.cast`[ _type = __mlir_type[`!pop.simd<1,`, type.value, `>`] ](t0) - self.value = __mlir_op.`pop.simd.splat`[ - _type = __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`] - ](casted) + self._value = __mlir_op.`pop.simd.splat`[_type = Self._mlir_type]( + casted + ) @always_inline("nodebug") fn __init__(inout self, value: IntLiteral): @@ -305,9 +308,9 @@ struct SIMD[type: DType, size: Int]( var casted = __mlir_op.`pop.cast`[ _type = __mlir_type[`!pop.simd<1,`, type.value, `>`] ](t0) - self.value = __mlir_op.`pop.simd.splat`[ - _type = __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`] - ](casted) + self._value = __mlir_op.`pop.simd.splat`[_type = Self._mlir_type]( + casted + ) @always_inline("nodebug") fn __init__(inout self: SIMD[DType.bool, size], value: Bool, /): @@ -323,14 +326,14 @@ struct SIMD[type: DType, size: Int]( var casted = __mlir_op.`pop.cast`[ _type = __mlir_type[`!pop.simd<1, bool>`] ](value._as_scalar_bool()) - self.value = __mlir_op.`pop.simd.splat`[ + self._value = __mlir_op.`pop.simd.splat`[ _type = __mlir_type[`!pop.simd<`, size.value, `, bool>`] ](casted) @always_inline("nodebug") fn __init__( inout self, - value: __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`], + value: Self._mlir_type, ): """Initializes the SIMD vector with the underlying mlir value. @@ -338,7 +341,7 @@ struct SIMD[type: DType, size: Int]( value: The input value. """ _simd_construction_checks[type, size]() - self.value = value + self._value = value @always_inline("nodebug") fn __init__(inout self, value: Scalar[type], /): @@ -352,9 +355,9 @@ struct SIMD[type: DType, size: Int]( _simd_construction_checks[type, size]() # Construct by broadcasting a scalar. - self.value = __mlir_op.`pop.simd.splat`[ - _type = __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`] - ](value.value) + self._value = __mlir_op.`pop.simd.splat`[_type = Self._mlir_type]( + value._value + ) @always_inline("nodebug") fn __init__(inout self, *elems: Scalar[type]): @@ -387,7 +390,7 @@ struct SIMD[type: DType, size: Int]( ], value = __mlir_attr[ `#kgen.unknown : `, - __mlir_type[`!pop.simd<`, size.value, `, `, type.value, `>`], + Self._mlir_type, ], ]() @@ -510,7 +513,7 @@ struct SIMD[type: DType, size: Int]( """ return __mlir_op.`pop.simd.extractelement`[ _type = __mlir_type[`!pop.scalar<`, type.value, `>`] - ](self.value, index(idx).value) + ](self._value, index(idx).value) @always_inline("nodebug") fn __setitem__(inout self, idx: Int, val: Scalar[type]): @@ -520,8 +523,8 @@ struct SIMD[type: DType, size: Int]( idx: The index to set. val: The value to set. """ - self.value = __mlir_op.`pop.simd.insertelement`( - self.value, val.value, index(idx).value + self._value = __mlir_op.`pop.simd.insertelement`( + self._value, val._value, index(idx).value ) fn __contains__(self, value: Scalar[type]) -> Bool: @@ -559,7 +562,7 @@ struct SIMD[type: DType, size: Int]( elif _is_sm_8x() and type.is_half_float(): return self.fma(1, rhs) - return __mlir_op.`pop.add`(self.value, rhs.value) + return __mlir_op.`pop.add`(self._value, rhs._value) @always_inline("nodebug") fn __sub__(self, rhs: Self) -> Self: @@ -585,7 +588,7 @@ struct SIMD[type: DType, size: Int]( elif _is_sm_8x() and type.is_half_float(): return rhs.fma(-1, self) - return __mlir_op.`pop.sub`(self.value, rhs.value) + return __mlir_op.`pop.sub`(self._value, rhs._value) @always_inline("nodebug") fn __mul__(self, rhs: Self) -> Self: @@ -615,7 +618,7 @@ struct SIMD[type: DType, size: Int]( return self.fma(rhs, -0.0) constrained[type.is_numeric(), "the SIMD type must be numeric"]() - return __mlir_op.`pop.mul`(self.value, rhs.value) + return __mlir_op.`pop.mul`(self._value, rhs._value) @always_inline("nodebug") fn __truediv__(self, rhs: Self) -> Self: @@ -629,7 +632,7 @@ struct SIMD[type: DType, size: Int]( `self[i] / rhs[i]`. """ constrained[type.is_numeric(), "the SIMD type must be numeric"]() - return __mlir_op.`pop.div`(self.value, rhs.value) + return __mlir_op.`pop.div`(self._value, rhs._value) @always_inline("nodebug") fn __floordiv__(self, rhs: Self) -> Self: @@ -684,7 +687,7 @@ struct SIMD[type: DType, size: Int]( @parameter if type.is_unsigned(): - return __mlir_op.`pop.rem`(self.value, rhs.value) + return __mlir_op.`pop.rem`(self._value, rhs._value) else: var div = self / rhs @@ -741,7 +744,7 @@ struct SIMD[type: DType, size: Int]( """ return __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - self.value, rhs.value + self._value, rhs._value ) @always_inline("nodebug") @@ -758,7 +761,7 @@ struct SIMD[type: DType, size: Int]( """ return __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - self.value, rhs.value + self._value, rhs._value ) @always_inline("nodebug") @@ -783,7 +786,7 @@ struct SIMD[type: DType, size: Int]( return int_self == int_rhs else: return __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - self.value, rhs.value + self._value, rhs._value ) @always_inline("nodebug") @@ -808,7 +811,7 @@ struct SIMD[type: DType, size: Int]( return int_self != int_rhs else: return __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - self.value, rhs.value + self._value, rhs._value ) @always_inline("nodebug") @@ -825,7 +828,7 @@ struct SIMD[type: DType, size: Int]( """ return __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - self.value, rhs.value + self._value, rhs._value ) @always_inline("nodebug") @@ -842,7 +845,7 @@ struct SIMD[type: DType, size: Int]( """ return __mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop`]( - self.value, rhs.value + self._value, rhs._value ) @always_inline("nodebug") @@ -863,7 +866,7 @@ struct SIMD[type: DType, size: Int]( The negation of this SIMD vector. """ constrained[type.is_numeric(), "the SIMD type must be numeric"]() - return __mlir_op.`pop.neg`(self.value) + return __mlir_op.`pop.neg`(self._value) @always_inline("nodebug") fn __and__(self, rhs: Self) -> Self: @@ -882,7 +885,7 @@ struct SIMD[type: DType, size: Int]( type.is_integral() or type is DType.bool, "must be an integral or bool type", ]() - return __mlir_op.`pop.simd.and`(self.value, rhs.value) + return __mlir_op.`pop.simd.and`(self._value, rhs._value) @always_inline("nodebug") fn __xor__(self, rhs: Self) -> Self: @@ -901,7 +904,7 @@ struct SIMD[type: DType, size: Int]( type.is_integral() or type is DType.bool, "must be an integral or bool type", ]() - return __mlir_op.`pop.simd.xor`(self.value, rhs.value) + return __mlir_op.`pop.simd.xor`(self._value, rhs._value) @always_inline("nodebug") fn __or__(self, rhs: Self) -> Self: @@ -920,7 +923,7 @@ struct SIMD[type: DType, size: Int]( type.is_integral() or type is DType.bool, "must be an integral or bool type", ]() - return __mlir_op.`pop.simd.or`(self.value, rhs.value) + return __mlir_op.`pop.simd.or`(self._value, rhs._value) @always_inline("nodebug") fn __lshift__(self, rhs: Self) -> Self: @@ -940,7 +943,7 @@ struct SIMD[type: DType, size: Int]( debug_assert( all(rhs < bitwidthof[type]()), "unhandled value greater than size" ) - return __mlir_op.`pop.shl`(self.value, rhs.value) + return __mlir_op.`pop.shl`(self._value, rhs._value) @always_inline("nodebug") fn __rshift__(self, rhs: Self) -> Self: @@ -960,7 +963,7 @@ struct SIMD[type: DType, size: Int]( debug_assert( all(rhs < bitwidthof[type]()), "unhandled value greater than size" ) - return __mlir_op.`pop.shr`(self.value, rhs.value) + return __mlir_op.`pop.shr`(self._value, rhs._value) @always_inline("nodebug") fn __invert__(self) -> Self: @@ -1372,7 +1375,7 @@ struct SIMD[type: DType, size: Int]( " instead." ), ]() - return rebind[Scalar[DType.bool]](self.cast[DType.bool]()).value + return rebind[Scalar[DType.bool]](self.cast[DType.bool]())._value @always_inline("nodebug") fn __int__(self) -> Int: @@ -1398,7 +1401,7 @@ struct SIMD[type: DType, size: Int]( else: return __mlir_op.`pop.cast`[ _type = __mlir_type.`!pop.scalar` - ](rebind[Scalar[type]](self).value) + ](rebind[Scalar[type]](self)._value) @always_inline("nodebug") fn __float__(self) -> Float64: @@ -1412,7 +1415,7 @@ struct SIMD[type: DType, size: Int]( """ constrained[size == 1, "expected a scalar type"]() return __mlir_op.`pop.cast`[_type = __mlir_type.`!pop.scalar`]( - rebind[Scalar[type]](self).value + rebind[Scalar[type]](self)._value ) @no_inline @@ -1623,7 +1626,7 @@ struct SIMD[type: DType, size: Int]( target.value, `>`, ] - ](self.value) + ](self._value) @no_inline fn write_to[W: Writer](self, inout writer: W): @@ -1844,7 +1847,7 @@ struct SIMD[type: DType, size: Int]( return res return __mlir_op.`pop.fma`( - self.value, multiplier.value, accumulator.value + self._value, multiplier._value, accumulator._value ) @always_inline("nodebug") @@ -1913,7 +1916,7 @@ struct SIMD[type: DType, size: Int]( _type = __mlir_type[ `!pop.simd<`, output_size.value, `, `, type.value, `>` ], - ](self.value, other.value) + ](self._value, other._value) @always_inline("nodebug") fn _shuffle_list[ @@ -1947,7 +1950,7 @@ struct SIMD[type: DType, size: Int]( _type = __mlir_type[ `!pop.simd<`, output_size.value, `, `, type.value, `>` ], - ](self.value, other.value) + ](self._value, other._value) @always_inline("nodebug") fn shuffle[*mask: Int](self) -> Self: @@ -2633,9 +2636,9 @@ struct SIMD[type: DType, size: Int]( """ constrained[type is DType.bool, "the simd dtype must be bool"]() return __mlir_op.`pop.simd.select`( - rebind[Self._Mask](self).value, - true_case.value, - false_case.value, + rebind[Self._Mask](self)._value, + true_case._value, + false_case._value, ) # ===------------------------------------------------------------------=== # diff --git a/stdlib/src/hashlib/_ahash.mojo b/stdlib/src/hashlib/_ahash.mojo index 9770fe84ac..eb5d6f2042 100644 --- a/stdlib/src/hashlib/_ahash.mojo +++ b/stdlib/src/hashlib/_ahash.mojo @@ -35,10 +35,10 @@ fn _folded_multiply(lhs: UInt64, rhs: UInt64) -> UInt64: A value which is similar in its bitpattern to result of a folded multply. """ l = __mlir_op.`pop.cast`[_type = __mlir_type.`!pop.scalar`]( - lhs.value + lhs._value ) r = __mlir_op.`pop.cast`[_type = __mlir_type.`!pop.scalar`]( - rhs.value + rhs._value ) m = __mlir_op.`pop.mul`(l, r) res = SIMD[DType.uint64, 2]( diff --git a/stdlib/src/memory/unsafe.mojo b/stdlib/src/memory/unsafe.mojo index 93d7e2266b..fbe3bb4b32 100644 --- a/stdlib/src/memory/unsafe.mojo +++ b/stdlib/src/memory/unsafe.mojo @@ -61,7 +61,7 @@ fn bitcast[ _type = __mlir_type[ `!pop.simd<`, new_width.value, `, `, new_type.value, `>` ] - ](val.value) + ](val._value) @always_inline("nodebug") @@ -118,4 +118,4 @@ fn bitcast[ return __mlir_op.`pop.bitcast`[ _type = __mlir_type[`!pop.scalar<`, new_type.value, `>`] - ](val.value) + ](val._value) diff --git a/stdlib/src/os/atomic.mojo b/stdlib/src/os/atomic.mojo index 6b7bd43d90..91ff77e7ad 100644 --- a/stdlib/src/os/atomic.mojo +++ b/stdlib/src/os/atomic.mojo @@ -84,7 +84,7 @@ struct Atomic[type: DType]: _type = __mlir_type[`!pop.scalar<`, type.value, `>`], ]( ptr.bitcast[__mlir_type[`!pop.scalar<`, type.value, `>`]]().address, - rhs.value, + rhs._value, ) @always_inline @@ -137,12 +137,12 @@ struct Atomic[type: DType]: Returns: The original value before subtraction. """ - var value_addr = UnsafePointer.address_of(self.value.value) + var value_addr = UnsafePointer.address_of(self.value._value) return __mlir_op.`pop.atomic.rmw`[ bin_op = __mlir_attr.`#pop`, ordering = __mlir_attr.`#pop`, _type = __mlir_type[`!pop.scalar<`, type.value, `>`], - ](value_addr.address, rhs.value) + ](value_addr.address, rhs._value) @always_inline fn __isub__(inout self, rhs: Scalar[type]): @@ -301,8 +301,8 @@ fn _compare_exchange_weak_integral_impl[ value_addr.bitcast[ __mlir_type[`!pop.scalar<`, type.value, `>`] ]().address, - expected.value, - desired.value, + expected._value, + desired._value, ) var ok = Bool( __mlir_op.`kgen.struct.extract`[index = __mlir_attr.`1:index`]( @@ -323,7 +323,7 @@ fn _max_impl_base[ bin_op = __mlir_attr.`#pop`, ordering = __mlir_attr.`#pop`, _type = __mlir_type[`!pop.scalar<`, type.value, `>`], - ](value_addr.address, rhs.value) + ](value_addr.address, rhs._value) @always_inline @@ -335,7 +335,7 @@ fn _min_impl_base[ bin_op = __mlir_attr.`#pop`, ordering = __mlir_attr.`#pop`, _type = __mlir_type[`!pop.scalar<`, type.value, `>`], - ](value_addr.address, rhs.value) + ](value_addr.address, rhs._value) @always_inline diff --git a/stdlib/src/python/python_object.mojo b/stdlib/src/python/python_object.mojo index 13715b01f4..9d9773936a 100644 --- a/stdlib/src/python/python_object.mojo +++ b/stdlib/src/python/python_object.mojo @@ -384,7 +384,7 @@ struct PythonObject( if dt is DType.bool: self.py_object = cpython.PyBool_FromLong(int(value)) elif dt.is_integral(): - int_val = value.cast[DType.index]().value + int_val = value.cast[DType.index]()._value self.py_object = cpython.PyLong_FromSsize_t(int_val) else: fp_val = value.cast[DType.float64]() diff --git a/stdlib/src/utils/numerics.mojo b/stdlib/src/utils/numerics.mojo index a52594be68..9c5a07960c 100644 --- a/stdlib/src/utils/numerics.mojo +++ b/stdlib/src/utils/numerics.mojo @@ -568,7 +568,7 @@ fn isnan[ alias quiet_nan_test: UInt32 = 0x0002 return llvm_intrinsic[ "llvm.is.fpclass", SIMD[DType.bool, simd_width], has_side_effect=False - ](val.value, (signaling_nan_test | quiet_nan_test)) + ](val._value, (signaling_nan_test | quiet_nan_test)) # ===----------------------------------------------------------------------=== # @@ -887,7 +887,7 @@ fn isinf[ alias negative_infinity_test: UInt32 = 0x0004 alias positive_infinity_test: UInt32 = 0x0200 return llvm_intrinsic["llvm.is.fpclass", SIMD[DType.bool, simd_width]]( - val.value, (negative_infinity_test | positive_infinity_test) + val._value, (negative_infinity_test | positive_infinity_test) ) @@ -920,7 +920,7 @@ fn isfinite[ return True return llvm_intrinsic["llvm.is.fpclass", SIMD[DType.bool, simd_width]]( - val.value, UInt32(0x1F8) + val._value, UInt32(0x1F8) )