| 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 -S -disable-O0-optnone -Werror -o /dev/null %s |
| 8 |
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -o /dev/null %s |
| 9 |
|
| 10 |
#include <arm_sve.h> |
| 11 |
|
| 12 |
#if defined __ARM_FEATURE_SME |
| 13 |
#define MODE_ATTR __arm_streaming |
| 14 |
#else |
| 15 |
#define MODE_ATTR |
| 16 |
#endif |
| 17 |
|
| 18 |
#ifdef SVE_OVERLOADED_FORMS |
| 19 |
// A simple used,unused... macro, long enough to represent any SVE builtin. |
| 20 |
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 |
| 21 |
#else |
| 22 |
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 |
| 23 |
#endif |
| 24 |
|
| 25 |
// CHECK-LABEL: @test_svrev_s8( |
| 26 |
// CHECK-NEXT: entry: |
| 27 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.reverse.nxv16i8(<vscale x 16 x i8> [[OP:%.*]]) |
| 28 |
// CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]] |
| 29 |
// |
| 30 |
// CPP-CHECK-LABEL: @_Z13test_svrev_s8u10__SVInt8_t( |
| 31 |
// CPP-CHECK-NEXT: entry: |
| 32 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.reverse.nxv16i8(<vscale x 16 x i8> [[OP:%.*]]) |
| 33 |
// CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]] |
| 34 |
// |
| 35 |
svint8_t test_svrev_s8(svint8_t op) MODE_ATTR |
| 36 |
{ |
| 37 |
return SVE_ACLE_FUNC(svrev,_s8,,)(op); |
| 38 |
} |
| 39 |
|
| 40 |
// CHECK-LABEL: @test_svrev_s16( |
| 41 |
// CHECK-NEXT: entry: |
| 42 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.reverse.nxv8i16(<vscale x 8 x i16> [[OP:%.*]]) |
| 43 |
// CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]] |
| 44 |
// |
| 45 |
// CPP-CHECK-LABEL: @_Z14test_svrev_s16u11__SVInt16_t( |
| 46 |
// CPP-CHECK-NEXT: entry: |
| 47 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.reverse.nxv8i16(<vscale x 8 x i16> [[OP:%.*]]) |
| 48 |
// CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]] |
| 49 |
// |
| 50 |
svint16_t test_svrev_s16(svint16_t op) MODE_ATTR |
| 51 |
{ |
| 52 |
return SVE_ACLE_FUNC(svrev,_s16,,)(op); |
| 53 |
} |
| 54 |
|
| 55 |
// CHECK-LABEL: @test_svrev_s32( |
| 56 |
// CHECK-NEXT: entry: |
| 57 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> [[OP:%.*]]) |
| 58 |
// CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]] |
| 59 |
// |
| 60 |
// CPP-CHECK-LABEL: @_Z14test_svrev_s32u11__SVInt32_t( |
| 61 |
// CPP-CHECK-NEXT: entry: |
| 62 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> [[OP:%.*]]) |
| 63 |
// CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]] |
| 64 |
// |
| 65 |
svint32_t test_svrev_s32(svint32_t op) MODE_ATTR |
| 66 |
{ |
| 67 |
return SVE_ACLE_FUNC(svrev,_s32,,)(op); |
| 68 |
} |
| 69 |
|
| 70 |
// CHECK-LABEL: @test_svrev_s64( |
| 71 |
// CHECK-NEXT: entry: |
| 72 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.reverse.nxv2i64(<vscale x 2 x i64> [[OP:%.*]]) |
| 73 |
// CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]] |
| 74 |
// |
| 75 |
// CPP-CHECK-LABEL: @_Z14test_svrev_s64u11__SVInt64_t( |
| 76 |
// CPP-CHECK-NEXT: entry: |
| 77 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.reverse.nxv2i64(<vscale x 2 x i64> [[OP:%.*]]) |
| 78 |
// CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]] |
| 79 |
// |
| 80 |
svint64_t test_svrev_s64(svint64_t op) MODE_ATTR |
| 81 |
{ |
| 82 |
return SVE_ACLE_FUNC(svrev,_s64,,)(op); |
| 83 |
} |
| 84 |
|
| 85 |
// CHECK-LABEL: @test_svrev_u8( |
| 86 |
// CHECK-NEXT: entry: |
| 87 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.reverse.nxv16i8(<vscale x 16 x i8> [[OP:%.*]]) |
| 88 |
// CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]] |
| 89 |
// |
| 90 |
// CPP-CHECK-LABEL: @_Z13test_svrev_u8u11__SVUint8_t( |
| 91 |
// CPP-CHECK-NEXT: entry: |
| 92 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.reverse.nxv16i8(<vscale x 16 x i8> [[OP:%.*]]) |
| 93 |
// CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]] |
| 94 |
// |
| 95 |
svuint8_t test_svrev_u8(svuint8_t op) MODE_ATTR |
| 96 |
{ |
| 97 |
return SVE_ACLE_FUNC(svrev,_u8,,)(op); |
| 98 |
} |
| 99 |
|
| 100 |
// CHECK-LABEL: @test_svrev_u16( |
| 101 |
// CHECK-NEXT: entry: |
| 102 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.reverse.nxv8i16(<vscale x 8 x i16> [[OP:%.*]]) |
| 103 |
// CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]] |
| 104 |
// |
| 105 |
// CPP-CHECK-LABEL: @_Z14test_svrev_u16u12__SVUint16_t( |
| 106 |
// CPP-CHECK-NEXT: entry: |
| 107 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.reverse.nxv8i16(<vscale x 8 x i16> [[OP:%.*]]) |
| 108 |
// CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]] |
| 109 |
// |
| 110 |
svuint16_t test_svrev_u16(svuint16_t op) MODE_ATTR |
| 111 |
{ |
| 112 |
return SVE_ACLE_FUNC(svrev,_u16,,)(op); |
| 113 |
} |
| 114 |
|
| 115 |
// CHECK-LABEL: @test_svrev_u32( |
| 116 |
// CHECK-NEXT: entry: |
| 117 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> [[OP:%.*]]) |
| 118 |
// CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]] |
| 119 |
// |
| 120 |
// CPP-CHECK-LABEL: @_Z14test_svrev_u32u12__SVUint32_t( |
| 121 |
// CPP-CHECK-NEXT: entry: |
| 122 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> [[OP:%.*]]) |
| 123 |
// CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]] |
| 124 |
// |
| 125 |
svuint32_t test_svrev_u32(svuint32_t op) MODE_ATTR |
| 126 |
{ |
| 127 |
return SVE_ACLE_FUNC(svrev,_u32,,)(op); |
| 128 |
} |
| 129 |
|
| 130 |
// CHECK-LABEL: @test_svrev_u64( |
| 131 |
// CHECK-NEXT: entry: |
| 132 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.reverse.nxv2i64(<vscale x 2 x i64> [[OP:%.*]]) |
| 133 |
// CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]] |
| 134 |
// |
| 135 |
// CPP-CHECK-LABEL: @_Z14test_svrev_u64u12__SVUint64_t( |
| 136 |
// CPP-CHECK-NEXT: entry: |
| 137 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.reverse.nxv2i64(<vscale x 2 x i64> [[OP:%.*]]) |
| 138 |
// CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]] |
| 139 |
// |
| 140 |
svuint64_t test_svrev_u64(svuint64_t op) MODE_ATTR |
| 141 |
{ |
| 142 |
return SVE_ACLE_FUNC(svrev,_u64,,)(op); |
| 143 |
} |
| 144 |
|
| 145 |
// CHECK-LABEL: @test_svrev_f16( |
| 146 |
// CHECK-NEXT: entry: |
| 147 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.vector.reverse.nxv8f16(<vscale x 8 x half> [[OP:%.*]]) |
| 148 |
// CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]] |
| 149 |
// |
| 150 |
// CPP-CHECK-LABEL: @_Z14test_svrev_f16u13__SVFloat16_t( |
| 151 |
// CPP-CHECK-NEXT: entry: |
| 152 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.vector.reverse.nxv8f16(<vscale x 8 x half> [[OP:%.*]]) |
| 153 |
// CPP-CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]] |
| 154 |
// |
| 155 |
svfloat16_t test_svrev_f16(svfloat16_t op) MODE_ATTR |
| 156 |
{ |
| 157 |
return SVE_ACLE_FUNC(svrev,_f16,,)(op); |
| 158 |
} |
| 159 |
|
| 160 |
// CHECK-LABEL: @test_svrev_f32( |
| 161 |
// CHECK-NEXT: entry: |
| 162 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.vector.reverse.nxv4f32(<vscale x 4 x float> [[OP:%.*]]) |
| 163 |
// CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]] |
| 164 |
// |
| 165 |
// CPP-CHECK-LABEL: @_Z14test_svrev_f32u13__SVFloat32_t( |
| 166 |
// CPP-CHECK-NEXT: entry: |
| 167 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.vector.reverse.nxv4f32(<vscale x 4 x float> [[OP:%.*]]) |
| 168 |
// CPP-CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]] |
| 169 |
// |
| 170 |
svfloat32_t test_svrev_f32(svfloat32_t op) MODE_ATTR |
| 171 |
{ |
| 172 |
return SVE_ACLE_FUNC(svrev,_f32,,)(op); |
| 173 |
} |
| 174 |
|
| 175 |
// CHECK-LABEL: @test_svrev_f64( |
| 176 |
// CHECK-NEXT: entry: |
| 177 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.vector.reverse.nxv2f64(<vscale x 2 x double> [[OP:%.*]]) |
| 178 |
// CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]] |
| 179 |
// |
| 180 |
// CPP-CHECK-LABEL: @_Z14test_svrev_f64u13__SVFloat64_t( |
| 181 |
// CPP-CHECK-NEXT: entry: |
| 182 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.vector.reverse.nxv2f64(<vscale x 2 x double> [[OP:%.*]]) |
| 183 |
// CPP-CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]] |
| 184 |
// |
| 185 |
svfloat64_t test_svrev_f64(svfloat64_t op) MODE_ATTR |
| 186 |
{ |
| 187 |
return SVE_ACLE_FUNC(svrev,_f64,,)(op); |
| 188 |
} |
| 189 |
|
| 190 |
// CHECK-LABEL: @test_svrev_b8( |
| 191 |
// CHECK-NEXT: entry: |
| 192 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.vector.reverse.nxv16i1(<vscale x 16 x i1> [[OP:%.*]]) |
| 193 |
// CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 194 |
// |
| 195 |
// CPP-CHECK-LABEL: @_Z13test_svrev_b8u10__SVBool_t( |
| 196 |
// CPP-CHECK-NEXT: entry: |
| 197 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.vector.reverse.nxv16i1(<vscale x 16 x i1> [[OP:%.*]]) |
| 198 |
// CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 199 |
// |
| 200 |
svbool_t test_svrev_b8(svbool_t op) MODE_ATTR |
| 201 |
{ |
| 202 |
return svrev_b8(op); |
| 203 |
} |
| 204 |
|
| 205 |
// CHECK-LABEL: @test_svrev_b16( |
| 206 |
// CHECK-NEXT: entry: |
| 207 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.rev.b16(<vscale x 16 x i1> [[OP:%.*]]) |
| 208 |
// CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 209 |
// |
| 210 |
// CPP-CHECK-LABEL: @_Z14test_svrev_b16u10__SVBool_t( |
| 211 |
// CPP-CHECK-NEXT: entry: |
| 212 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.rev.b16(<vscale x 16 x i1> [[OP:%.*]]) |
| 213 |
// CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 214 |
// |
| 215 |
svbool_t test_svrev_b16(svbool_t op) MODE_ATTR |
| 216 |
{ |
| 217 |
return svrev_b16(op); |
| 218 |
} |
| 219 |
|
| 220 |
// CHECK-LABEL: @test_svrev_b32( |
| 221 |
// CHECK-NEXT: entry: |
| 222 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.rev.b32(<vscale x 16 x i1> [[OP:%.*]]) |
| 223 |
// CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 224 |
// |
| 225 |
// CPP-CHECK-LABEL: @_Z14test_svrev_b32u10__SVBool_t( |
| 226 |
// CPP-CHECK-NEXT: entry: |
| 227 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.rev.b32(<vscale x 16 x i1> [[OP:%.*]]) |
| 228 |
// CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 229 |
// |
| 230 |
svbool_t test_svrev_b32(svbool_t op) MODE_ATTR |
| 231 |
{ |
| 232 |
return svrev_b32(op); |
| 233 |
} |
| 234 |
|
| 235 |
// CHECK-LABEL: @test_svrev_b64( |
| 236 |
// CHECK-NEXT: entry: |
| 237 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.rev.b64(<vscale x 16 x i1> [[OP:%.*]]) |
| 238 |
// CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 239 |
// |
| 240 |
// CPP-CHECK-LABEL: @_Z14test_svrev_b64u10__SVBool_t( |
| 241 |
// CPP-CHECK-NEXT: entry: |
| 242 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.rev.b64(<vscale x 16 x i1> [[OP:%.*]]) |
| 243 |
// CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]] |
| 244 |
// |
| 245 |
svbool_t test_svrev_b64(svbool_t op) MODE_ATTR |
| 246 |
{ |
| 247 |
return svrev_b64(op); |
| 248 |
} |
| 249 |
|
| 250 |
// CHECK-LABEL: @test_svrev_bf16( |
| 251 |
// CHECK-NEXT: entry: |
| 252 |
// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x bfloat> @llvm.vector.reverse.nxv8bf16(<vscale x 8 x bfloat> [[OP:%.*]]) |
| 253 |
// CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]] |
| 254 |
// |
| 255 |
// CPP-CHECK-LABEL: @_Z15test_svrev_bf16u14__SVBfloat16_t( |
| 256 |
// CPP-CHECK-NEXT: entry: |
| 257 |
// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x bfloat> @llvm.vector.reverse.nxv8bf16(<vscale x 8 x bfloat> [[OP:%.*]]) |
| 258 |
// CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]] |
| 259 |
// |
| 260 |
svbfloat16_t test_svrev_bf16(svbfloat16_t op) MODE_ATTR |
| 261 |
{ |
| 262 |
return SVE_ACLE_FUNC(svrev,_bf16,,)(op); |
| 263 |
} |