Files
TheRock/compiler/amd-llvm/clang/test/CodeGen/AArch64/sve-vector-subscript-ops.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

113 lines
3.4 KiB
C

// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
// RUN: -disable-O0-optnone \
// RUN: -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s
// REQUIRES: aarch64-registered-target
#include <arm_sve.h>
#include <stddef.h>
// CHECK-LABEL: @subscript_int16(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 8 x i16> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret i16 [[VECEXT]]
//
int16_t subscript_int16(svint16_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_uint16(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 8 x i16> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret i16 [[VECEXT]]
//
uint16_t subscript_uint16(svuint16_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_int32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x i32> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret i32 [[VECEXT]]
//
int32_t subscript_int32(svint32_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_uint32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x i32> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret i32 [[VECEXT]]
//
uint32_t subscript_uint32(svuint32_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_int64(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 2 x i64> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret i64 [[VECEXT]]
//
int64_t subscript_int64(svint64_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_uint64(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 2 x i64> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret i64 [[VECEXT]]
//
uint64_t subscript_uint64(svuint64_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_float16(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 8 x half> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret half [[VECEXT]]
//
__fp16 subscript_float16(svfloat16_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_float32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x float> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret float [[VECEXT]]
//
float subscript_float32(svfloat32_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_float64(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 2 x double> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: ret double [[VECEXT]]
//
double subscript_float64(svfloat64_t a, size_t b) {
return a[b];
}
// CHECK-LABEL: @subscript_write_float32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECINS:%.*]] = insertelement <vscale x 4 x float> [[A:%.*]], float 1.000000e+00, i64 [[B:%.*]]
// CHECK-NEXT: ret <vscale x 4 x float> [[VECINS]]
//
svfloat32_t subscript_write_float32(svfloat32_t a, size_t b) {
a[b] = 1.0f;
return a;
}
// CHECK-LABEL: @subscript_read_write_float32(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECEXT:%.*]] = extractelement <vscale x 4 x float> [[A:%.*]], i64 [[B:%.*]]
// CHECK-NEXT: [[ADD:%.*]] = fadd float [[VECEXT]], 1.000000e+00
// CHECK-NEXT: [[VECINS:%.*]] = insertelement <vscale x 4 x float> [[A]], float [[ADD]], i64 [[B]]
// CHECK-NEXT: ret <vscale x 4 x float> [[VECINS]]
//
svfloat32_t subscript_read_write_float32(svfloat32_t a, size_t b) {
a[b] += 1.0f;
return a;
}