1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
3 // RUN: -disable-O0-optnone \
4 // RUN: -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s
6 // REQUIRES: aarch64-registered-target
11 // CHECK-LABEL: @subscript_int16(
13 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 8 x i16> [[A:%.*]], i64 [[B:%.*]]
14 // CHECK-NEXT: ret i16 [[VECEXT]]
16 int16_t subscript_int16(svint16_t a
, size_t b
) {
20 // CHECK-LABEL: @subscript_uint16(
22 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 8 x i16> [[A:%.*]], i64 [[B:%.*]]
23 // CHECK-NEXT: ret i16 [[VECEXT]]
25 uint16_t subscript_uint16(svuint16_t a
, size_t b
) {
29 // CHECK-LABEL: @subscript_int32(
31 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x i32> [[A:%.*]], i64 [[B:%.*]]
32 // CHECK-NEXT: ret i32 [[VECEXT]]
34 int32_t subscript_int32(svint32_t a
, size_t b
) {
38 // CHECK-LABEL: @subscript_uint32(
40 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x i32> [[A:%.*]], i64 [[B:%.*]]
41 // CHECK-NEXT: ret i32 [[VECEXT]]
43 uint32_t subscript_uint32(svuint32_t a
, size_t b
) {
47 // CHECK-LABEL: @subscript_int64(
49 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 2 x i64> [[A:%.*]], i64 [[B:%.*]]
50 // CHECK-NEXT: ret i64 [[VECEXT]]
52 int64_t subscript_int64(svint64_t a
, size_t b
) {
56 // CHECK-LABEL: @subscript_uint64(
58 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 2 x i64> [[A:%.*]], i64 [[B:%.*]]
59 // CHECK-NEXT: ret i64 [[VECEXT]]
61 uint64_t subscript_uint64(svuint64_t a
, size_t b
) {
65 // CHECK-LABEL: @subscript_float16(
67 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 8 x half> [[A:%.*]], i64 [[B:%.*]]
68 // CHECK-NEXT: ret half [[VECEXT]]
70 __fp16
subscript_float16(svfloat16_t a
, size_t b
) {
74 // CHECK-LABEL: @subscript_float32(
76 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x float> [[A:%.*]], i64 [[B:%.*]]
77 // CHECK-NEXT: ret float [[VECEXT]]
79 float subscript_float32(svfloat32_t a
, size_t b
) {
83 // CHECK-LABEL: @subscript_float64(
85 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 2 x double> [[A:%.*]], i64 [[B:%.*]]
86 // CHECK-NEXT: ret double [[VECEXT]]
88 double subscript_float64(svfloat64_t a
, size_t b
) {
92 // CHECK-LABEL: @subscript_write_float32(
94 // CHECK-NEXT: [[VECINS:%.*]] = insertelement <vscale x 4 x float> [[A:%.*]], float 1.000000e+00, i64 [[B:%.*]]
95 // CHECK-NEXT: ret <vscale x 4 x float> [[VECINS]]
97 svfloat32_t
subscript_write_float32(svfloat32_t a
, size_t b
) {
102 // CHECK-LABEL: @subscript_read_write_float32(
103 // CHECK-NEXT: entry:
104 // CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x float> [[A:%.*]], i64 [[B:%.*]]
105 // CHECK-NEXT: [[ADD:%.*]] = fadd float [[VECEXT]], 1.000000e+00
106 // CHECK-NEXT: [[VECINS:%.*]] = insertelement <vscale x 4 x float> [[A]], float [[ADD]], i64 [[B]]
107 // CHECK-NEXT: ret <vscale x 4 x float> [[VECINS]]
109 svfloat32_t
subscript_read_write_float32(svfloat32_t a
, size_t b
) {