xref: /llvm-project/clang/test/Sema/constant-builtins-all-args-evaluated.cpp (revision cf73f136c5e22e7e4090fc762456ace47752a898)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3 
test_clzg_0()4 constexpr int test_clzg_0() {
5   int x = 0;
6   (void)__builtin_clzg(0U, ++x);
7   return x;
8 }
9 
10 static_assert(test_clzg_0() == 1);
11 
test_clzg_1()12 constexpr int test_clzg_1() {
13   int x = 0;
14   (void)__builtin_clzg(1U, ++x);
15   return x;
16 }
17 
18 static_assert(test_clzg_1() == 1);
19 
test_ctzg_0()20 constexpr int test_ctzg_0() {
21   int x = 0;
22   (void)__builtin_ctzg(0U, ++x);
23   return x;
24 }
25 
26 static_assert(test_ctzg_0() == 1);
27 
test_ctzg_1()28 constexpr int test_ctzg_1() {
29   int x = 0;
30   (void)__builtin_ctzg(1U, ++x);
31   return x;
32 }
33 
34 static_assert(test_ctzg_1() == 1);
35