Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AArch64/vec-combine-trunc-dup-ext.ll
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

242 lines
8.9 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-SD
; RUN: llc -mtriple=aarch64 -global-isel < %s | FileCheck %s --check-prefixes=CHECK,CHECK-GI
define <4 x i32> @dup_trunc_sext_v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> %x, <4 x i32> %y) {
; CHECK-SD-LABEL: dup_trunc_sext_v4i32:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: cmgt v0.4s, v1.4s, v0.4s
; CHECK-SD-NEXT: dup v0.4s, v0.s[2]
; CHECK-SD-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_sext_v4i32:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: cmgt v0.4s, v1.4s, v0.4s
; CHECK-GI-NEXT: mov w8, v0.s[1]
; CHECK-GI-NEXT: mov w9, v0.s[2]
; CHECK-GI-NEXT: mov w10, v0.s[3]
; CHECK-GI-NEXT: mov v0.b[1], w8
; CHECK-GI-NEXT: mov v0.b[2], w9
; CHECK-GI-NEXT: mov v0.b[3], w10
; CHECK-GI-NEXT: dup v0.8b, v0.b[2]
; CHECK-GI-NEXT: umov w8, v0.b[0]
; CHECK-GI-NEXT: umov w9, v0.b[1]
; CHECK-GI-NEXT: fmov s1, w8
; CHECK-GI-NEXT: umov w8, v0.b[2]
; CHECK-GI-NEXT: mov v1.s[1], w9
; CHECK-GI-NEXT: umov w9, v0.b[3]
; CHECK-GI-NEXT: mov v1.s[2], w8
; CHECK-GI-NEXT: mov v1.s[3], w9
; CHECK-GI-NEXT: shl v0.4s, v1.4s, #31
; CHECK-GI-NEXT: cmlt v0.4s, v0.4s, #0
; CHECK-GI-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-GI-NEXT: ret
%cmp = icmp slt <4 x i32> %a, %b
%splat = shufflevector <4 x i1> %cmp, <4 x i1> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
%sel = select <4 x i1> %splat, <4 x i32> %x, <4 x i32> %y
ret <4 x i32> %sel
}
define <2 x i64> @dup_trunc_sext_v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %x, <2 x i64> %y) {
; CHECK-SD-LABEL: dup_trunc_sext_v2i64:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: cmgt v0.2d, v1.2d, v0.2d
; CHECK-SD-NEXT: dup v0.2d, v0.d[0]
; CHECK-SD-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_sext_v2i64:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: cmgt v0.2d, v1.2d, v0.2d
; CHECK-GI-NEXT: fmov x9, d0
; CHECK-GI-NEXT: mov x8, v0.d[1]
; CHECK-GI-NEXT: fmov s0, w9
; CHECK-GI-NEXT: mov v0.b[1], w8
; CHECK-GI-NEXT: dup v0.8b, v0.b[0]
; CHECK-GI-NEXT: umov w8, v0.b[0]
; CHECK-GI-NEXT: umov w9, v0.b[1]
; CHECK-GI-NEXT: fmov d0, x8
; CHECK-GI-NEXT: mov v0.d[1], x9
; CHECK-GI-NEXT: shl v0.2d, v0.2d, #63
; CHECK-GI-NEXT: cmlt v0.2d, v0.2d, #0
; CHECK-GI-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-GI-NEXT: ret
%cmp = icmp slt <2 x i64> %a, %b
%splat = shufflevector <2 x i1> %cmp, <2 x i1> poison, <2 x i32> <i32 0, i32 0>
%sel = select <2 x i1> %splat, <2 x i64> %x, <2 x i64> %y
ret <2 x i64> %sel
}
define <4 x float> @dup_trunc_sext_v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %x, <4 x float> %y) {
; CHECK-SD-LABEL: dup_trunc_sext_v4f32:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: fcmge v0.4s, v1.4s, v0.4s
; CHECK-SD-NEXT: dup v0.4s, v0.s[3]
; CHECK-SD-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_sext_v4f32:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: fcmge v0.4s, v1.4s, v0.4s
; CHECK-GI-NEXT: mov w8, v0.s[1]
; CHECK-GI-NEXT: mov w9, v0.s[2]
; CHECK-GI-NEXT: mov w10, v0.s[3]
; CHECK-GI-NEXT: mov v0.b[1], w8
; CHECK-GI-NEXT: mov v0.b[2], w9
; CHECK-GI-NEXT: mov v0.b[3], w10
; CHECK-GI-NEXT: dup v0.8b, v0.b[3]
; CHECK-GI-NEXT: umov w8, v0.b[0]
; CHECK-GI-NEXT: umov w9, v0.b[1]
; CHECK-GI-NEXT: fmov s1, w8
; CHECK-GI-NEXT: umov w8, v0.b[2]
; CHECK-GI-NEXT: mov v1.s[1], w9
; CHECK-GI-NEXT: umov w9, v0.b[3]
; CHECK-GI-NEXT: mov v1.s[2], w8
; CHECK-GI-NEXT: mov v1.s[3], w9
; CHECK-GI-NEXT: shl v0.4s, v1.4s, #31
; CHECK-GI-NEXT: cmlt v0.4s, v0.4s, #0
; CHECK-GI-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-GI-NEXT: ret
%cmp = fcmp ole <4 x float> %a, %b
%splat = shufflevector <4 x i1> %cmp, <4 x i1> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
%sel = select <4 x i1> %splat, <4 x float> %x, <4 x float> %y
ret <4 x float> %sel
}
define <2 x double> @dup_trunc_sext_v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %x, <2 x double> %y) {
; CHECK-SD-LABEL: dup_trunc_sext_v2f64:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: fcmge v0.2d, v1.2d, v0.2d
; CHECK-SD-NEXT: dup v0.2d, v0.d[1]
; CHECK-SD-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_sext_v2f64:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: fcmge v0.2d, v1.2d, v0.2d
; CHECK-GI-NEXT: fmov x9, d0
; CHECK-GI-NEXT: mov x8, v0.d[1]
; CHECK-GI-NEXT: fmov s0, w9
; CHECK-GI-NEXT: mov v0.b[1], w8
; CHECK-GI-NEXT: dup v0.8b, v0.b[1]
; CHECK-GI-NEXT: umov w8, v0.b[0]
; CHECK-GI-NEXT: umov w9, v0.b[1]
; CHECK-GI-NEXT: fmov d0, x8
; CHECK-GI-NEXT: mov v0.d[1], x9
; CHECK-GI-NEXT: shl v0.2d, v0.2d, #63
; CHECK-GI-NEXT: cmlt v0.2d, v0.2d, #0
; CHECK-GI-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-GI-NEXT: ret
%cmp = fcmp ole <2 x double> %a, %b
%splat = shufflevector <2 x i1> %cmp, <2 x i1> poison, <2 x i32> <i32 1, i32 1>
%sel = select <2 x i1> %splat, <2 x double> %x, <2 x double> %y
ret <2 x double> %sel
}
define <4 x i32> @dup_trunc_sext_v4i32_idx0(<4 x i32> %a, <4 x i32> %b, <4 x i32> %x, <4 x i32> %y) {
; CHECK-SD-LABEL: dup_trunc_sext_v4i32_idx0:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: cmgt v0.4s, v1.4s, v0.4s
; CHECK-SD-NEXT: dup v0.4s, v0.s[0]
; CHECK-SD-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_sext_v4i32_idx0:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: cmgt v0.4s, v1.4s, v0.4s
; CHECK-GI-NEXT: mov w8, v0.s[1]
; CHECK-GI-NEXT: mov w9, v0.s[2]
; CHECK-GI-NEXT: mov w10, v0.s[3]
; CHECK-GI-NEXT: mov v0.b[1], w8
; CHECK-GI-NEXT: mov v0.b[2], w9
; CHECK-GI-NEXT: mov v0.b[3], w10
; CHECK-GI-NEXT: dup v0.8b, v0.b[0]
; CHECK-GI-NEXT: umov w8, v0.b[0]
; CHECK-GI-NEXT: umov w9, v0.b[1]
; CHECK-GI-NEXT: fmov s1, w8
; CHECK-GI-NEXT: umov w8, v0.b[2]
; CHECK-GI-NEXT: mov v1.s[1], w9
; CHECK-GI-NEXT: umov w9, v0.b[3]
; CHECK-GI-NEXT: mov v1.s[2], w8
; CHECK-GI-NEXT: mov v1.s[3], w9
; CHECK-GI-NEXT: shl v0.4s, v1.4s, #31
; CHECK-GI-NEXT: cmlt v0.4s, v0.4s, #0
; CHECK-GI-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-GI-NEXT: ret
%cmp = icmp slt <4 x i32> %a, %b
%splat = shufflevector <4 x i1> %cmp, <4 x i1> poison, <4 x i32> zeroinitializer
%sel = select <4 x i1> %splat, <4 x i32> %x, <4 x i32> %y
ret <4 x i32> %sel
}
define <8 x i16> @dup_trunc_sext_v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> %x, <8 x i16> %y) {
; CHECK-SD-LABEL: dup_trunc_sext_v8i16:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: cmgt v0.8h, v1.8h, v0.8h
; CHECK-SD-NEXT: dup v0.8h, v0.h[2]
; CHECK-SD-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_sext_v8i16:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: cmgt v0.8h, v1.8h, v0.8h
; CHECK-GI-NEXT: xtn v0.8b, v0.8h
; CHECK-GI-NEXT: dup v0.8b, v0.b[2]
; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
; CHECK-GI-NEXT: shl v0.8h, v0.8h, #15
; CHECK-GI-NEXT: cmlt v0.8h, v0.8h, #0
; CHECK-GI-NEXT: bsl v0.16b, v2.16b, v3.16b
; CHECK-GI-NEXT: ret
%cmp = icmp slt <8 x i16> %a, %b
%splat = shufflevector <8 x i1> %cmp, <8 x i1> poison, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
%sel = select <8 x i1> %splat, <8 x i16> %x, <8 x i16> %y
ret <8 x i16> %sel
}
define <2 x i64> @negative_sext_i32(<2 x i64> %mask) {
; CHECK-LABEL: negative_sext_i32:
; CHECK: // %bb.0:
; CHECK-NEXT: xtn v0.2s, v0.2d
; CHECK-NEXT: dup v0.2s, v0.s[1]
; CHECK-NEXT: sshll v0.2d, v0.2s, #0
; CHECK-NEXT: ret
%trunc = trunc <2 x i64> %mask to <2 x i32>
%splat = shufflevector <2 x i32> %trunc, <2 x i32> poison, <2 x i32> <i32 1, i32 1>
%ext = sext <2 x i32> %splat to <2 x i64>
ret <2 x i64> %ext
}
define <2 x i64> @dup_trunc_zext_i32(<2 x i64> %a) {
; CHECK-SD-LABEL: dup_trunc_zext_i32:
; CHECK-SD: // %bb.0:
; CHECK-SD-NEXT: ushr v0.2d, v0.2d, #32
; CHECK-SD-NEXT: dup v0.2d, v0.d[1]
; CHECK-SD-NEXT: ret
;
; CHECK-GI-LABEL: dup_trunc_zext_i32:
; CHECK-GI: // %bb.0:
; CHECK-GI-NEXT: shrn v0.2s, v0.2d, #32
; CHECK-GI-NEXT: dup v0.2s, v0.s[1]
; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
; CHECK-GI-NEXT: ret
%shifted = lshr <2 x i64> %a, <i64 32, i64 32>
%trunc = trunc <2 x i64> %shifted to <2 x i32>
%splat = shufflevector <2 x i32> %trunc, <2 x i32> poison, <2 x i32> <i32 1, i32 1>
%ext = zext <2 x i32> %splat to <2 x i64>
ret <2 x i64> %ext
}
define <2 x i64> @negative_zext_i32(<2 x i64> %mask) {
; CHECK-LABEL: negative_zext_i32:
; CHECK: // %bb.0:
; CHECK-NEXT: xtn v0.2s, v0.2d
; CHECK-NEXT: dup v0.2s, v0.s[1]
; CHECK-NEXT: ushll v0.2d, v0.2s, #0
; CHECK-NEXT: ret
%trunc = trunc <2 x i64> %mask to <2 x i32>
%splat = shufflevector <2 x i32> %trunc, <2 x i32> poison, <2 x i32> <i32 1, i32 1>
%ext = zext <2 x i32> %splat to <2 x i64>
ret <2 x i64> %ext
}