[clang] [CIR] Lowering __builtin_stdc_* calls (PR #214931)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 12:46:22 PDT 2026
================
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c23 -I%S/../../CodeGen/Inputs -fclangir -emit-cir %s -o - | FileCheck %s
+
+#include <stdbit.h>
+
+void test_stdc_trailing_zeros(unsigned long long x) {
+ int cnt = __builtin_stdc_trailing_zeros(x);
+ (void)cnt;
+}
+
+// CHECK-LABEL: test_stdc_trailing_zeros
+// CHECK: cir.ctz
+// CHECK-NOT: poison_zero
----------------
bcardosolopes wrote:
This can never fail. `poison_zero` prints on the same line as the op, `cir.ctz %0 poison_zero : !u64i`, so `CHECK: cir.ctz` matches either way and `CHECK-NOT` only scans what comes after it. Pin the whole line instead: `CHECK: cir.ctz %{{.+}} : !u64i`. Same for the other three.
https://github.com/llvm/llvm-project/pull/214931
More information about the cfe-commits
mailing list