[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / attr-arm-sve-vector-bits-cast.c
blob8be1123a2305a37e5b8e08da01db6c1d6b5beb9d
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -mvscale-min=4 -mvscale-max=4 -O1 -emit-llvm -o - %s | FileCheck %s
4 // REQUIRES: aarch64-registered-target
6 #include <arm_sve.h>
8 #define N __ARM_FEATURE_SVE_BITS
10 typedef svint32_t fixed_int32_t __attribute__((arm_sve_vector_bits(N)));
11 typedef svfloat64_t fixed_float64_t __attribute__((arm_sve_vector_bits(N)));
12 typedef svbool_t fixed_bool_t __attribute__((arm_sve_vector_bits(N)));
13 typedef int32_t gnu_int32_t __attribute__((vector_size(N / 8)));
15 // CHECK-LABEL: @to_svint32_t(
16 // CHECK-NEXT: entry:
17 // CHECK-NEXT: ret <vscale x 4 x i32> [[TYPE_COERCE:%.*]]
19 svint32_t to_svint32_t(fixed_int32_t type) {
20 return type;
23 // CHECK-LABEL: @from_svint32_t(
24 // CHECK-NEXT: entry:
25 // CHECK-NEXT: ret <vscale x 4 x i32> [[TYPE:%.*]]
27 fixed_int32_t from_svint32_t(svint32_t type) {
28 return type;
31 // CHECK-LABEL: @to_svfloat64_t(
32 // CHECK-NEXT: entry:
33 // CHECK-NEXT: ret <vscale x 2 x double> [[TYPE_COERCE:%.*]]
35 svfloat64_t to_svfloat64_t(fixed_float64_t type) {
36 return type;
39 // CHECK-LABEL: @from_svfloat64_t(
40 // CHECK-NEXT: entry:
41 // CHECK-NEXT: ret <vscale x 2 x double> [[TYPE:%.*]]
43 fixed_float64_t from_svfloat64_t(svfloat64_t type) {
44 return type;
47 // CHECK-LABEL: @to_svbool_t(
48 // CHECK-NEXT: entry:
49 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0:%.*]]
51 svbool_t to_svbool_t(fixed_bool_t type) {
52 return type;
55 // CHECK-LABEL: @from_svbool_t(
56 // CHECK-NEXT: entry:
57 // CHECK-NEXT: ret <vscale x 16 x i1> [[TYPE:%.*]]
59 fixed_bool_t from_svbool_t(svbool_t type) {
60 return type;
63 // CHECK-LABEL: @lax_cast(
64 // CHECK-NEXT: entry:
65 // CHECK-NEXT: [[SAVED_VALUE:%.*]] = alloca <16 x i32>, align 64
66 // CHECK-NEXT: [[TYPE:%.*]] = tail call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE_COERCE:%.*]], i64 0)
67 // CHECK-NEXT: store <16 x i32> [[TYPE]], ptr [[SAVED_VALUE]], align 64, !tbaa [[TBAA6:![0-9]+]]
68 // CHECK-NEXT: [[TMP0:%.*]] = load <vscale x 2 x i64>, ptr [[SAVED_VALUE]], align 64, !tbaa [[TBAA6]]
69 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
71 svint64_t lax_cast(fixed_int32_t type) {
72 return type;
75 // CHECK-LABEL: @to_svint32_t__from_gnu_int32_t(
76 // CHECK-NEXT: entry:
77 // CHECK-NEXT: [[TYPE:%.*]] = load <16 x i32>, ptr [[TMP0:%.*]], align 16, !tbaa [[TBAA6]]
78 // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> undef, <16 x i32> [[TYPE]], i64 0)
79 // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
81 svint32_t to_svint32_t__from_gnu_int32_t(gnu_int32_t type) {
82 return type;
85 // CHECK-LABEL: @from_svint32_t__to_gnu_int32_t(
86 // CHECK-NEXT: entry:
87 // CHECK-NEXT: [[CASTFIXEDSVE:%.*]] = tail call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE:%.*]], i64 0)
88 // CHECK-NEXT: store <16 x i32> [[CASTFIXEDSVE]], ptr [[AGG_RESULT:%.*]], align 16, !tbaa [[TBAA6]]
89 // CHECK-NEXT: ret void
91 gnu_int32_t from_svint32_t__to_gnu_int32_t(svint32_t type) {
92 return type;
95 // CHECK-LABEL: @to_fixed_int32_t__from_gnu_int32_t(
96 // CHECK-NEXT: entry:
97 // CHECK-NEXT: [[TYPE:%.*]] = load <16 x i32>, ptr [[TMP0:%.*]], align 16, !tbaa [[TBAA6]]
98 // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> undef, <16 x i32> [[TYPE]], i64 0)
99 // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
101 fixed_int32_t to_fixed_int32_t__from_gnu_int32_t(gnu_int32_t type) {
102 return type;
105 // CHECK-LABEL: @from_fixed_int32_t__to_gnu_int32_t(
106 // CHECK-NEXT: entry:
107 // CHECK-NEXT: [[TYPE:%.*]] = tail call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE_COERCE:%.*]], i64 0)
108 // CHECK-NEXT: store <16 x i32> [[TYPE]], ptr [[AGG_RESULT:%.*]], align 16, !tbaa [[TBAA6]]
109 // CHECK-NEXT: ret void
111 gnu_int32_t from_fixed_int32_t__to_gnu_int32_t(fixed_int32_t type) {
112 return type;