Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 26, 2023 [Issue 23746] ICE with bit-wise binops with vector masks | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23746 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw@gdcproject.org --- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> --- (In reply to kinke from comment #0) > As shown in the example, working with vector masks is very cumbersome as of v2.102, requiring reinterpret-casts all over the place. Only for vector floats though. The result of a comparison is either all bits are zeros or ones. For floats, that's `0` or `nan`. > return (min & ltMask) You can't use bitwise operations on scalar floats, why would you expect it to be valid on vector floats? -- |
February 26, 2023 [Issue 23746] ICE with bit-wise binops with vector masks | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23746 --- Comment #2 from kinke <kinke@gmx.net> --- (In reply to Iain Buclaw from comment #1) > The result of a comparison is either all bits are zeros or ones. For floats, that's `0` or `nan`. The only usage of the new vector masks, at least that I can think of, are masking operations via bitwise ops. What the bit pattern represents for a specific vector element type plays no role whatsoever. > > return (min & ltMask) > You can't use bitwise operations on scalar floats, why would you expect it to be valid on vector floats? Because then we don't need vector masks and elaborate vector comparisons in the first place, a library solution would do. -- |
February 27, 2023 [Issue 23746] ICE with bit-wise binops with vector masks | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23746 --- Comment #3 from kinke <kinke@gmx.net> --- Oh, I've just seen that `cast(int4) someFloat4` is a reinterpret cast with both LDC and GDC, but not with DMD (=> conversion). So would need to uglify further to please DMD, rendering vector masks with FP vectors next to useless. That reinterpret-cast with LDC and GDC would be another difference from scalar vs. vector. While bitwise ops for a scalar FP type don't really make much sense, they are IMO key to making vector masks nice to work with in practice. Oh and LDC is apparently the only compiler allowing the most trivial of comparisons - identity comparisons (yielding a scalar bool). So the other non-bitop use case for such vector masks, manually reducing to a scalar (e.g., `mask is 0`) currently only works with LDC, and needs a full array comparison and boilerplate syntax with the other compilers (`mask.array == [0, 0, 0, 0]`). -- |
February 27, 2023 [Issue 23746] ICE with bit-wise binops with vector masks | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23746 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation