1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 2 // RUN: %clang_cc1 -no-opaque-pointers -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=4 -mvscale-max=4 -fallow-half-arguments-and-returns -S -O1 -emit-llvm -o - %s | FileCheck %s 3 4 // REQUIRES: aarch64-registered-target 5 6 #include <arm_sve.h> 7 8 #define N __ARM_FEATURE_SVE_BITS 9 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))); 14 15 // CHECK-LABEL: @to_svint32_t( 16 // CHECK-NEXT: entry: 17 // CHECK-NEXT: ret <vscale x 4 x i32> [[TYPE_COERCE:%.*]] 18 // 19 svint32_t to_svint32_t(fixed_int32_t type) { 20 return type; 21 } 22 23 // CHECK-LABEL: @from_svint32_t( 24 // CHECK-NEXT: entry: 25 // CHECK-NEXT: ret <vscale x 4 x i32> [[TYPE:%.*]] 26 // 27 fixed_int32_t from_svint32_t(svint32_t type) { 28 return type; 29 } 30 31 // CHECK-LABEL: @to_svfloat64_t( 32 // CHECK-NEXT: entry: 33 // CHECK-NEXT: ret <vscale x 2 x double> [[TYPE_COERCE:%.*]] 34 // 35 svfloat64_t to_svfloat64_t(fixed_float64_t type) { 36 return type; 37 } 38 39 // CHECK-LABEL: @from_svfloat64_t( 40 // CHECK-NEXT: entry: 41 // CHECK-NEXT: ret <vscale x 2 x double> [[TYPE:%.*]] 42 // 43 fixed_float64_t from_svfloat64_t(svfloat64_t type) { 44 return type; 45 } 46 47 // CHECK-LABEL: @to_svbool_t( 48 // CHECK-NEXT: entry: 49 // CHECK-NEXT: ret <vscale x 16 x i1> [[TYPE:%.*]] 50 // 51 svbool_t to_svbool_t(fixed_bool_t type) { 52 return type; 53 } 54 55 // CHECK-LABEL: @from_svbool_t( 56 // CHECK-NEXT: entry: 57 // CHECK-NEXT: ret <vscale x 16 x i1> [[TYPE:%.*]] 58 // 59 fixed_bool_t from_svbool_t(svbool_t type) { 60 return type; 61 } 62 63 // CHECK-LABEL: @lax_cast( 64 // CHECK-NEXT: entry: 65 // CHECK-NEXT: [[TMP0:%.*]] = alloca <16 x i32>, align 64 66 // CHECK-NEXT: [[CASTFIXEDSVE:%.*]] = 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> [[CASTFIXEDSVE]], <16 x i32>* [[TMP0:%.*]], align 64, !tbaa [[TBAA6:![0-9]+]] 68 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <16 x i32>* [[TMP0]] to <vscale x 2 x i64>* 69 // CHECK-NEXT: [[TMP2:%.*]] = load <vscale x 2 x i64>, <vscale x 2 x i64>* [[TMP1]], align 64, !tbaa [[TBAA6]] 70 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP2]] 71 // 72 svint64_t lax_cast(fixed_int32_t type) { 73 return type; 74 } 75 76 // CHECK-LABEL: @to_svint32_t__from_gnu_int32_t( 77 // CHECK-NEXT: entry: 78 // CHECK-NEXT: [[TYPE:%.*]] = load <16 x i32>, <16 x i32>* [[TMP0:%.*]], align 16, !tbaa [[TBAA6:![0-9]+]] 79 // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> undef, <16 x i32> [[TYPE]], i64 0) 80 // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 81 // 82 svint32_t to_svint32_t__from_gnu_int32_t(gnu_int32_t type) { 83 return type; 84 } 85 86 // CHECK-LABEL: @from_svint32_t__to_gnu_int32_t( 87 // CHECK-NEXT: entry: 88 // CHECK-NEXT: [[CASTFIXEDSVE:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE:%.*]], i64 0) 89 // CHECK-NEXT: store <16 x i32> [[CASTFIXEDSVE]], <16 x i32>* [[AGG_RESULT:%.*]], align 16, !tbaa [[TBAA6]] 90 // CHECK-NEXT: ret void 91 // 92 gnu_int32_t from_svint32_t__to_gnu_int32_t(svint32_t type) { 93 return type; 94 } 95 96 // CHECK-LABEL: @to_fixed_int32_t__from_gnu_int32_t( 97 // CHECK-NEXT: entry: 98 // CHECK-NEXT: [[TYPE:%.*]] = load <16 x i32>, <16 x i32>* [[TMP0:%.*]], align 16, !tbaa [[TBAA6]] 99 // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> undef, <16 x i32> [[TYPE]], i64 0) 100 // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 101 // 102 fixed_int32_t to_fixed_int32_t__from_gnu_int32_t(gnu_int32_t type) { 103 return type; 104 } 105 106 // CHECK-LABEL: @from_fixed_int32_t__to_gnu_int32_t( 107 // CHECK-NEXT: entry: 108 // CHECK-NEXT: [[TYPE:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE_COERCE:%.*]], i64 0) 109 // CHECK-NEXT: store <16 x i32> [[TYPE]], <16 x i32>* [[AGG_RESULT:%.*]], align 16, !tbaa [[TBAA6]] 110 // CHECK-NEXT: ret void 111 // 112 gnu_int32_t from_fixed_int32_t__to_gnu_int32_t(fixed_int32_t type) { 113 return type; 114 } 115