Title: | Mathematics at DEC |
Moderator: | RUSURE::EDP |
Created: | Mon Feb 03 1986 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 2083 |
Total number of notes: | 14613 |
Most compilers would compile A*B+C/D as LOAD A MULTIPLY B STORE TEMP LOAD C DIVIDE D ADD TEMP Show how to do this in one instruction less, using the same instruction repertoire. Explain why real-world compilers don't do it that way.
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
155.1 | ADVAX::J_ROTH | Fri Sep 21 1984 12:54 | 15 | ||
clearly, A*B + C/D = (A*B*D + C)/D load a mul b mul d add c div d I'd think there could be artifacts due to the increased dynamic range of values possible in the temporary expression A*B*D vs A*B only. Besides, you have more than 1 register available for fast temporaries. - Jim | |||||
155.2 | CHAMP::BILL | Fri Sep 21 1984 13:35 | 5 | ||
Besides, why do another multiply? Multiply and divide are usually slower than move. piper | |||||
155.3 | ORPHAN::BRETT | Sun Sep 23 1984 00:00 | 4 | ||
Besides, its an uncommon case /Bevin | |||||
155.4 | TURTLE::GILBERT | Sun Sep 23 1984 00:43 | 3 | ||
Overflow is also a possibility. Besides, if that's what the programer wanted, he should've written it that way. |