Advertisement
sthalik

copysignf intrinsic

Aug 13th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; Source code, avoids constant propagation
  2.  
  3. ;;#include <math.h>
  4. ;;extern volatile float place, a, b;
  5. ;;__attribute__((noinline))
  6. ;;void foo() { place = copysignf(a, b); }
  7.  
  8. ;; GCC 8.2, -O3 -march=skylake -c -ffast-math
  9. foo():
  10.         vmovss  xmm1, DWORD PTR b[rip]
  11.         vmovss  xmm0, DWORD PTR a[rip]
  12.         vmovaps xmm2, xmm1
  13.         vandps  xmm2, xmm2, XMMWORD PTR .LC1[rip]
  14.         vandps  xmm0, xmm0, XMMWORD PTR .LC0[rip]
  15.         vorps   xmm0, xmm0, xmm2
  16.         vmovss  DWORD PTR place[rip], xmm0
  17.         ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement