[clang] [CIR] Support x86 builtin rdtsc (PR #180714)
Priyanshu Kumar via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 10 06:03:22 PST 2026
================
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -x c -ffreestanding -triple x86_64-unknown-linux -fclangir -emit-cir -o %t.cir %s
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+
+// RUN: %clang_cc1 -x c -ffreestanding -triple x86_64-unknown-linux -fclangir -emit-llvm -o %t.ll %s
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
+
+unsigned long long test_rdtsc() {
+ // CIR-LABEL: @test_rdtsc
+ // CIR: {{%.*}} = cir.call_llvm_intrinsic "x86.rdtsc"() : () -> !u64i
+
+ // LLVM-LABEL: @test_rdtsc
+ // LLVM: call i64 @llvm.x86.rdtsc()
----------------
Priyanshu3820 wrote:
We also test them against the LLVM IR produced by classic codegen to verify the LLVM IR produced by the CIR path. You can use adjacent test files as a reference for that. Also, we try to keep the names of the test files the same as classic codegen. So, you need to change the name of this file to `rd-builtins.c`.
https://github.com/llvm/llvm-project/pull/180714
More information about the cfe-commits
mailing list