Bug 10444 – writeln of a SIMD register

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-22T07:33:30Z
Last change time
2017-10-16T09:57:54Z
Keywords
pull, SIMD
Assigned to
No Owner
Creator
bearophile_hugs
Depends on
17823

Comments

Comment #0 by bearophile_hugs — 2013-06-22T07:33:30Z
import std.stdio, core.simd; void main() { ubyte16 x; writeln(x); // Error } DMD 2.064alpha gives a long sequence of errors: ...\format.d(2950): Error: template std.format.formatValue does not match any function template declaration. Candidates are: ... test.d(4): Error: template instance std.stdio.writeln!(__vector(ubyte[16u])) error instantiating The workaround is to use .array: writeln(x.array); // OK But I'd like writeln to write SIMD values as ubyte16 even without .array for greater uniformity in debugging code.
Comment #1 by bearophile_hugs — 2013-06-23T15:06:28Z
It's kind of needed to print arrays of simd vectors: import std.stdio: writeln; import core.simd: int4; void main() { int4[] v = [[1, 2, 3, 4], [5, 6, 7, 8]]; writeln(v[0].array, " ", v[1].array); // OK writeln(v); // error }
Comment #2 by briancschott — 2014-06-01T00:11:43Z
https://github.com/D-Programming-Language/phobos/pull/2220 Arrays of SIMD types seem to not work due to DMD codegen bugs, but this fixes the case of a single SIMD type being printed.
Comment #3 by yebblies — 2014-06-01T00:42:54Z
Comment #4 by github-bugzilla — 2017-09-13T15:26:10Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e606879eac5db9aa66967965a096c3780f64bcd6 fix issue 10444 - writeln of a SIMD register https://github.com/dlang/phobos/commit/bb1e6f9d508e7131d5c9ea84ae1955739e116608 Merge pull request #5730 from BBasile/issue-10444 fix issue 10444 - writeln of a SIMD register
Comment #5 by github-bugzilla — 2017-10-16T09:57:54Z