xref: /llvm-project/clang/test/CodeGen/AArch64/sve-intrinsics/acle_sve_get3-bfloat.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
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 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
4*207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
5*207e5cccSFangrui Song // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
6*207e5cccSFangrui Song // RUN: %clang_cc1 -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,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
7*207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64 -target-feature +bf16 -target-feature +sve -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
8*207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64 -target-feature +bf16 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
9*207e5cccSFangrui Song 
10*207e5cccSFangrui Song #include <arm_sve.h>
11*207e5cccSFangrui Song 
12*207e5cccSFangrui Song #ifdef SVE_OVERLOADED_FORMS
13*207e5cccSFangrui Song // A simple used,unused... macro, long enough to represent any SVE builtin.
14*207e5cccSFangrui Song #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
15*207e5cccSFangrui Song #else
16*207e5cccSFangrui Song #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
17*207e5cccSFangrui Song #endif
18*207e5cccSFangrui Song 
19*207e5cccSFangrui Song #ifdef __ARM_FEATURE_SME
20*207e5cccSFangrui Song #define ATTR __arm_streaming
21*207e5cccSFangrui Song #else
22*207e5cccSFangrui Song #define ATTR
23*207e5cccSFangrui Song #endif
24*207e5cccSFangrui Song 
25*207e5cccSFangrui Song // CHECK-LABEL: @test_svget3_bf16_0(
26*207e5cccSFangrui Song // CHECK-NEXT:  entry:
27*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } poison, <vscale x 8 x bfloat> [[TUPLE_COERCE0:%.*]], 0
28*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP0]], <vscale x 8 x bfloat> [[TUPLE_COERCE1:%.*]], 1
29*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP1]], <vscale x 8 x bfloat> [[TUPLE_COERCE2:%.*]], 2
30*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = extractvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP2]], 0
31*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x bfloat> [[TMP3]]
32*207e5cccSFangrui Song //
33*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z18test_svget3_bf16_014svbfloat16x3_t(
34*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
35*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } poison, <vscale x 8 x bfloat> [[TUPLE_COERCE0:%.*]], 0
36*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP0]], <vscale x 8 x bfloat> [[TUPLE_COERCE1:%.*]], 1
37*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP1]], <vscale x 8 x bfloat> [[TUPLE_COERCE2:%.*]], 2
38*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP3:%.*]] = extractvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP2]], 0
39*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 8 x bfloat> [[TMP3]]
40*207e5cccSFangrui Song //
41*207e5cccSFangrui Song svbfloat16_t test_svget3_bf16_0(svbfloat16x3_t tuple) ATTR
42*207e5cccSFangrui Song {
43*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svget3,_bf16,,)(tuple, 0);
44*207e5cccSFangrui Song }
45*207e5cccSFangrui Song 
46*207e5cccSFangrui Song // CHECK-LABEL: @test_svget3_bf16_1(
47*207e5cccSFangrui Song // CHECK-NEXT:  entry:
48*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } poison, <vscale x 8 x bfloat> [[TUPLE_COERCE0:%.*]], 0
49*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP0]], <vscale x 8 x bfloat> [[TUPLE_COERCE1:%.*]], 1
50*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP1]], <vscale x 8 x bfloat> [[TUPLE_COERCE2:%.*]], 2
51*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = extractvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP2]], 1
52*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x bfloat> [[TMP3]]
53*207e5cccSFangrui Song //
54*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z18test_svget3_bf16_114svbfloat16x3_t(
55*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
56*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } poison, <vscale x 8 x bfloat> [[TUPLE_COERCE0:%.*]], 0
57*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP0]], <vscale x 8 x bfloat> [[TUPLE_COERCE1:%.*]], 1
58*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP1]], <vscale x 8 x bfloat> [[TUPLE_COERCE2:%.*]], 2
59*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP3:%.*]] = extractvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP2]], 1
60*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 8 x bfloat> [[TMP3]]
61*207e5cccSFangrui Song //
62*207e5cccSFangrui Song svbfloat16_t test_svget3_bf16_1(svbfloat16x3_t tuple) ATTR
63*207e5cccSFangrui Song {
64*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svget3,_bf16,,)(tuple, 1);
65*207e5cccSFangrui Song }
66*207e5cccSFangrui Song 
67*207e5cccSFangrui Song // CHECK-LABEL: @test_svget3_bf16_2(
68*207e5cccSFangrui Song // CHECK-NEXT:  entry:
69*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } poison, <vscale x 8 x bfloat> [[TUPLE_COERCE0:%.*]], 0
70*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP0]], <vscale x 8 x bfloat> [[TUPLE_COERCE1:%.*]], 1
71*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP1]], <vscale x 8 x bfloat> [[TUPLE_COERCE2:%.*]], 2
72*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = extractvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP2]], 2
73*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x bfloat> [[TMP3]]
74*207e5cccSFangrui Song //
75*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z18test_svget3_bf16_214svbfloat16x3_t(
76*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
77*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } poison, <vscale x 8 x bfloat> [[TUPLE_COERCE0:%.*]], 0
78*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP0]], <vscale x 8 x bfloat> [[TUPLE_COERCE1:%.*]], 1
79*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = insertvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP1]], <vscale x 8 x bfloat> [[TUPLE_COERCE2:%.*]], 2
80*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP3:%.*]] = extractvalue { <vscale x 8 x bfloat>, <vscale x 8 x bfloat>, <vscale x 8 x bfloat> } [[TMP2]], 2
81*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 8 x bfloat> [[TMP3]]
82*207e5cccSFangrui Song //
83*207e5cccSFangrui Song svbfloat16_t test_svget3_bf16_2(svbfloat16x3_t tuple) ATTR
84*207e5cccSFangrui Song {
85*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svget3,_bf16,,)(tuple, 2);
86*207e5cccSFangrui Song }
87