Machine level representation of c programs the body

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hould produce the exact same results whether or not optimization is enabled. Unfortunately GCC does not satisfy this requirement for floating-point code. End Aside. Finally, we can have GCC use extended precision in all of its computations by declaring all of the variables to be long double as shown in the following code: code/asm/fcomp.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 long double recip_l(int denom) { return 1.0/(long double) denom; } void test3(int denom) { long double r1, r2; int t1, t2; r1 = recip_l(denom); /* Stored in memory r2 = recip_l(denom); /* Stored in register t1 = r1 == r2; /* Compares register to memory do_nothing(); /* Forces register save to memory t2 = r1 == r2; /* Compares memory to memory printf("test3 t1: r1 %f %c= r2 %f\n", (double) r1, t1 ? ’=’ : ’!’, (double) r2); */ */ */ */ */ 176 CHAPTER 3. MACHINE-LEVEL REPRESENTATION OF C PROGRAMS Instruction load S storep D neg addp subp multp divp Effect Push value at S onto stack Pop top stack element and...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online