Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm: Fix floating point arguments in arm
The designated initializer in C makes implicit memset internally in arm architecture. Due to the memset, VFP registers are clobbered unexpectedly, so this patch fixes the problem by replacing the designated initializer to explicit 'mcount_memset4'. In addition, the offset of VFP registers were incorrect because the following commit pushs d1 register on top of the original d0. ffb69ce arm: Handle struct return type by keeping more regs on stack So the offset is adjusted from -2 to -4 to cope with the change. Source: #include <stdio.h> float float_add(float a, float b) { fprintf(stderr, "a = %f, b = %f\n", a, b); return a + b; } int main(int argc, char *argv[]) { double c; c = float_add(-0.1, 0.2); fprintf(stderr, "c = %f\n", c); return c > 0; } Before: $ uftrace -a -F main a.out a = 0.000000, b = 0.000000 c = 0.000000 # DURATION TID FUNCTION [ 25362] | main(1, 0x7ea25344) { [ 25362] | float_add(0.000000, 0.000000) { 503.228 us [ 25362] | fprintf(&_IO_2_1_stderr_, "a = %f, b = %f\n") = 27; 511.197 us [ 25362] | } = 0.000000; /* float_add */ 9.687 us [ 25362] | fprintf(&_IO_2_1_stderr_, "c = %f\n") = 13; 531.977 us [ 25362] | } = 0; /* main */ After: $ uftrace -a -F main a.out a = -0.100000, b = 0.200000 c = 0.100000 # DURATION TID FUNCTION [ 25146] | main(1, 0x7edbb344) { [ 25146] | float_add(-0.100000, 0.200000) { 501.769 us [ 25146] | fprintf(&_IO_2_1_stderr_, "a = %f, b = %f\n") = 28; 509.321 us [ 25146] | } = 0.100000; /* float_add */ 12.500 us [ 25146] | fprintf(&_IO_2_1_stderr_, "c = %f\n") = 13; 533.539 us [ 25146] | } = 1; /* main */ Fixed: #1088 Signed-off-by: Honggyu Kim <[email protected]>
- Loading branch information