Stream: git-wasmtime

Topic: wasmtime / PR #3314 Implement bit operations for Cranelif...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 10:08):

dheaton-arm opened PR #3314 from implement-bitops to main:

Implemented for the Cranelift interpreter:

Copyright (c) 2021, Arm Limited

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:02):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:02):

afonso360 created PR review comment:

                let lanes = extractlanes(&arg(0)?, ctrl_ty.lane_type())?
                    .into_iter()
                    .map(|lane| lane.count_ones()?)
                    .collect::<ValueResult<SimdVec<V>>>()?;

                vectorizelanes(&new_vec, ctrl_ty)?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:02):

afonso360 created PR review comment:

Would it make sense for us to instead do a .convert(ValueConversionKind::Exact(ctrl_ty)), instead of casting to and from int?

        Opcode::Clz => assign(
            arg(0)?
                .leading_zeroes()?
                .convert(ValueConversionKind::Exact(ctrl_ty))?
         )?,

I think Exact would be able to both extend and reduce types? Although I'm not sure about converting from unsigned to signed types.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:02):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:03):

afonso360 edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:05):

afonso360 edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:07):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:07):

afonso360 created PR review comment:

Or we could cast it to the original type in the macro that leading_zeroes uses, so that it would always return the original type? I think that would also solve a lot of issues and make the rest of the interface cleaner.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:09):

afonso360 edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 11:32):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 17:47):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 17:47):

cfallin created PR review comment:

+1, iterator methods are clearer (to me at least!) and more idiomatic than the imperative loop style.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2021 at 08:38):

dheaton-arm updated PR #3314 from implement-bitops to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2021 at 11:23):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2021 at 11:23):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2021 at 11:23):

afonso360 created PR review comment:

A really nice thing you can do with iterators is collecting from an iterator of Result<T, _> into Result<Vec<T>, _>. This fails on the first Result that isn't Ok, which is exactly what we want! I think the rust book has a better explanation if you want to look more into it.

                    .map(|lane| lane.count_ones())
                    .collect::<ValueResult<SimdVec<V>>>()?;

view this post on Zulip Wasmtime GitHub notifications bot (Sep 13 2021 at 15:29):

dheaton-arm updated PR #3314 from implement-bitops to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 13 2021 at 16:29):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 13 2021 at 16:29):

cfallin merged PR #3314.


Last updated: Oct 23 2024 at 20:03 UTC