Skip to content

i8/i16 values with limited operators #1049

Closed
@AndrewScheidecker

Description

@AndrewScheidecker

previous discussion: #85

Looking at the atomics proposal, there are a lot of operators that are only necessary because WASM doesn't have i8 and i16 value types. e.g. here are the operators for atomic adds:

  • i32.atomic.rmw8_s.add
  • i32.atomic.rmw8_u.add
  • i32.atomic.rmw16_s.add
  • i32.atomic.rmw16_u.add
  • i32.atomic.rmw.add
  • i64.atomic.rmw8_s.add
  • i64.atomic.rmw8_u.add
  • i64.atomic.rmw16_s.add
  • i64.atomic.rmw16_u.add
  • i64.atomic.rmw32_s.add
  • i64.atomic.rmw32_u.add
  • i64.atomic.rmw.add

If there were i8 and i16 value types, those could be simplified to:

  • i8.atomic.rmw.add
  • i16.atomic.rmw.add
  • i32.atomic.rmw.add
  • i64.atomic.rmw.add

The same applies to the atomic xchg, cmpxchg, load, sub, and, or, and xor operators.

Would folks consider adding i8 and i16 types that have a limited set of conversion operators meant for composition with the memory loads/stores? e.g. for i8:

  • i8.wrap/i32 / i8.wrap/i64
  • i32.extend_s/i8 / i64.extend_s/i8
  • i32.extend_u/i8 / i64.extend_u/i8

Metadata

Metadata

Assignees

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