Guest User

Untitled

a guest
Sep 15th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.88 KB | None | 0 0
  1. module fstress.utils;
  2.  
  3. const long
  4.     sample_size = 1000000000,
  5.     op_size     = 8;
  6.  
  7. private const float
  8.     a = 1.2345f,
  9.     b = 2.3456f,
  10.     c = 3.4567f;
  11. private const real
  12.     ca = 1.2345f,
  13.     cb = 2.3456f,
  14.     cc = 3.4567f;
  15.  
  16. // Perform floating point operations in general
  17. // purpose registers (EAX, EBX, ECX, EDX)
  18. void FPBenchGPR() {
  19.     asm {
  20.         mov EAX, a      ;
  21.         mov EBX, b      ;
  22.         mov ECX, c      ;
  23.         div EAX, EBX    ;
  24.         imul ECX, EAX   ;
  25.         add EBX, ECX    ;
  26.         sub ECX, EAX    ;
  27.     }
  28. }
  29.  
  30. // Perform floating point operations in SSE registers
  31. // (XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7)
  32. void FPBenchXMM() {
  33.     asm {
  34.         movaps XMM0, ca;
  35.         movaps XMM1, cb;
  36.         movaps XMM2, cc;
  37.         divps XMM0, XMM1;
  38.         mulps XMM2, XMM0;
  39.         addps XMM1, XMM2;
  40.         subps XMM2, XMM0;
  41.     }
  42. }
Add Comment
Please, Sign In to add comment