Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import std.stdio;
  2. import core.atomic;
  3. import core.thread;
  4. import core.sync.mutex;
  5. import std.datetime.stopwatch;
  6. import std.concurrency;
  7. import std.traits;
  8. import std.random;
  9. import std.algorithm;
  10. import std.conv;
  11. import core.simd;
  12. import core.stdc.string;
  13.  
  14.  
  15. float[4000] simd() {
  16. asd a;
  17. asd b;
  18. a.s[] = 10;
  19. b.s[] = 15;
  20. b.s[] += a.s[];
  21. return a.n;
  22. }
  23.  
  24. union asd {
  25. float4[1000] s;
  26. float[4000] n;
  27. }
  28.  
  29. float[4000] noSimd() {
  30. float[4000] a;
  31. float[4000] b;
  32. a[] = 10;
  33. b[] = 15;
  34. b[] += a[];
  35. return a;
  36. }
  37.  
  38.  
  39. void main()
  40. {
  41. writeln(benchmark!(simd, noSimd)(40));
  42. assert(simd() == noSimd());
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement