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
199 lines
9.8 KiB
LLVM
199 lines
9.8 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt -p instcombine -mtriple=riscv32 -mattr=+v -S %s | FileCheck %s --check-prefixes=CHECK,RV32
|
|
; RUN: opt -p instcombine -mtriple=riscv64 -mattr=+v -S %s | FileCheck %s --check-prefixes=CHECK,RV64
|
|
; RUN: opt -p instcombine -mtriple=riscv32 -mattr=+zve32x -S %s | FileCheck %s --check-prefixes=CHECK,ZVE32X
|
|
; RUN: opt -p instcombine -mtriple=riscv64 -mattr=+zve32x -S %s | FileCheck %s --check-prefixes=CHECK,ZVE32X
|
|
|
|
define <vscale x 2 x i32> @target_vl_one() {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @target_vl_one(
|
|
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x i32> @llvm.riscv.vmv.v.x.nxv2i32.i64(<vscale x 2 x i32> poison, i32 1431655765, i64 1)
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[TMP1]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 4 x i16> @target_vl_two() {
|
|
; CHECK-LABEL: define <vscale x 4 x i16> @target_vl_two(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 4 x i16> @llvm.riscv.vmv.v.x.nxv4i16.i64(<vscale x 4 x i16> poison, i16 21845, i64 2)
|
|
; CHECK-NEXT: ret <vscale x 4 x i16> [[TMP1]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 4 x i16>
|
|
ret <vscale x 4 x i16> %b
|
|
}
|
|
|
|
define <vscale x 2 x i32> @target_vl_32() {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @target_vl_32(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x i32> @llvm.riscv.vmv.v.x.nxv2i32.i64(<vscale x 2 x i32> poison, i32 1431655765, i64 32)
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[TMP1]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 128)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 2 x i32> @small_scalar() {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @small_scalar(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x i32> @llvm.riscv.vmv.v.x.nxv2i32.i64(<vscale x 2 x i32> poison, i32 50529027, i64 1)
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[TMP1]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 3, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 2 x i32> @negative_scalar() {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @negative_scalar(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[TMP1:%.*]] = call <vscale x 2 x i32> @llvm.riscv.vmv.v.x.nxv2i32.i64(<vscale x 2 x i32> poison, i32 -50529028, i64 1)
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[TMP1]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 -4, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 8 x i8> @no_bitcast() {
|
|
; CHECK-LABEL: define <vscale x 8 x i8> @no_bitcast(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
; CHECK-NEXT: ret <vscale x 8 x i8> [[A]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
ret <vscale x 8 x i8> %a
|
|
}
|
|
|
|
declare void @use.nxv2i32(<vscale x 2 x i32>)
|
|
declare void @use.nxv1i64(<vscale x 1 x i64>)
|
|
|
|
define void @bitcast_users_type_mismatch() {
|
|
; CHECK-LABEL: define void @bitcast_users_type_mismatch(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[VMV:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
; CHECK-NEXT: [[CAST_1:%.*]] = bitcast <vscale x 8 x i8> [[VMV]] to <vscale x 2 x i32>
|
|
; CHECK-NEXT: [[CAST_2:%.*]] = bitcast <vscale x 8 x i8> [[VMV]] to <vscale x 1 x i64>
|
|
; CHECK-NEXT: call void @use.nxv2i32(<vscale x 2 x i32> [[CAST_1]])
|
|
; CHECK-NEXT: call void @use.nxv1i64(<vscale x 1 x i64> [[CAST_2]])
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
%vmv = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
%cast.1 = bitcast <vscale x 8 x i8> %vmv to <vscale x 2 x i32>
|
|
%cast.2 = bitcast <vscale x 8 x i8> %vmv to <vscale x 1 x i64>
|
|
call void @use.nxv2i32(<vscale x 2 x i32> %cast.1)
|
|
call void @use.nxv1i64(<vscale x 1 x i64> %cast.2)
|
|
ret void
|
|
}
|
|
|
|
define <vscale x 1 x i64> @bitcast_target_elt_type_too_large() {
|
|
; CHECK-LABEL: define <vscale x 1 x i64> @bitcast_target_elt_type_too_large(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 1 x i64>
|
|
; CHECK-NEXT: ret <vscale x 1 x i64> [[B]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 1 x i64>
|
|
ret <vscale x 1 x i64> %b
|
|
}
|
|
|
|
define <vscale x 64 x i1> @bitcast_target_elt_type_too_small() {
|
|
; CHECK-LABEL: define <vscale x 64 x i1> @bitcast_target_elt_type_too_small(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 64 x i1>
|
|
; CHECK-NEXT: ret <vscale x 64 x i1> [[B]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 64 x i1>
|
|
ret <vscale x 64 x i1> %b
|
|
}
|
|
|
|
define <vscale x 2 x i32> @passthru_non_poison(<vscale x 8 x i8> %x) {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @passthru_non_poison(
|
|
; CHECK-SAME: <vscale x 8 x i8> [[X:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> [[X]], i8 85, i64 4)
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 2 x i32>
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[B]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> %x, i8 85, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 2 x i32> @scalar_non_constant(i8 %scalar) {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @scalar_non_constant(
|
|
; CHECK-SAME: i8 [[SCALAR:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 [[SCALAR]], i64 4)
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 2 x i32>
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[B]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 %scalar, i64 4)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 2 x i32> @vl_non_constant(i64 %vl) {
|
|
; CHECK-LABEL: define <vscale x 2 x i32> @vl_non_constant(
|
|
; CHECK-SAME: i64 [[VL:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 [[VL]])
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 2 x i32>
|
|
; CHECK-NEXT: ret <vscale x 2 x i32> [[B]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 %vl)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 2 x i32>
|
|
ret <vscale x 2 x i32> %b
|
|
}
|
|
|
|
define <vscale x 1 x i32> @vl_not_divisible() {
|
|
; CHECK-LABEL: define <vscale x 1 x i32> @vl_not_divisible(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 4 x i8> @llvm.riscv.vmv.v.x.nxv4i8.i64(<vscale x 4 x i8> poison, i8 85, i64 7)
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 4 x i8> [[A]] to <vscale x 1 x i32>
|
|
; CHECK-NEXT: ret <vscale x 1 x i32> [[B]]
|
|
;
|
|
%a = call <vscale x 4 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 4 x i8> poison, i8 85, i64 7)
|
|
%b = bitcast <vscale x 4 x i8> %a to <vscale x 1 x i32>
|
|
ret <vscale x 1 x i32> %b
|
|
}
|
|
|
|
define <vscale x 1 x i64> @vector_elt_type_legality() {
|
|
; RV32-LABEL: define <vscale x 1 x i64> @vector_elt_type_legality(
|
|
; RV32-SAME: ) #[[ATTR0]] {
|
|
; RV32-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 8)
|
|
; RV32-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 1 x i64>
|
|
; RV32-NEXT: ret <vscale x 1 x i64> [[B]]
|
|
;
|
|
; RV64-LABEL: define <vscale x 1 x i64> @vector_elt_type_legality(
|
|
; RV64-SAME: ) #[[ATTR0]] {
|
|
; RV64-NEXT: [[TMP1:%.*]] = call <vscale x 1 x i64> @llvm.riscv.vmv.v.x.nxv1i64.i64(<vscale x 1 x i64> poison, i64 6148914691236517205, i64 1)
|
|
; RV64-NEXT: ret <vscale x 1 x i64> [[TMP1]]
|
|
;
|
|
; ZVE32X-LABEL: define <vscale x 1 x i64> @vector_elt_type_legality(
|
|
; ZVE32X-SAME: ) #[[ATTR0]] {
|
|
; ZVE32X-NEXT: [[A:%.*]] = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 85, i64 8)
|
|
; ZVE32X-NEXT: [[B:%.*]] = bitcast <vscale x 8 x i8> [[A]] to <vscale x 1 x i64>
|
|
; ZVE32X-NEXT: ret <vscale x 1 x i64> [[B]]
|
|
;
|
|
%a = call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8(<vscale x 8 x i8> poison, i8 85, i64 8)
|
|
%b = bitcast <vscale x 8 x i8> %a to <vscale x 1 x i64>
|
|
ret <vscale x 1 x i64> %b
|
|
}
|
|
|
|
define <vscale x 4 x float> @eq_num_elts() {
|
|
; CHECK-LABEL: define <vscale x 4 x float> @eq_num_elts(
|
|
; CHECK-SAME: ) #[[ATTR0]] {
|
|
; CHECK-NEXT: [[A:%.*]] = call <vscale x 4 x i32> @llvm.riscv.vmv.v.x.nxv4i32.i64(<vscale x 4 x i32> poison, i32 -1615569626, i64 2)
|
|
; CHECK-NEXT: [[B:%.*]] = bitcast <vscale x 4 x i32> [[A]] to <vscale x 4 x float>
|
|
; CHECK-NEXT: ret <vscale x 4 x float> [[B]]
|
|
;
|
|
%a = call <vscale x 4 x i32> @llvm.riscv.vmv.v.x.nxv4i32.i64(<vscale x 4 x i32> poison, i32 -1615569626, i64 2)
|
|
%b = bitcast <vscale x 4 x i32> %a to <vscale x 4 x float>
|
|
ret <vscale x 4 x float> %b
|
|
}
|