Issue 164749
Summary ARM64EC Performance Issue
Labels new issue
Assignees
Reporter XuSai1998
    When building the following code for ARM64EC, I noticed that the call to Point in method2 results in the insertion of __os_arm64x_check_icall, which negatively impacts performance compared to method1.
Is there an attribute or compiler directive I can use to disable this check, If I can guarantee that pfun1 and pfun2 will never point to x64 code?

<img width="872" height="654" alt="Image" src="" />

`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <windows.h>

int fun1(int a, int b) {
    return a + b;
}

int fun2(int a, int b) {
    return a * b;
}

typedef int (*AddFunc)(int, int);

int main() {

    HANDLE hProcess = GetCurrentProcess();
    DWORD_PTR mask = 1 << 10; 
 SetProcessAffinityMask(hProcess, mask);


   
    AddFunc pfun1 = fun1; //Point the function pointer to fun1
    AddFunc pfun2 = fun2;  //Point the function pointer to fun1

//# Method 1
    int sum = 0;
 Sleep(1000);
    for (int i = 0; i < 10000; i++) {
        for(int j = 0; j < 200000; j++) { 
            sum = sum + fun1(i, j); //Function call
 sum = sum + fun2(i, j);
        }
    }
    printf("sum=%d\n", sum);
    
//# Method 2
    sum = 0;
    Sleep(1000);
    for (int i = 0; i < 10000; i++) {
        for (int j = 0; j < 200000; j++) {
 sum = sum + pfun1(i, j);  //Pointer call
            sum = sum + pfun2(i, j);
        }
    }
    printf("sum=%d\n", sum);
}


`

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to