Prevent optimization of arithmetic computation
I need to implement this paper Page 5, there is a function void Split(double a, double *x, double *y) { double z = a * ((1 << r) + 1); *x = z - (z - a); *y = a - *x; } With -O3 (which I need for the rest of the program, gcc sees that z - (z - a) can be simplified to a (but only when function is inlined) : Split(double, double*, double*): movsd .LC0(%rip), %xmm1 mulsd %xmm0, %xmm1 movapd %xmm1, %xmm2 subsd %xmm0, %xmm2 subsd %xmm2, %xmm1 subsd %xmm1, %xmm0 movsd %xmm1, (%rdi) movsd %xmm0, (%rsi) ret .LC3: .string "%lf -- %lf\n" main: subq $8, %rsp movl $.LC3, %edi movl $2, %eax movsd .LC1(%rip)
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.