Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stdlib] Rename SIMD.value to SIMD._value. #3693

Open
wants to merge 1 commit into
base: nightly
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/src/bit/bit.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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)


# ===----------------------------------------------------------------------===#
Expand Down
24 changes: 12 additions & 12 deletions stdlib/src/builtin/dtype.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ struct DType(
return False
return Bool(
__mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop<cmp_pred eq>`](
__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,
)
)

Expand All @@ -347,8 +347,8 @@ struct DType(
return False
return Bool(
__mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop<cmp_pred ne>`](
__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,
)
)

Expand All @@ -361,8 +361,8 @@ struct DType(
"""
return Bool(
__mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop<cmp_pred ne>`](
__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,
)
)

Expand All @@ -389,8 +389,8 @@ struct DType(
return False
return Bool(
__mlir_op.`pop.cmp`[pred = __mlir_attr.`#pop<cmp_pred ne>`](
__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,
)
)

Expand Down Expand Up @@ -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,
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/builtin/file.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/builtin/io.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions stdlib/src/builtin/math.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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)


# ===----------------------------------------------------------------------=== #
Expand Down Expand Up @@ -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)


# ===----------------------------------------------------------------------=== #
Expand Down
6 changes: 3 additions & 3 deletions stdlib/src/builtin/object.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Loading