| 1 |
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py |
| 2 |
// REQUIRES: aarch64-registered-target |
| 3 |
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s |
| 4 |
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK |
| 5 |
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s |
| 6 |
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK |
| 7 |
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s |
| 8 |
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s |
| 9 |
|
| 10 |
#include <arm_sve.h> |
| 11 |
|
| 12 |
#ifdef SVE_OVERLOADED_FORMS |
| 13 |
// A simple used,unused... macro, long enough to represent any SVE builtin. |
| 14 |
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 |
| 15 |
#else |
| 16 |
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 |
| 17 |
#endif |
| 18 |
|
| 19 |
#ifdef __ARM_FEATURE_SME |
| 20 |
#define ATTR __arm_streaming |
| 21 |
#else |
| 22 |
#define ATTR |
| 23 |
#endif |
| 24 |
|
| 25 |
// NOTE: For these tests clang converts the struct parameter into |
| 26 |
// several parameters, one for each member of the original struct. |
| 27 |
// CHECK-LABEL: @test_svset3_s8( |
| 28 |
// CHECK-NEXT: entry: |
| 29 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 16) |
| 30 |
// CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]] |
| 31 |
// |
| 32 |
// CPP-CHECK-LABEL: @_Z14test_svset3_s810svint8x3_tu10__SVInt8_t( |
| 33 |
// CPP-CHECK-NEXT: entry: |
| 34 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 16) |
| 35 |
// CPP-CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]] |
| 36 |
// |
| 37 |
svint8x3_t test_svset3_s8(svint8x3_t tuple, svint8_t x) ATTR |
| 38 |
{ |
| 39 |
return SVE_ACLE_FUNC(svset3,_s8,,)(tuple, 1, x); |
| 40 |
} |
| 41 |
|
| 42 |
// CHECK-LABEL: @test_svset3_s16( |
| 43 |
// CHECK-NEXT: entry: |
| 44 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 16) |
| 45 |
// CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]] |
| 46 |
// |
| 47 |
// CPP-CHECK-LABEL: @_Z15test_svset3_s1611svint16x3_tu11__SVInt16_t( |
| 48 |
// CPP-CHECK-NEXT: entry: |
| 49 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 16) |
| 50 |
// CPP-CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]] |
| 51 |
// |
| 52 |
svint16x3_t test_svset3_s16(svint16x3_t tuple, svint16_t x) ATTR |
| 53 |
{ |
| 54 |
return SVE_ACLE_FUNC(svset3,_s16,,)(tuple, 2, x); |
| 55 |
} |
| 56 |
|
| 57 |
// CHECK-LABEL: @test_svset3_s32( |
| 58 |
// CHECK-NEXT: entry: |
| 59 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 0) |
| 60 |
// CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]] |
| 61 |
// |
| 62 |
// CPP-CHECK-LABEL: @_Z15test_svset3_s3211svint32x3_tu11__SVInt32_t( |
| 63 |
// CPP-CHECK-NEXT: entry: |
| 64 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 0) |
| 65 |
// CPP-CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]] |
| 66 |
// |
| 67 |
svint32x3_t test_svset3_s32(svint32x3_t tuple, svint32_t x) ATTR |
| 68 |
{ |
| 69 |
return SVE_ACLE_FUNC(svset3,_s32,,)(tuple, 0, x); |
| 70 |
} |
| 71 |
|
| 72 |
// CHECK-LABEL: @test_svset3_s64( |
| 73 |
// CHECK-NEXT: entry: |
| 74 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 2) |
| 75 |
// CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]] |
| 76 |
// |
| 77 |
// CPP-CHECK-LABEL: @_Z15test_svset3_s6411svint64x3_tu11__SVInt64_t( |
| 78 |
// CPP-CHECK-NEXT: entry: |
| 79 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 2) |
| 80 |
// CPP-CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]] |
| 81 |
// |
| 82 |
svint64x3_t test_svset3_s64(svint64x3_t tuple, svint64_t x) ATTR |
| 83 |
{ |
| 84 |
return SVE_ACLE_FUNC(svset3,_s64,,)(tuple, 1, x); |
| 85 |
} |
| 86 |
|
| 87 |
// CHECK-LABEL: @test_svset3_u8( |
| 88 |
// CHECK-NEXT: entry: |
| 89 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 32) |
| 90 |
// CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]] |
| 91 |
// |
| 92 |
// CPP-CHECK-LABEL: @_Z14test_svset3_u811svuint8x3_tu11__SVUint8_t( |
| 93 |
// CPP-CHECK-NEXT: entry: |
| 94 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 32) |
| 95 |
// CPP-CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]] |
| 96 |
// |
| 97 |
svuint8x3_t test_svset3_u8(svuint8x3_t tuple, svuint8_t x) ATTR |
| 98 |
{ |
| 99 |
return SVE_ACLE_FUNC(svset3,_u8,,)(tuple, 2, x); |
| 100 |
} |
| 101 |
|
| 102 |
// CHECK-LABEL: @test_svset3_u16( |
| 103 |
// CHECK-NEXT: entry: |
| 104 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 0) |
| 105 |
// CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]] |
| 106 |
// |
| 107 |
// CPP-CHECK-LABEL: @_Z15test_svset3_u1612svuint16x3_tu12__SVUint16_t( |
| 108 |
// CPP-CHECK-NEXT: entry: |
| 109 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 0) |
| 110 |
// CPP-CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]] |
| 111 |
// |
| 112 |
svuint16x3_t test_svset3_u16(svuint16x3_t tuple, svuint16_t x) ATTR |
| 113 |
{ |
| 114 |
return SVE_ACLE_FUNC(svset3,_u16,,)(tuple, 0, x); |
| 115 |
} |
| 116 |
|
| 117 |
// CHECK-LABEL: @test_svset3_u32( |
| 118 |
// CHECK-NEXT: entry: |
| 119 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 4) |
| 120 |
// CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]] |
| 121 |
// |
| 122 |
// CPP-CHECK-LABEL: @_Z15test_svset3_u3212svuint32x3_tu12__SVUint32_t( |
| 123 |
// CPP-CHECK-NEXT: entry: |
| 124 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 4) |
| 125 |
// CPP-CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]] |
| 126 |
// |
| 127 |
svuint32x3_t test_svset3_u32(svuint32x3_t tuple, svuint32_t x) ATTR |
| 128 |
{ |
| 129 |
return SVE_ACLE_FUNC(svset3,_u32,,)(tuple, 1, x); |
| 130 |
} |
| 131 |
|
| 132 |
// CHECK-LABEL: @test_svset3_u64( |
| 133 |
// CHECK-NEXT: entry: |
| 134 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 4) |
| 135 |
// CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]] |
| 136 |
// |
| 137 |
// CPP-CHECK-LABEL: @_Z15test_svset3_u6412svuint64x3_tu12__SVUint64_t( |
| 138 |
// CPP-CHECK-NEXT: entry: |
| 139 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 4) |
| 140 |
// CPP-CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]] |
| 141 |
// |
| 142 |
svuint64x3_t test_svset3_u64(svuint64x3_t tuple, svuint64_t x) ATTR |
| 143 |
{ |
| 144 |
return SVE_ACLE_FUNC(svset3,_u64,,)(tuple, 2, x); |
| 145 |
} |
| 146 |
|
| 147 |
// CHECK-LABEL: @test_svset3_f16( |
| 148 |
// CHECK-NEXT: entry: |
| 149 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x half> @llvm.vector.insert.nxv24f16.nxv8f16(<vscale x 24 x half> [[TUPLE:%.*]], <vscale x 8 x half> [[X:%.*]], i64 0) |
| 150 |
// CHECK-NEXT: ret <vscale x 24 x half> [[TMP0]] |
| 151 |
// |
| 152 |
// CPP-CHECK-LABEL: @_Z15test_svset3_f1613svfloat16x3_tu13__SVFloat16_t( |
| 153 |
// CPP-CHECK-NEXT: entry: |
| 154 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x half> @llvm.vector.insert.nxv24f16.nxv8f16(<vscale x 24 x half> [[TUPLE:%.*]], <vscale x 8 x half> [[X:%.*]], i64 0) |
| 155 |
// CPP-CHECK-NEXT: ret <vscale x 24 x half> [[TMP0]] |
| 156 |
// |
| 157 |
svfloat16x3_t test_svset3_f16(svfloat16x3_t tuple, svfloat16_t x) ATTR |
| 158 |
{ |
| 159 |
return SVE_ACLE_FUNC(svset3,_f16,,)(tuple, 0, x); |
| 160 |
} |
| 161 |
|
| 162 |
// CHECK-LABEL: @test_svset3_f32( |
| 163 |
// CHECK-NEXT: entry: |
| 164 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x float> @llvm.vector.insert.nxv12f32.nxv4f32(<vscale x 12 x float> [[TUPLE:%.*]], <vscale x 4 x float> [[X:%.*]], i64 4) |
| 165 |
// CHECK-NEXT: ret <vscale x 12 x float> [[TMP0]] |
| 166 |
// |
| 167 |
// CPP-CHECK-LABEL: @_Z15test_svset3_f3213svfloat32x3_tu13__SVFloat32_t( |
| 168 |
// CPP-CHECK-NEXT: entry: |
| 169 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x float> @llvm.vector.insert.nxv12f32.nxv4f32(<vscale x 12 x float> [[TUPLE:%.*]], <vscale x 4 x float> [[X:%.*]], i64 4) |
| 170 |
// CPP-CHECK-NEXT: ret <vscale x 12 x float> [[TMP0]] |
| 171 |
// |
| 172 |
svfloat32x3_t test_svset3_f32(svfloat32x3_t tuple, svfloat32_t x) ATTR |
| 173 |
{ |
| 174 |
return SVE_ACLE_FUNC(svset3,_f32,,)(tuple, 1, x); |
| 175 |
} |
| 176 |
|
| 177 |
// CHECK-LABEL: @test_svset3_f64( |
| 178 |
// CHECK-NEXT: entry: |
| 179 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x double> @llvm.vector.insert.nxv6f64.nxv2f64(<vscale x 6 x double> [[TUPLE:%.*]], <vscale x 2 x double> [[X:%.*]], i64 4) |
| 180 |
// CHECK-NEXT: ret <vscale x 6 x double> [[TMP0]] |
| 181 |
// |
| 182 |
// CPP-CHECK-LABEL: @_Z15test_svset3_f6413svfloat64x3_tu13__SVFloat64_t( |
| 183 |
// CPP-CHECK-NEXT: entry: |
| 184 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x double> @llvm.vector.insert.nxv6f64.nxv2f64(<vscale x 6 x double> [[TUPLE:%.*]], <vscale x 2 x double> [[X:%.*]], i64 4) |
| 185 |
// CPP-CHECK-NEXT: ret <vscale x 6 x double> [[TMP0]] |
| 186 |
// |
| 187 |
svfloat64x3_t test_svset3_f64(svfloat64x3_t tuple, svfloat64_t x) ATTR |
| 188 |
{ |
| 189 |
return SVE_ACLE_FUNC(svset3,_f64,,)(tuple, 2, x); |
| 190 |
} |