Question: Consider the following C function, where EXPR is a macro defined with #define: Below, we show the AVX2 code generated for different definitions of EXPR,

Consider the following C function, where EXPR is a macro defined with #define:

double simplefun (double x) { return EXPR (x); }

Below, we show the AVX2 code generated for different definitions of EXPR, where value x is held in %xmm0. All of them correspond to some useful operation on floating-point values. Identify what the operations are. Your answers will require you to understand the bit patterns of the constant words being retrieved from memory.

A. 1 2 3 4 5 6 7 B. 1 vmovsd .LC1 (%rip), %xmm1 vandpd %xmm1, %xmmo, %xmmo .LC1: .long .long .long .long

C. 1 2 3 4 5 6 7 vmovsd .LC2 (%rip), %xmm1 vxorpd %xmm1, %xmm0, %xmmo .LC2: 0 .long .long .long 0 .long 0

double simplefun (double x) { return EXPR (x); }

Step by Step Solution

3.52 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Segment A performs the following operations 1 Loads a constant doubleprecision floatingpoint value f... 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!