Community
cancel
Showing results for 
Search instead for 
Did you mean: 
King_Crimson
Beginner
36 Views

Intel Xeon Phi assembly code

Dear experts,

I'm not experienced in assembly, so I would appreciate it if you could help correlate the following assembly to the oneliner source.

 

source:

T localDistance = surfaceList[surfaceInnerIndex - 1]->CalculateDistance(attr->position, attr->direction, isCoincident);
// each element of the surfaceList is a surface object
// CalculateDistance() is a virtual function

 

 

corresponding assembly:

1       movq  0x20(%r13), %r10
2       movq  -0x8(%r10,%r9,8), %rdi
3       lea 0x1b0(%rsp), %rsi
4       movq  (%rdi), %r11  0       
5       lea 0x1c8(%rsp), %rdx
6       callq  (%r11)   0           
	        

I understand that, for example, line 2 is copying mem[r10 - 8 + 8 * r9] to rdi, but what is the corresponding operation in the source? Thanks for any hints.

 

0 Kudos
2 Replies
James_C_Intel2
Employee
36 Views

I understand that, for example, line 2 is copying mem[r10 - 8 + 8 * r9] to rdi, but what is the corresponding operation in the source? 

Without seeing the class declarations and a bit more of the code so that we can work out what is in which register it's a bit hard to tell, but my guess (based on the -8 offset) is that that is the load of surfaceList[surfaceInnerIndex - 1]

0 Kudos
King_Crimson
Beginner
36 Views

Hi James,

Thanks for your reply. Below is the class declaration. The surfaceList is a std::vector<Surface<double>*> of pointers each pointing to a derived-class surface. Please let me know if other code snippets are necessary.

enum class SurfaceType
{
    SXPlane,
    SYPlane,
    SZPlane,
    SXCylinder,
    SYCylinder,
    SZCylinder,
    SSphere,
};

template<typename T>
class Surface
{
public:
    int index;
    int innerIndex;
    SurfaceType surfaceType;
    std::vector<int> positiveCellInnerIndexList; 
    std::vector<int> negativeCellInnerIndexList; 

    Sense CalculateSense(const Vector3<T>& position, const Vector3<T>& direction);
    virtual T CalculateDistance(const Vector3<T>& position, const Vector3<T>& direction, bool isCoincident) = 0;
    virtual T EvaluateSurfaceEquation(const Vector3<T>& position) = 0;
    virtual Vector3<T> CalculateNormal(const Vector3<T>& position) = 0;
    virtual size_t GetClassSize();
};

 

0 Kudos