cts icon indicating copy to clipboard operation
cts copied to clipboard

wgsl: Bitwise tests

Open dj2 opened this issue 3 years ago • 0 comments

Complement

  • [x] ~ for i32, u32 and vec of each
  • [x] ~ for AbstractInt, and vectors of AbstractInt

Or, And, XOR

(|, & and ^ already have tests in shader/execution/expression/binary/bitwise.spec.ts) For each of those, validate mixed types fails to parse

Left Shift expressions

  • [x] 1 << 2
  • [x] Modulo for i32/u32 shift e.g. 1i << 33 shifts == 2
  • [ ] most significant bits must be same for abstract (1<<63 is error, 2 <<62, etc)
  • [ ] 1 << -1 is validation error
  • [x] 1i << -1 is validation error
  • [x] 1u << -1 is validation error
  • [x] Component wise shift with vec
  • [x] vec sizes don't match for shift is error

Right shift expressions

  • [x] 0x80000000{i|u} >> 32 == 0x8000000 (shift is modulo)
  • [x] 0x80000000{i|u} >> 31 == 1
  • [x] 0x80000000 >> 32 == 0 (abstract)
  • [x] 1{i32, u32} >> -1 is validation error
  • [ ] 1{Abstract} >> -1 is validation error
  • [x] vec sizes don't match is validation error
  • [x] vec shifts component wise.

dj2 avatar Jul 06 '22 15:07 dj2