================
@@ -0,0 +1,389 @@
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-linux-gnu -std=c23 
-fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-linux-gnu -std=c23 
-fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-linux-gnu -std=c23 
-emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c23 -isystem 
%S/Inputs -DTEST_LIB_SPELLINGS -fclangir -emit-cir %s -o %t-lib.cir
+// RUN: FileCheck --input-file=%t-lib.cir %s --check-prefix=LIB-CIR
+
+#ifdef TEST_LIB_SPELLINGS
+#include <stdbit.h>
+#endif
+
+#ifndef TEST_LIB_SPELLINGS
+
+void test_stdc_trailing_zeros(unsigned char uc, unsigned short us,
+                              unsigned int ui, unsigned long ul,
+                              unsigned long long ull) {
+  volatile unsigned int r;
+  r = __builtin_stdc_trailing_zeros(uc);
+  r = __builtin_stdc_trailing_zeros(us);
+  r = __builtin_stdc_trailing_zeros(ui);
+  r = __builtin_stdc_trailing_zeros(ul);
+  r = __builtin_stdc_trailing_zeros(ull);
+}
+
+// CIR-LABEL: @test_stdc_trailing_zeros(
+// CIR: cir.ctz %{{.+}} : !u8i
+// CIR: cir.ctz %{{.+}} : !u16i
+// CIR: cir.ctz %{{.+}} : !u32i
+// CIR: cir.ctz %{{.+}} : !u64i
+// CIR: cir.ctz %{{.+}} : !u64i
+// LLVM-LABEL: @test_stdc_trailing_zeros(
----------------
xakep8 wrote:

I added the narrow and wide argument coverage in tests now with the trunc and 
zext as you suggested.

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

Reply via email to