1*207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 2*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target 3*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s 4*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK 5*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s 6*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK 7*207e5cccSFangrui Song 8*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s 9*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sme -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s 10*207e5cccSFangrui Song 11*207e5cccSFangrui Song #include <arm_sve.h> 12*207e5cccSFangrui Song 13*207e5cccSFangrui Song #if defined __ARM_FEATURE_SME 14*207e5cccSFangrui Song #define MODE_ATTR __arm_streaming 15*207e5cccSFangrui Song #else 16*207e5cccSFangrui Song #define MODE_ATTR 17*207e5cccSFangrui Song #endif 18*207e5cccSFangrui Song 19*207e5cccSFangrui Song #ifdef SVE_OVERLOADED_FORMS 20*207e5cccSFangrui Song // A simple used,unused... macro, long enough to represent any SVE builtin. 21*207e5cccSFangrui Song #define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3 22*207e5cccSFangrui Song #else 23*207e5cccSFangrui Song #define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4 24*207e5cccSFangrui Song #endif 25*207e5cccSFangrui Song 26*207e5cccSFangrui Song // CHECK-LABEL: @test_svdup_n_bf16( 27*207e5cccSFangrui Song // CHECK-NEXT: entry: 28*207e5cccSFangrui Song // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x bfloat> poison, bfloat [[OP:%.*]], i64 0 29*207e5cccSFangrui Song // CHECK-NEXT: [[TMP0:%.*]] = shufflevector <vscale x 8 x bfloat> [[DOTSPLATINSERT]], <vscale x 8 x bfloat> poison, <vscale x 8 x i32> zeroinitializer 30*207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]] 31*207e5cccSFangrui Song // 32*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z17test_svdup_n_bf16u6__bf16( 33*207e5cccSFangrui Song // CPP-CHECK-NEXT: entry: 34*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x bfloat> poison, bfloat [[OP:%.*]], i64 0 35*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP0:%.*]] = shufflevector <vscale x 8 x bfloat> [[DOTSPLATINSERT]], <vscale x 8 x bfloat> poison, <vscale x 8 x i32> zeroinitializer 36*207e5cccSFangrui Song // CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]] 37*207e5cccSFangrui Song // 38*207e5cccSFangrui Song svbfloat16_t test_svdup_n_bf16(bfloat16_t op) MODE_ATTR { 39*207e5cccSFangrui Song // expected-warning@+1 {{implicit declaration of function 'svdup_n_bf16'}} 40*207e5cccSFangrui Song return SVE_ACLE_FUNC(svdup, _n, _bf16, )(op); 41*207e5cccSFangrui Song } 42*207e5cccSFangrui Song 43*207e5cccSFangrui Song // CHECK-LABEL: @test_svdup_n_bf16_z( 44*207e5cccSFangrui Song // CHECK-NEXT: entry: 45*207e5cccSFangrui Song // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]]) 46*207e5cccSFangrui Song // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.nxv8bf16(<vscale x 8 x bfloat> zeroinitializer, <vscale x 8 x i1> [[TMP0]], bfloat [[OP:%.*]]) 47*207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP1]] 48*207e5cccSFangrui Song // 49*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z19test_svdup_n_bf16_zu10__SVBool_tu6__bf16( 50*207e5cccSFangrui Song // CPP-CHECK-NEXT: entry: 51*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]]) 52*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.nxv8bf16(<vscale x 8 x bfloat> zeroinitializer, <vscale x 8 x i1> [[TMP0]], bfloat [[OP:%.*]]) 53*207e5cccSFangrui Song // CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP1]] 54*207e5cccSFangrui Song // 55*207e5cccSFangrui Song svbfloat16_t test_svdup_n_bf16_z(svbool_t pg, bfloat16_t op) MODE_ATTR { 56*207e5cccSFangrui Song // expected-warning@+1 {{implicit declaration of function 'svdup_n_bf16_z'}} 57*207e5cccSFangrui Song return SVE_ACLE_FUNC(svdup, _n, _bf16_z, )(pg, op); 58*207e5cccSFangrui Song } 59*207e5cccSFangrui Song 60*207e5cccSFangrui Song // CHECK-LABEL: @test_svdup_n_bf16_m( 61*207e5cccSFangrui Song // CHECK-NEXT: entry: 62*207e5cccSFangrui Song // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]]) 63*207e5cccSFangrui Song // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.nxv8bf16(<vscale x 8 x bfloat> [[INACTIVE:%.*]], <vscale x 8 x i1> [[TMP0]], bfloat [[OP:%.*]]) 64*207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP1]] 65*207e5cccSFangrui Song // 66*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z19test_svdup_n_bf16_mu14__SVBfloat16_tu10__SVBool_tu6__bf16( 67*207e5cccSFangrui Song // CPP-CHECK-NEXT: entry: 68*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]]) 69*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.nxv8bf16(<vscale x 8 x bfloat> [[INACTIVE:%.*]], <vscale x 8 x i1> [[TMP0]], bfloat [[OP:%.*]]) 70*207e5cccSFangrui Song // CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP1]] 71*207e5cccSFangrui Song // 72*207e5cccSFangrui Song svbfloat16_t test_svdup_n_bf16_m(svbfloat16_t inactive, svbool_t pg, bfloat16_t op) MODE_ATTR { 73*207e5cccSFangrui Song // expected-warning@+1 {{implicit declaration of function 'svdup_n_bf16_m'}} 74*207e5cccSFangrui Song return SVE_ACLE_FUNC(svdup, _n, _bf16_m, )(inactive, pg, op); 75*207e5cccSFangrui Song } 76*207e5cccSFangrui Song 77*207e5cccSFangrui Song // CHECK-LABEL: @test_svdup_n_bf16_x( 78*207e5cccSFangrui Song // CHECK-NEXT: entry: 79*207e5cccSFangrui Song // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]]) 80*207e5cccSFangrui Song // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.nxv8bf16(<vscale x 8 x bfloat> undef, <vscale x 8 x i1> [[TMP0]], bfloat [[OP:%.*]]) 81*207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP1]] 82*207e5cccSFangrui Song // 83*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z19test_svdup_n_bf16_xu10__SVBool_tu6__bf16( 84*207e5cccSFangrui Song // CPP-CHECK-NEXT: entry: 85*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]]) 86*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.nxv8bf16(<vscale x 8 x bfloat> undef, <vscale x 8 x i1> [[TMP0]], bfloat [[OP:%.*]]) 87*207e5cccSFangrui Song // CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP1]] 88*207e5cccSFangrui Song // 89*207e5cccSFangrui Song svbfloat16_t test_svdup_n_bf16_x(svbool_t pg, bfloat16_t op) MODE_ATTR { 90*207e5cccSFangrui Song // expected-warning@+1 {{implicit declaration of function 'svdup_n_bf16_x'}} 91*207e5cccSFangrui Song return SVE_ACLE_FUNC(svdup, _n, _bf16_x, )(pg, op); 92*207e5cccSFangrui Song } 93*207e5cccSFangrui Song 94*207e5cccSFangrui Song // CHECK-LABEL: @test_svdup_lane_bf16( 95*207e5cccSFangrui Song // CHECK-NEXT: entry: 96*207e5cccSFangrui Song // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[INDEX:%.*]], i64 0 97*207e5cccSFangrui Song // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer 98*207e5cccSFangrui Song // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.tbl.nxv8bf16(<vscale x 8 x bfloat> [[DATA:%.*]], <vscale x 8 x i16> [[DOTSPLAT]]) 99*207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]] 100*207e5cccSFangrui Song // 101*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z20test_svdup_lane_bf16u14__SVBfloat16_tt( 102*207e5cccSFangrui Song // CPP-CHECK-NEXT: entry: 103*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[INDEX:%.*]], i64 0 104*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer 105*207e5cccSFangrui Song // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x bfloat> @llvm.aarch64.sve.tbl.nxv8bf16(<vscale x 8 x bfloat> [[DATA:%.*]], <vscale x 8 x i16> [[DOTSPLAT]]) 106*207e5cccSFangrui Song // CPP-CHECK-NEXT: ret <vscale x 8 x bfloat> [[TMP0]] 107*207e5cccSFangrui Song // 108*207e5cccSFangrui Song svbfloat16_t test_svdup_lane_bf16(svbfloat16_t data, uint16_t index) MODE_ATTR 109*207e5cccSFangrui Song { 110*207e5cccSFangrui Song // expected-warning@+1 {{implicit declaration of function 'svdup_lane_bf16'}} 111*207e5cccSFangrui Song return SVE_ACLE_FUNC(svdup_lane,_bf16,,)(data, index); 112*207e5cccSFangrui Song } 113