Question: Shows a general comparison between arguments a and b, where data_t, the data type of the arguments, is defined (via typedef) to be one of

The C code int comp (data_t a, data_t b) { return a COMP b; }

Shows a general comparison between arguments a and b, where data_t, the data type of the arguments, is defined (via typedef) to be one of the integer data types listed in Figure 3.1 and either signed or unsigned. The comparison COMP is defined via #define. 

Suppose a is in some portion of %rdx while b is in some portion of %rsi. For each of the following instruction sequences, determine which data types data_t and which comparisons COMP could cause the compiler to generate this code.

A. cmpl setl B. C. D. cmpw setge cmpb setbe cmpq setne %esi, %edi %al %si, %di %al %sil, %dil %al %rsi, %rdi

Figure 3.1

C declaration char short int long char * float double Intel data type Byte Word Double word Quad word Quad


The C code int comp (data_t a, data_t b) { return a COMP b; }

Step by Step Solution

3.47 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It is important to understand that assembly code does not keep track of the type of a prog... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!