Author: Letu Ren Date: 2026-09-27T17:45:15+08:00 New Revision: 80b46c9d74a868cd20720cc7932a2f88bda43d25
URL: https://github.com/llvm/llvm-project/commit/80b46c9d74a868cd20720cc7932a2f88bda43d25 DIFF: https://github.com/llvm/llvm-project/commit/80b46c9d74a868cd20720cc7932a2f88bda43d25.diff LOG: [CIR][NFC] Add vector of boolean test to __builtin_nondeterministic_value (#219550) Assisted-by: grok-4.6 Signed-off-by: Letu Ren <[email protected]> Added: Modified: clang/test/CIR/CodeGenBuiltins/builtin-nondeterministic-value.c Removed: ################################################################################ diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-nondeterministic-value.c b/clang/test/CIR/CodeGenBuiltins/builtin-nondeterministic-value.c index d7d9224fc0440..4ef5a9308fa52 100644 --- a/clang/test/CIR/CodeGenBuiltins/builtin-nondeterministic-value.c +++ b/clang/test/CIR/CodeGenBuiltins/builtin-nondeterministic-value.c @@ -6,11 +6,7 @@ // RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM typedef float float4 __attribute__((ext_vector_type(4))); - -// TODO: the bool4 (ext_vector_type _Bool) case from the classic CodeGen test is -// omitted here: CIR does not yet implement storing ext-vector-bool types -// (emitStoreOfScalar ExtVectorBoolType is NYI). The cir.freeze lowering itself -// works for <N x !cir.bool>; only the surrounding store is unsupported. +typedef _Bool bool4 __attribute__((ext_vector_type(4))); int clang_nondet_i(int x) { return __builtin_nondeterministic_value(x); @@ -66,3 +62,15 @@ void clang_nondet_fv(void) { // LLVM-LABEL: @clang_nondet_fv // LLVM: %[[RES:.*]] = freeze <4 x float> poison + +void clang_nondet_bv(void) { + bool4 x = __builtin_nondeterministic_value(x); +} + +// CIR-LABEL: cir.func {{.*}}@clang_nondet_bv +// CIR: %[[POISON:.*]] = cir.const #cir.poison : !cir.vector<4 x !cir.bool> +// CIR: %[[RES:.*]] = cir.freeze %[[POISON]] : !cir.vector<4 x !cir.bool> +// CIR: cir.store{{.*}} %[[RES]], {{.*}} : !cir.vector<4 x !cir.bool>, !cir.ptr<!cir.vector<4 x !cir.bool>> + +// LLVM-LABEL: @clang_nondet_bv +// LLVM: %[[RES:.*]] = freeze <4 x i1> poison _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
