Homework 3

CMSC 411 / Olano, Fall 2013


October 8, 2013

  1. Performance

    Find SPECint and SPECfloat results for two systems by different manufacturers on the SPEC benchmark page (SPECint:www.spec.org/cpu2006/results/cint2006.html, SPECfloat:www.spec.org/cpu2006/results/cfp2006.html). Say we want to model the workload for a task that consists of 3D rendering and video encoding of the rendered frames. Compare the speedup for a workloads with varying ratios of the povray 3D renderer (povray in SPECfloat) and h264 video compression (h264ref in SPECint): 100% povray, 75% povray / 25% h264, 50% povray / 50% h264, 25% povray / 75% h264, or 100% h264. Be sure to say exactly which systems you compared, and the relevant SPEC numbers for each. Use the median peak performance number for each benchmark.

  2. Multiplication

    Write a C program in a single source code file called "mult.c" implementing the standard algorithm for signed multiplication of 32-bit integers, producing a 64-bit result. You should only use integer addition, subtraction, and logical operations. To extract portions of a 64-bit register, you may need to use C shifting, masking, or casting operations. Watch out for unintended sign extension when assigning a 32-bit number into a 64-bit number. You can use int for 32-bit integers and long long for 64-bit integers. You should take the two numbers to multiply as command line arguments and print your result product. The printf format for 64-bit integers is "%lld", so you can print your output with "product=%lld\n". (Note: that format contains two lower-case 'L's, not the number 11)

  3. Division

    Write a C program in a single source code file called "div.c" implementing the standard division algorithm for unsigned 32-bit integers. Like the previous parts, use only integer addition, subtraction and logical operations. Make sure your actual addition is between two 32-bit integers. To force a 32-bit addition, you will need to assign portions of the 64-bit quotient/remainder register into 32-bit temporaries and re-assemble it back into the 64-bit register using shifting and masking. In the output of this part, print the result of the division and remainder in the format "quotient=%d remainder=%d\n".


Submit your answer to part 1 in a ascii text file named "hw3.txt". Submit your solution to parts 2 and 3 as C files named 'mult.c' and 'div.c'.

All electronic submissions in this class will be done using the CVS version control system. You should look at the class CVS instructions before you start work. To get full credit for your submission, you should (1) check out a copy of the empty hw1 directory before you start, (2) do your work in that checked out copy, (3) submit several intermediate checkins with short but useful messages, and (4) check in your final submission before class starts on the day of the deadline