|
15-213 Introduction to Computer Systems
|
Nocona | Opteron | Pentium M | Pentium III | |
---|---|---|---|---|
Int + | 0.5/0.5 | 1/1? | 1/1 | 1/1 |
Int * | 10/1 | 3/1 | 4/1 | 4/1 |
Int / | 36/36 | 46/46 | 20/20 | 36/36 |
Long / | 106/106 | 76/76 | ||
FP + | 5/2 | 4/1 | 3/1 | 3/1 |
FP * | 7/2 | 4/1 | 5/2 | 5/2 |
Float / | 32 | 14 | 36 | 36 |
Double / | 4617 | 36 | 36 | |
Load | 3/1 | |||
Store | 3/1 |
Code slightly different from book, shown here using integer addition.
void combine(int* data, int n, int* dest) { int i; int r = 0; for (i = 0; i < n; i++) r = r + data[i]; *dest = r; }
Results:
CPE Int + Int * FP + FP * 2.20 10.00 5.00 7.00
Code slightly different from book, shown here using integer multiplication.
void combine_step2(int* data, int n, int* dest) { int i; int r0 = 1; /* even elements */ int r1 = 1; /* odd elements */ int limit = n-1; /* new limit for stepping by 2 */ for (i = 0; i < limit; i += 2) { r0 = r0 * data[i]; r1 = r1 * data[i+1]; } /* multiplying in possibly remaining elements (here at most one) */ for ( ; i < n; i++) r0 = r0 * data[i]; *dest = r0 * r1; }
Results:
CPE Int + Int * FP + FP * 1.50 5.00 2.50 3.50
[ Home
| Schedule
| Assignments
| Exams
| Lab Machines
| Resources
]
[ Textbook
| Autolab
]
[ Newsgroup
| Blackboard
]
fp@cs
Frank Pfenning