Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AArch64/sve-distinct-predicate-dst.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

206 lines
8.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc < %s | FileCheck %s
; RUN: llc -mattr=+disable-distinct-predicate-dst-reg < %s | FileCheck %s --check-prefix=DISABLE-HINT
target triple = "aarch64"
;
; Test that the destination register of the match/cmp instruction is different
; from the governing predicate register.
;
define void @match_hint_distinct_pg_b(ptr %ptr, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
; CHECK-LABEL: match_hint_distinct_pg_b:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b
; CHECK-NEXT: match p1.b, p0/z, z0.b, z1.b
; CHECK-NEXT: st1b { z0.b }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: match_hint_distinct_pg_b:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.b
; DISABLE-HINT-NEXT: match p0.b, p0/z, z0.b, z1.b
; DISABLE-HINT-NEXT: st1b { z0.b }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%match = tail call <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1> splat (i1 true), <vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
call void @llvm.masked.store(<vscale x 16 x i8> %a, ptr %ptr, <vscale x 16 x i1> %match)
ret void
}
define void @match_hint_distinct_pg_h(ptr %ptr, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
; CHECK-LABEL: match_hint_distinct_pg_h:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.h
; CHECK-NEXT: match p1.h, p0/z, z0.h, z1.h
; CHECK-NEXT: st1h { z0.h }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: match_hint_distinct_pg_h:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.h
; DISABLE-HINT-NEXT: match p0.h, p0/z, z0.h, z1.h
; DISABLE-HINT-NEXT: st1h { z0.h }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%match = tail call <vscale x 8 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 8 x i1> splat (i1 true), <vscale x 8 x i16> %a, <vscale x 8 x i16> %b)
call void @llvm.masked.store(<vscale x 8 x i16> %a, ptr %ptr, <vscale x 8 x i1> %match)
ret void
}
define void @cmp_hint_distinct_pg_b(ptr %ptr, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
; CHECK-LABEL: cmp_hint_distinct_pg_b:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b
; CHECK-NEXT: cmpeq p1.b, p0/z, z0.b, z1.b
; CHECK-NEXT: st1b { z0.b }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: cmp_hint_distinct_pg_b:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.b
; DISABLE-HINT-NEXT: cmpeq p0.b, p0/z, z0.b, z1.b
; DISABLE-HINT-NEXT: st1b { z0.b }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%cmp = icmp eq <vscale x 16 x i8> %a, %b
call void @llvm.masked.store(<vscale x 16 x i8> %a, ptr %ptr, <vscale x 16 x i1> %cmp)
ret void
}
define void @cmp_hint_distinct_pg_h(ptr %ptr, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
; CHECK-LABEL: cmp_hint_distinct_pg_h:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.h
; CHECK-NEXT: cmpeq p1.h, p0/z, z0.h, z1.h
; CHECK-NEXT: st1h { z0.h }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: cmp_hint_distinct_pg_h:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.h
; DISABLE-HINT-NEXT: cmpeq p0.h, p0/z, z0.h, z1.h
; DISABLE-HINT-NEXT: st1h { z0.h }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%cmp = icmp eq <vscale x 8 x i16> %a, %b
call void @llvm.masked.store(<vscale x 8 x i16> %a, ptr %ptr, <vscale x 8 x i1> %cmp)
ret void
}
define void @cmp_hint_distinct_pg_s(ptr %ptr, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
; CHECK-LABEL: cmp_hint_distinct_pg_s:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.s
; CHECK-NEXT: cmpeq p1.s, p0/z, z0.s, z1.s
; CHECK-NEXT: st1w { z0.s }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: cmp_hint_distinct_pg_s:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.s
; DISABLE-HINT-NEXT: cmpeq p0.s, p0/z, z0.s, z1.s
; DISABLE-HINT-NEXT: st1w { z0.s }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%cmp = icmp eq <vscale x 4 x i32> %a, %b
call void @llvm.masked.store(<vscale x 4 x i32> %a, ptr %ptr, <vscale x 4 x i1> %cmp)
ret void
}
define void @cmp_hint_distinct_pg_d(ptr %ptr, <vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
; CHECK-LABEL: cmp_hint_distinct_pg_d:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.d
; CHECK-NEXT: cmpeq p1.d, p0/z, z0.d, z1.d
; CHECK-NEXT: st1d { z0.d }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: cmp_hint_distinct_pg_d:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.d
; DISABLE-HINT-NEXT: cmpeq p0.d, p0/z, z0.d, z1.d
; DISABLE-HINT-NEXT: st1d { z0.d }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%cmp = icmp eq <vscale x 2 x i64> %a, %b
call void @llvm.masked.store(<vscale x 2 x i64> %a, ptr %ptr, <vscale x 2 x i1> %cmp)
ret void
}
;
; Also test a case for the wide-element and immediate variants of CMP<>
;
define void @wide_cmp_hint_distinct_pg_b(ptr %ptr, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 2 x i64> %b) #0 {
; CHECK-LABEL: wide_cmp_hint_distinct_pg_b:
; CHECK: // %bb.0:
; CHECK-NEXT: cmpeq p1.b, p0/z, z0.b, z1.d
; CHECK-NEXT: st1b { z0.b }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: wide_cmp_hint_distinct_pg_b:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: cmpeq p0.b, p0/z, z0.b, z1.d
; DISABLE-HINT-NEXT: st1b { z0.b }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%cmp = call <vscale x 16 x i1> @llvm.aarch64.sve.cmpeq.wide.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 2 x i64> %b)
call void @llvm.masked.store(<vscale x 16 x i8> %a, ptr %ptr, <vscale x 16 x i1> %cmp)
ret void
}
define void @imm_cmp_hint_distinct_pg_b(ptr %ptr, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %a) #0 {
; CHECK-LABEL: imm_cmp_hint_distinct_pg_b:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b
; CHECK-NEXT: cmpeq p1.b, p0/z, z0.b, #12
; CHECK-NEXT: st1b { z0.b }, p1, [x0]
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: imm_cmp_hint_distinct_pg_b:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.b
; DISABLE-HINT-NEXT: cmpeq p0.b, p0/z, z0.b, #12
; DISABLE-HINT-NEXT: st1b { z0.b }, p0, [x0]
; DISABLE-HINT-NEXT: ret
%cmp = icmp eq <vscale x 16 x i8> %a, splat(i8 12)
call void @llvm.masked.store(<vscale x 16 x i8> %a, ptr %ptr, <vscale x 16 x i1> %cmp)
ret void
}
;
; Some negative tests.
;
; Test that no different register is selected if that would introduce a mov.
define <vscale x 16 x i1> @match_hint_dont_cause_extra_mov(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
; CHECK-LABEL: match_hint_dont_cause_extra_mov:
; CHECK: // %bb.0:
; CHECK-NEXT: match p0.b, p0/z, z0.b, z1.b
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: match_hint_dont_cause_extra_mov:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: match p0.b, p0/z, z0.b, z1.b
; DISABLE-HINT-NEXT: ret
%match = tail call <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
ret <vscale x 16 x i1> %match
}
; This is a case that is not yet supported, because at the point of constructing
; the hint for 'match' the all-true predicate is not yet allocated, so it can't
; choose a distinct register yet. This case could be support by looking through
; uses of the ptrue, but that may not be worth it because the ptrue is likely to
; have more than one use and this seems like an artificial case.
define <vscale x 16 x i1> @unsupported_because_ptrue_not_yet_allocated(ptr %ptr, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
; CHECK-LABEL: unsupported_because_ptrue_not_yet_allocated:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b
; CHECK-NEXT: match p0.b, p0/z, z0.b, z1.b
; CHECK-NEXT: ret
;
; DISABLE-HINT-LABEL: unsupported_because_ptrue_not_yet_allocated:
; DISABLE-HINT: // %bb.0:
; DISABLE-HINT-NEXT: ptrue p0.b
; DISABLE-HINT-NEXT: match p0.b, p0/z, z0.b, z1.b
; DISABLE-HINT-NEXT: ret
%match = tail call <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1> splat (i1 true), <vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
ret <vscale x 16 x i1> %match
}
attributes #0 = { "target-features"="+sve2" }