================
@@ -0,0 +1,148 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fms-extensions 
-Wno-implicit-function-declaration -fclangir -emit-cir -o %t.cir -Wall -Werror 
%s
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fms-extensions 
-Wno-implicit-function-declaration -fclangir -emit-llvm -o %t-cir.ll -Wall 
-Werror %s
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fms-extensions 
-Wno-implicit-function-declaration -emit-llvm -o %t.ll -Wall -Werror %s
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
+
+#pragma intrinsic(__cpuid)
+
+void test__cpuid_with_cpu_info_as_pointer(int cpuInfo[4], int functionId) {
+    __cpuid(cpuInfo, functionId);
+}
+// CIR-LABEL: __cpuid_with_cpu_info_as_pointer
+// CIR: [[CPU_INFO_PTR:%.*]] = cir.load align(8)
+// CIR: [[FUNCTION_ID:%.*]] = cir.load align(4)
+// CIR: [[SUB_FUNCTION_ID:%.*]] = cir.const #cir.int<0> : !s32i
+// CIR: cir.cpuid [[CPU_INFO_PTR]], [[FUNCTION_ID]], [[SUB_FUNCTION_ID]] : 
(!cir.ptr<!s32i>, !s32i, !s32i) -> ()
+
+// LLVM-LABEL: __cpuid_with_cpu_info_as_pointer
+// LLVM: [[CPU_INFO_PTR:%.*]] = load ptr
+// LLVM: [[FUNCTION_ID:%.*]] = load i32
+// LLVM: [[ASM_RESULTS:%.*]] = call { i32, i32, i32, i32 } asm 
"{{.*}}cpuid{{.*}}", "={ax},=r,={cx},={dx},0,2"(i32 [[FUNCTION_ID]], i32 0)
+// LLVM-DAG: [[RESULT_0:%.*]] = extractvalue { i32, i32, i32, i32 } 
[[ASM_RESULTS]], 0
----------------
andykaylor wrote:

Yes, it should be.

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