Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Include vectorized rotate instructions #5

Description

@stoklund

@AndrewScheidecker mentioned in his review of #1 the possibility of including vectorized rotate instructions to match the existing scalar instructions. They would have these signatures:

  • i8x16.rotl(x: v128, n: i32) -> v128
  • i16x8.rotl(x: v128, n: i32) -> v128
  • i32x4.rotl(x: v128, n: i32) -> v128
  • i64x2.rotl(x: v128, n: i32) -> v128
  • i8x16.rotr(x: v128, n: i32) -> v128
  • i16x8.rotr(x: v128, n: i32) -> v128
  • i32x4.rotr(x: v128, n: i32) -> v128
  • i64x2.rotr(x: v128, n: i32) -> v128

The semantics would be to rotate the lanes independently by the scalar n. This can be expressed in terms of the vectorized shift operators:

«T».rotl(x, n) = v128.or(«T».shl(x, n), «T».shr_u(x, -n))
«T».rotr(x, n) = v128.or(«T».shl(x, -n), «T».shr_u(x, n))

Questions:

  • Are vectorized rotate instructions available in SIMD instruction sets we care about?
  • Are there plausible applications for vectorized rotates?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions