245 lines · c
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 22// REQUIRES: aarch64-registered-target3// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 -target-feature +sve2p1 \4// RUN: -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s5// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sme2 -target-feature +sme2p1 \6// RUN: -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s7// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme -target-feature +sve2p1 \8// RUN: -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s9// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme -target-feature +sme2p1 \10// RUN: -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s11// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 -target-feature +sve2p1 \12// RUN: -Werror -emit-llvm -disable-O0-optnone -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s13// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 -target-feature +sve2p1 \14// RUN: -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK15// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 -target-feature +sve2p1 \16// RUN: -Werror -emit-llvm -disable-O0-optnone -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK17// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 -target-feature +sve2p1 \18// RUN: -S -disable-O0-optnone -Werror -Wall -o /dev/null %s19 20 21#include <arm_sve.h>22 23#ifdef SVE_OVERLOADED_FORMS24// A simple used,unused... macro, long enough to represent any SVE builtin.25#define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A326#else27#define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A428#endif29 30#if defined(__ARM_FEATURE_SME) && defined(__ARM_FEATURE_SVE)31#define ATTR __arm_streaming_compatible32#elif defined(__ARM_FEATURE_SME)33#define ATTR __arm_streaming34#else35#define ATTR36#endif37 38// CHECK-LABEL: define dso_local <vscale x 16 x i8> @test_svtblq_u839// CHECK-SAME: (<vscale x 16 x i8> [[ZN:%.*]], <vscale x 16 x i8> [[ZM:%.*]]) #[[ATTR0:[0-9]+]] {40// CHECK-NEXT: entry:41// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.tblq.nxv16i8(<vscale x 16 x i8> [[ZN]], <vscale x 16 x i8> [[ZM]])42// CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]43//44// CPP-CHECK-LABEL: define dso_local <vscale x 16 x i8> @_Z14test_svtblq_u8u11__SVUint8_tS_45// CPP-CHECK-SAME: (<vscale x 16 x i8> [[ZN:%.*]], <vscale x 16 x i8> [[ZM:%.*]]) #[[ATTR0:[0-9]+]] {46// CPP-CHECK-NEXT: entry:47// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.tblq.nxv16i8(<vscale x 16 x i8> [[ZN]], <vscale x 16 x i8> [[ZM]])48// CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]49//50svuint8_t test_svtblq_u8(svuint8_t zn, svuint8_t zm) ATTR {51 return SVE_ACLE_FUNC(svtblq, _u8,,)(zn, zm);52}53 54// CHECK-LABEL: define dso_local <vscale x 8 x i16> @test_svtblq_u1655// CHECK-SAME: (<vscale x 8 x i16> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {56// CHECK-NEXT: entry:57// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.tblq.nxv8i16(<vscale x 8 x i16> [[ZN]], <vscale x 8 x i16> [[ZM]])58// CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]59//60// CPP-CHECK-LABEL: define dso_local <vscale x 8 x i16> @_Z15test_svtblq_u16u12__SVUint16_tS_61// CPP-CHECK-SAME: (<vscale x 8 x i16> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {62// CPP-CHECK-NEXT: entry:63// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.tblq.nxv8i16(<vscale x 8 x i16> [[ZN]], <vscale x 8 x i16> [[ZM]])64// CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]65//66svuint16_t test_svtblq_u16(svuint16_t zn, svuint16_t zm) ATTR {67 return SVE_ACLE_FUNC(svtblq, _u16,,)(zn, zm);68}69 70// CHECK-LABEL: define dso_local <vscale x 4 x i32> @test_svtblq_u3271// CHECK-SAME: (<vscale x 4 x i32> [[ZN:%.*]], <vscale x 4 x i32> [[ZM:%.*]]) #[[ATTR0]] {72// CHECK-NEXT: entry:73// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.tblq.nxv4i32(<vscale x 4 x i32> [[ZN]], <vscale x 4 x i32> [[ZM]])74// CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]75//76// CPP-CHECK-LABEL: define dso_local <vscale x 4 x i32> @_Z15test_svtblq_u32u12__SVUint32_tS_77// CPP-CHECK-SAME: (<vscale x 4 x i32> [[ZN:%.*]], <vscale x 4 x i32> [[ZM:%.*]]) #[[ATTR0]] {78// CPP-CHECK-NEXT: entry:79// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.tblq.nxv4i32(<vscale x 4 x i32> [[ZN]], <vscale x 4 x i32> [[ZM]])80// CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]81//82svuint32_t test_svtblq_u32(svuint32_t zn, svuint32_t zm) ATTR {83 return SVE_ACLE_FUNC(svtblq, _u32,,)(zn, zm);84}85 86// CHECK-LABEL: define dso_local <vscale x 2 x i64> @test_svtblq_u6487// CHECK-SAME: (<vscale x 2 x i64> [[ZN:%.*]], <vscale x 2 x i64> [[ZM:%.*]]) #[[ATTR0]] {88// CHECK-NEXT: entry:89// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.tblq.nxv2i64(<vscale x 2 x i64> [[ZN]], <vscale x 2 x i64> [[ZM]])90// CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]91//92// CPP-CHECK-LABEL: define dso_local <vscale x 2 x i64> @_Z15test_svtblq_u64u12__SVUint64_tS_93// CPP-CHECK-SAME: (<vscale x 2 x i64> [[ZN:%.*]], <vscale x 2 x i64> [[ZM:%.*]]) #[[ATTR0]] {94// CPP-CHECK-NEXT: entry:95// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.tblq.nxv2i64(<vscale x 2 x i64> [[ZN]], <vscale x 2 x i64> [[ZM]])96// CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]97//98svuint64_t test_svtblq_u64(svuint64_t zn, svuint64_t zm) ATTR {99 return SVE_ACLE_FUNC(svtblq, _u64,,)(zn, zm);100}101 102// CHECK-LABEL: define dso_local <vscale x 16 x i8> @test_svtblq_s8103// CHECK-SAME: (<vscale x 16 x i8> [[ZN:%.*]], <vscale x 16 x i8> [[ZM:%.*]]) #[[ATTR0]] {104// CHECK-NEXT: entry:105// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.tblq.nxv16i8(<vscale x 16 x i8> [[ZN]], <vscale x 16 x i8> [[ZM]])106// CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]107//108// CPP-CHECK-LABEL: define dso_local <vscale x 16 x i8> @_Z14test_svtblq_s8u10__SVInt8_tu11__SVUint8_t109// CPP-CHECK-SAME: (<vscale x 16 x i8> [[ZN:%.*]], <vscale x 16 x i8> [[ZM:%.*]]) #[[ATTR0]] {110// CPP-CHECK-NEXT: entry:111// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.tblq.nxv16i8(<vscale x 16 x i8> [[ZN]], <vscale x 16 x i8> [[ZM]])112// CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]113//114svint8_t test_svtblq_s8(svint8_t zn, svuint8_t zm) ATTR {115 return SVE_ACLE_FUNC(svtblq, _s8,,)(zn, zm);116}117 118// CHECK-LABEL: define dso_local <vscale x 8 x i16> @test_svtblq_s16119// CHECK-SAME: (<vscale x 8 x i16> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {120// CHECK-NEXT: entry:121// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.tblq.nxv8i16(<vscale x 8 x i16> [[ZN]], <vscale x 8 x i16> [[ZM]])122// CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]123//124// CPP-CHECK-LABEL: define dso_local <vscale x 8 x i16> @_Z15test_svtblq_s16u11__SVInt16_tu12__SVUint16_t125// CPP-CHECK-SAME: (<vscale x 8 x i16> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {126// CPP-CHECK-NEXT: entry:127// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.tblq.nxv8i16(<vscale x 8 x i16> [[ZN]], <vscale x 8 x i16> [[ZM]])128// CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]129//130svint16_t test_svtblq_s16(svint16_t zn, svuint16_t zm) ATTR {131 return SVE_ACLE_FUNC(svtblq, _s16,,)(zn, zm);132}133 134// CHECK-LABEL: define dso_local <vscale x 4 x i32> @test_svtblq_s32135// CHECK-SAME: (<vscale x 4 x i32> [[ZN:%.*]], <vscale x 4 x i32> [[ZM:%.*]]) #[[ATTR0]] {136// CHECK-NEXT: entry:137// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.tblq.nxv4i32(<vscale x 4 x i32> [[ZN]], <vscale x 4 x i32> [[ZM]])138// CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]139//140// CPP-CHECK-LABEL: define dso_local <vscale x 4 x i32> @_Z15test_svtblq_s32u11__SVInt32_tu12__SVUint32_t141// CPP-CHECK-SAME: (<vscale x 4 x i32> [[ZN:%.*]], <vscale x 4 x i32> [[ZM:%.*]]) #[[ATTR0]] {142// CPP-CHECK-NEXT: entry:143// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.tblq.nxv4i32(<vscale x 4 x i32> [[ZN]], <vscale x 4 x i32> [[ZM]])144// CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]145//146svint32_t test_svtblq_s32(svint32_t zn, svuint32_t zm) ATTR {147 return SVE_ACLE_FUNC(svtblq, _s32,,)(zn, zm);148}149 150// CHECK-LABEL: define dso_local <vscale x 2 x i64> @test_svtblq_s64151// CHECK-SAME: (<vscale x 2 x i64> [[ZN:%.*]], <vscale x 2 x i64> [[ZM:%.*]]) #[[ATTR0]] {152// CHECK-NEXT: entry:153// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.tblq.nxv2i64(<vscale x 2 x i64> [[ZN]], <vscale x 2 x i64> [[ZM]])154// CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]155//156// CPP-CHECK-LABEL: define dso_local <vscale x 2 x i64> @_Z15test_svtblq_s64u11__SVInt64_tu12__SVUint64_t157// CPP-CHECK-SAME: (<vscale x 2 x i64> [[ZN:%.*]], <vscale x 2 x i64> [[ZM:%.*]]) #[[ATTR0]] {158// CPP-CHECK-NEXT: entry:159// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.tblq.nxv2i64(<vscale x 2 x i64> [[ZN]], <vscale x 2 x i64> [[ZM]])160// CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]161//162svint64_t test_svtblq_s64(svint64_t zn, svuint64_t zm) ATTR {163 return SVE_ACLE_FUNC(svtblq, _s64,,)(zn, zm);164}165 166// CHECK-LABEL: define dso_local <vscale x 8 x half> @test_svtblq_f16167// CHECK-SAME: (<vscale x 8 x half> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {168// CHECK-NEXT: entry:169// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.aarch64.sve.tblq.nxv8f16(<vscale x 8 x half> [[ZN]], <vscale x 8 x i16> [[ZM]])170// CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]171//172// CPP-CHECK-LABEL: define dso_local <vscale x 8 x half> @_Z15test_svtblq_f16u13__SVFloat16_tu12__SVUint16_t173// CPP-CHECK-SAME: (<vscale x 8 x half> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {174// CPP-CHECK-NEXT: entry:175// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.aarch64.sve.tblq.nxv8f16(<vscale x 8 x half> [[ZN]], <vscale x 8 x i16> [[ZM]])176// CPP-CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]177//178svfloat16_t test_svtblq_f16(svfloat16_t zn, svuint16_t zm) ATTR {179 return SVE_ACLE_FUNC(svtblq, _f16,,)(zn, zm);180}181 182// CHECK-LABEL: define dso_local <vscale x 4 x float> @test_svtblq_f32183// CHECK-SAME: (<vscale x 4 x float> [[ZN:%.*]], <vscale x 4 x i32> [[ZM:%.*]]) #[[ATTR0]] {184// CHECK-NEXT: entry:185// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.aarch64.sve.tblq.nxv4f32(<vscale x 4 x float> [[ZN]], <vscale x 4 x i32> [[ZM]])186// CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]187//188// CPP-CHECK-LABEL: define dso_local <vscale x 4 x float> @_Z15test_svtblq_f32u13__SVFloat32_tu12__SVUint32_t189// CPP-CHECK-SAME: (<vscale x 4 x float> [[ZN:%.*]], <vscale x 4 x i32> [[ZM:%.*]]) #[[ATTR0]] {190// CPP-CHECK-NEXT: entry:191// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.aarch64.sve.tblq.nxv4f32(<vscale x 4 x float> [[ZN]], <vscale x 4 x i32> [[ZM]])192// CPP-CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]193//194svfloat32_t test_svtblq_f32(svfloat32_t zn, svuint32_t zm) ATTR {195 return SVE_ACLE_FUNC(svtblq, _f32,,)(zn, zm);196}197 198// CHECK-LABEL: define dso_local <vscale x 2 x double> @test_svtblq_f64199// CHECK-SAME: (<vscale x 2 x double> [[ZN:%.*]], <vscale x 2 x i64> [[ZM:%.*]]) #[[ATTR0]] {200// CHECK-NEXT: entry:201// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.aarch64.sve.tblq.nxv2f64(<vscale x 2 x double> [[ZN]], <vscale x 2 x i64> [[ZM]])202// CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]203//204// CPP-CHECK-LABEL: define dso_local <vscale x 2 x double> @_Z15test_svtblq_f64u13__SVFloat64_tu12__SVUint64_t205// CPP-CHECK-SAME: (<vscale x 2 x double> [[ZN:%.*]], <vscale x 2 x i64> [[ZM:%.*]]) #[[ATTR0]] {206// CPP-CHECK-NEXT: entry:207// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.aarch64.sve.tblq.nxv2f64(<vscale x 2 x double> [[ZN]], <vscale x 2 x i64> [[ZM]])208// CPP-CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]209//210svfloat64_t test_svtblq_f64(svfloat64_t zn, svuint64_t zm) ATTR {211 return SVE_ACLE_FUNC(svtblq, _f64,,)(zn, zm);212}213 214// CHECK-LABEL: define dso_local <vscale x 8 x bfloat> @test_svtblq_bf16215// CHECK-SAME: (<vscale x 8 x bfloat> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {216// CHECK-NEXT: entry:217// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.tblq.nxv8bf16(<vscale x 8 x bfloat> [[ZN]], <vscale x 8 x i16> [[ZM]])218// CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]]219//220// CPP-CHECK-LABEL: define dso_local <vscale x 8 x bfloat> @_Z16test_svtblq_bf16u14__SVBfloat16_tu12__SVUint16_t221// CPP-CHECK-SAME: (<vscale x 8 x bfloat> [[ZN:%.*]], <vscale x 8 x i16> [[ZM:%.*]]) #[[ATTR0]] {222// CPP-CHECK-NEXT: entry:223// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.tblq.nxv8bf16(<vscale x 8 x bfloat> [[ZN]], <vscale x 8 x i16> [[ZM]])224// CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]]225//226svbfloat16_t test_svtblq_bf16(svbfloat16_t zn, svuint16_t zm) ATTR {227 return SVE_ACLE_FUNC(svtblq, _bf16,,)(zn, zm);228}229 230// CHECK-LABEL: define dso_local <vscale x 16 x i8> @test_svtblq_mf8231// CHECK-SAME: (<vscale x 16 x i8> [[ZN:%.*]], <vscale x 16 x i8> [[ZM:%.*]]) #[[ATTR0]] {232// CHECK-NEXT: entry:233// CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.tblq.nxv16i8(<vscale x 16 x i8> [[ZN]], <vscale x 16 x i8> [[ZM]])234// CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]235//236// CPP-CHECK-LABEL: define dso_local <vscale x 16 x i8> @_Z15test_svtblq_mf8u13__SVMfloat8_tu11__SVUint8_t237// CPP-CHECK-SAME: (<vscale x 16 x i8> [[ZN:%.*]], <vscale x 16 x i8> [[ZM:%.*]]) #[[ATTR0]] {238// CPP-CHECK-NEXT: entry:239// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.tblq.nxv16i8(<vscale x 16 x i8> [[ZN]], <vscale x 16 x i8> [[ZM]])240// CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]241//242svmfloat8_t test_svtblq_mf8(svmfloat8_t zn, svuint8_t zm) ATTR {243 return SVE_ACLE_FUNC(svtblq, _mf8,,)(zn, zm);244}245