rturrado wrote:

I haven't added any tests yet.

I have seen there are currently 2 types of tests for `cpuid`/`cpuidex`:

1. We have `clang/test/Headers/cpuid.c` which `#include <cpuid.h>` from 
`clang/lib/Headers`, but this file defines `__cpuid(__leaf, __eax, __ebx, 
__ecx, __edx)` and `__cpuid_count(__leaf, __count, __eax, __ebx, __ecx, __edx)` 
directly as `__asm` inline code. And implements `__cpuidex(int __cpu_info[4], 
int __leaf, int __subleaf)` by using `__cpuid_count`. I don't think the new CIR 
builtins cover these cases.

2. And then we have `clang/test/CodeGen/ms-intrinsics-cpuid.c`, which `#include 
<intrin.h>` from `clang/lib/Headers`, and test `__cpuid(int cpuInfo[4], int 
function_id)` and `__cpuidex(int cpuInfo[4], int function_id, int 
subfunction_id)`, but only for Windows/MSVC. I think the new CIR builtins 
should cover these cases, but for Linux. However, there doesn't seem to be a 
header file, either `clang/lib/Headers/immintrin.h` or one accessible through 
this one, that implements `__cpuid`/`__cpuidex`. Should we add this file and 
builtins as part of this PR?

Thanks!

https://github.com/llvm/llvm-project/pull/173197
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to