[clang] [llvm] [clang][CIR] Add tests for SVE CNTP intrinsics using update_cc_test_checks.py (PR #247913)
Chibuoyim Ogbonna via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 5 07:51:09 PST 2026
================
@@ -0,0 +1,95 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --body-prefixes LLVM,CIR --normalize-local-names --filter-out "cir\.(alloca|store|load|return)" --version 6
+// REQUIRES: aarch64-registered-target
+
+// DEFINE: %{optimize} = opt -passes=mem2reg -S
+
+// CIR calling-convention lowering does not handle SVE scalable vector types
+// yet, so the -fclangir runs disable it. Remove
+// -fno-clangir-call-conv-lowering once those types are supported.
+// RUN: %if cir-enabled %{%clang_cc1_cg_arm64_sve -fclangir -fno-clangir-call-conv-lowering -emit-cir -disable-O0-optnone -o - %s | FileCheck %s --check-prefixes=C,CIR %}
+// RUN: %if cir-enabled %{%clang_cc1_cg_arm64_sve -DSVE_OVERLOADED_FORMS -fclangir -fno-clangir-call-conv-lowering -emit-cir -disable-O0-optnone -o - %s | FileCheck %s --check-prefixes=C,CIR %}
+
+// RUN: %if cir-enabled %{%clang_cc1_cg_arm64_sve -fclangir -fno-clangir-call-conv-lowering -emit-llvm -disable-O0-optnone -o - %s | %{optimize} | FileCheck %s --check-prefixes=C,LLVM %}
+// RUN: %if cir-enabled %{%clang_cc1_cg_arm64_sve -DSVE_OVERLOADED_FORMS -fclangir -fno-clangir-call-conv-lowering -emit-llvm -disable-O0-optnone -o - %s | %{optimize} | FileCheck %s --check-prefixes=C,LLVM %}
+// RUN: %if cir-enabled %{%clang_cc1_cg_arm64_sve -DSVE_OVERLOADED_FORMS -fclangir -fno-clangir-call-conv-lowering -emit-llvm -disable-O0-optnone -o - -x c++ %s | %{optimize} | FileCheck %s --check-prefixes=CPP,LLVM %}
+
+// RUN: %clang_cc1_cg_arm64_sve -emit-llvm -disable-O0-optnone -o - %s | %{optimize} | FileCheck %s --check-prefixes=C,LLVM
+// RUN: %clang_cc1_cg_arm64_sve -DSVE_OVERLOADED_FORMS -emit-llvm -disable-O0-optnone -o - %s | %{optimize} | FileCheck %s --check-prefixes=C,LLVM
+// RUN: %clang_cc1_cg_arm64_sve -DSVE_OVERLOADED_FORMS -emit-llvm -disable-O0-optnone -o - -x c++ %s | %{optimize} | FileCheck %s --check-prefixes=CPP,LLVM
+
+// RUN: %clang_cc1_cg_arm64_sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
+
+//=============================================================================
+// NOTES
+//
+// Tests for SVE CNTP intrinsics (plain SVE only)
+//=============================================================================
+
+#include <arm_sve.h>
+
+#if defined __ARM_FEATURE_SME
+#define MODE_ATTR __arm_streaming
+#else
+#define MODE_ATTR
+#endif
+
+// C-LABEL: @test_svcntp_b8(
+// CPP-LABEL: @_Z14test_svcntp_b8u10__SVBool_tS_(
+// CIR: [[TMP5:%.*]] = cir.call_llvm_intrinsic "aarch64.sve.cntp" [[TMP3:%.*]], [[TMP4:%.*]] : (!cir.vector<[16] x !cir.int<u, 1>, sve_predicate>, !cir.vector<[16] x !cir.int<u, 1>, sve_predicate>) -> !u64i
+// LLVM-SAME: <vscale x 16 x i1> [[TMP0:%.*]], <vscale x 16 x i1> [[TMP1:%.*]])
+// LLVM: [[TMP2:%.*]] = call i64 @llvm.aarch64.sve.cntp.nxv16i1(<vscale x 16 x i1> [[TMP0]], <vscale x 16 x i1> [[TMP1]])
+// LLVM: ret i64 [[TMP2]]
+//
+uint64_t test_svcntp_b8(svbool_t pg, svbool_t op) MODE_ATTR
+{
+ return svcntp_b8(pg, op);
+}
+
+
+// C-LABEL: @test_svcntp_b16(
+// CPP-LABEL: @_Z15test_svcntp_b16u10__SVBool_tS_(
+// CIR: [[TMP5:%.*]] = cir.call_llvm_intrinsic "aarch64.sve.convert.from.svbool" [[TMP3:%.*]] : (!cir.vector<[16] x !cir.int<u, 1>, sve_predicate>) -> !cir.vector<[8] x !cir.int<u, 1>, sve_predicate>
+// CIR: [[TMP6:%.*]] = cir.call_llvm_intrinsic "aarch64.sve.convert.from.svbool" [[TMP4:%.*]] : (!cir.vector<[16] x !cir.int<u, 1>, sve_predicate>) -> !cir.vector<[8] x !cir.int<u, 1>, sve_predicate>
+// CIR: [[TMP7:%.*]] = cir.call_llvm_intrinsic "aarch64.sve.cntp" [[TMP5]], [[TMP6]] : (!cir.vector<[8] x !cir.int<u, 1>, sve_predicate>, !cir.vector<[8] x !cir.int<u, 1>, sve_predicate>) -> !u64i
+// LLVM-SAME: <vscale x 16 x i1> [[TMP0:%.*]], <vscale x 16 x i1> [[TMP1:%.*]])
+// LLVM: [[TMP2:%.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[TMP0]])
+// LLVM: [[TMP3:%.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[TMP1]])
+// LLVM: [[TMP4:%.*]] = call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> [[TMP2]], <vscale x 8 x i1> [[TMP3]])
+// LLVM: ret i64 [[TMP4]]
----------------
bruteforceboy wrote:
a space between groups of different check prefixes makes this easier to read
https://github.com/llvm/llvm-project/pull/247913
More information about the cfe-commits
mailing list