72 lines
3.7 KiB
LLVM
72 lines
3.7 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -passes=sandbox-vectorizer -sbvec-vec-reg-bits=1024 -sbvec-passes="regions-from-metadata<pack-reuse>" %s -S | FileCheck %s
|
|
|
|
define void @pack_reuse(i8 %v0, i8 %v1, ptr %ptr) {
|
|
; CHECK-LABEL: define void @pack_reuse(
|
|
; CHECK-SAME: i8 [[V0:%.*]], i8 [[V1:%.*]], ptr [[PTR:%.*]]) {
|
|
; CHECK-NEXT: [[PACKA0:%.*]] = insertelement <2 x i8> poison, i8 [[V0]], i64 0, !sandboxvec [[META0:![0-9]+]]
|
|
; CHECK-NEXT: [[PACKA1:%.*]] = insertelement <2 x i8> [[PACKA0]], i8 [[V1]], i64 1, !sandboxvec [[META0]]
|
|
; CHECK-NEXT: store <2 x i8> [[PACKA1]], ptr [[PTR]], align 2, !sandboxvec [[META0]]
|
|
; CHECK-NEXT: store <2 x i8> [[PACKA1]], ptr [[PTR]], align 2, !sandboxvec [[META0]]
|
|
; CHECK-NEXT: [[PACKC0:%.*]] = insertelement <2 x i8> poison, i8 [[V1]], i64 0, !sandboxvec [[META0]]
|
|
; CHECK-NEXT: [[PACKC1:%.*]] = insertelement <2 x i8> [[PACKC0]], i8 [[V0]], i64 1, !sandboxvec [[META0]]
|
|
; CHECK-NEXT: store <2 x i8> [[PACKC1]], ptr [[PTR]], align 2, !sandboxvec [[META0]]
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
%PackA0 = insertelement <2 x i8> poison, i8 %v0, i64 0, !sandboxvec !0
|
|
%PackA1 = insertelement <2 x i8> %PackA0, i8 %v1, i64 1, !sandboxvec !0
|
|
store <2 x i8> %PackA1, ptr %ptr, !sandboxvec !0
|
|
|
|
; Should reuse PackA1.
|
|
%PackB0 = insertelement <2 x i8> poison, i8 %v0, i64 0, !sandboxvec !0
|
|
%PackB1 = insertelement <2 x i8> %PackB0, i8 %v1, i64 1, !sandboxvec !0
|
|
store <2 x i8> %PackB1, ptr %ptr, !sandboxvec !0
|
|
|
|
; Should remain.
|
|
%PackC0 = insertelement <2 x i8> poison, i8 %v1, i64 0, !sandboxvec !0
|
|
%PackC1 = insertelement <2 x i8> %PackC0, i8 %v0, i64 1, !sandboxvec !0
|
|
store <2 x i8> %PackC1, ptr %ptr, !sandboxvec !0
|
|
ret void
|
|
}
|
|
|
|
; TODO: For now we don't support reusing packs from earlier BBs.
|
|
define void @pack_cross_bb(i8 %v0, i8 %v1, ptr %ptr) {
|
|
; CHECK-LABEL: define void @pack_cross_bb(
|
|
; CHECK-SAME: i8 [[V0:%.*]], i8 [[V1:%.*]], ptr [[PTR:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[PACKA0:%.*]] = insertelement <2 x i8> poison, i8 [[V0]], i64 0, !sandboxvec [[META1:![0-9]+]]
|
|
; CHECK-NEXT: [[PACKA1:%.*]] = insertelement <2 x i8> [[PACKA0]], i8 [[V1]], i64 1, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: store <2 x i8> [[PACKA1]], ptr [[PTR]], align 2, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: br label %[[BB:.*]]
|
|
; CHECK: [[BB]]:
|
|
; CHECK-NEXT: [[PACKB0:%.*]] = insertelement <2 x i8> poison, i8 [[V0]], i64 0, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: [[PACKB1:%.*]] = insertelement <2 x i8> [[PACKB0]], i8 [[V1]], i64 1, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: store <2 x i8> [[PACKB1]], ptr [[PTR]], align 2, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: [[PACKC0:%.*]] = insertelement <2 x i8> poison, i8 [[V1]], i64 0, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: [[PACKC1:%.*]] = insertelement <2 x i8> [[PACKC0]], i8 [[V0]], i64 1, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: store <2 x i8> [[PACKC1]], ptr [[PTR]], align 2, !sandboxvec [[META1]]
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%PackA0 = insertelement <2 x i8> poison, i8 %v0, i64 0, !sandboxvec !0
|
|
%PackA1 = insertelement <2 x i8> %PackA0, i8 %v1, i64 1, !sandboxvec !0
|
|
store <2 x i8> %PackA1, ptr %ptr, !sandboxvec !0
|
|
br label %bb
|
|
|
|
bb:
|
|
%PackB0 = insertelement <2 x i8> poison, i8 %v0, i64 0, !sandboxvec !0
|
|
%PackB1 = insertelement <2 x i8> %PackB0, i8 %v1, i64 1, !sandboxvec !0
|
|
store <2 x i8> %PackB1, ptr %ptr, !sandboxvec !0
|
|
|
|
%PackC0 = insertelement <2 x i8> poison, i8 %v1, i64 0, !sandboxvec !0
|
|
%PackC1 = insertelement <2 x i8> %PackC0, i8 %v0, i64 1, !sandboxvec !0
|
|
store <2 x i8> %PackC1, ptr %ptr, !sandboxvec !0
|
|
ret void
|
|
}
|
|
|
|
!0 = distinct !{!"sandboxregion"}
|
|
;.
|
|
; CHECK: [[META0]] = distinct !{!"sandboxregion"}
|
|
; CHECK: [[META1]] = distinct !{!"sandboxregion"}
|
|
;.
|