The target hook prefersVectorizedAddressing() already exists to check with target if address computations should be vectorized, so it seems like this should be used in SLPVectorizer as well. Reviewed By: ABataev, RKSimon Differential Revision: https://reviews.llvm.org/D144128
49 lines
2.3 KiB
LLVM
49 lines
2.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z15 -passes=slp-vectorizer %s -S -o - \
|
|
; RUN: | FileCheck %s
|
|
;
|
|
; Test that gep indices are not first vectorized and then extracted (into address registers).
|
|
|
|
%StructTy = type { i8, i64, i64, i64, i64 }
|
|
declare void @bar(ptr, ptr)
|
|
|
|
define void @fun(ptr %Addr) {
|
|
; CHECK-LABEL: @fun(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
|
; CHECK: for.cond:
|
|
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_COND]] ], [ 0, [[ENTRY:%.*]] ]
|
|
; CHECK-NEXT: [[P2472:%.*]] = getelementptr inbounds [[STRUCTTY:%.*]], ptr [[ADDR:%.*]], i64 [[INDVARS_IV]], i32 3
|
|
; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[P2472]], align 8
|
|
; CHECK-NEXT: [[P3476:%.*]] = getelementptr inbounds [[STRUCTTY]], ptr [[ADDR]], i64 [[INDVARS_IV]], i32 4
|
|
; CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr [[P3476]], align 8
|
|
; CHECK-NEXT: [[SEXT:%.*]] = shl i64 [[TMP0]], 32
|
|
; CHECK-NEXT: [[IDXPROM495:%.*]] = ashr exact i64 [[SEXT]], 32
|
|
; CHECK-NEXT: [[ARRAYIDX496:%.*]] = getelementptr inbounds [3 x float], ptr null, i64 [[IDXPROM495]]
|
|
; CHECK-NEXT: [[SEXT4:%.*]] = shl i64 [[TMP1]], 32
|
|
; CHECK-NEXT: [[IDXPROM499:%.*]] = ashr exact i64 [[SEXT4]], 32
|
|
; CHECK-NEXT: [[ARRAYIDX500:%.*]] = getelementptr inbounds [3 x float], ptr null, i64 [[IDXPROM499]]
|
|
; CHECK-NEXT: tail call void @bar(ptr noundef poison, ptr noundef [[ARRAYIDX500]])
|
|
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], 1
|
|
; CHECK-NEXT: br label [[FOR_COND]]
|
|
;
|
|
entry:
|
|
br label %for.cond
|
|
|
|
for.cond:
|
|
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
|
|
%P2472 = getelementptr inbounds %StructTy, ptr %Addr, i64 %indvars.iv, i32 3
|
|
%0 = load i64, ptr %P2472, align 8
|
|
%P3476 = getelementptr inbounds %StructTy, ptr %Addr, i64 %indvars.iv, i32 4
|
|
%1 = load i64, ptr %P3476, align 8
|
|
%sext = shl i64 %0, 32
|
|
%idxprom495 = ashr exact i64 %sext, 32
|
|
%arrayidx496 = getelementptr inbounds [3 x float], ptr null, i64 %idxprom495
|
|
%sext4 = shl i64 %1, 32
|
|
%idxprom499 = ashr exact i64 %sext4, 32
|
|
%arrayidx500 = getelementptr inbounds [3 x float], ptr null, i64 %idxprom499
|
|
tail call void @bar(ptr noundef poison, ptr noundef %arrayidx500)
|
|
%indvars.iv.next = add i64 %indvars.iv, 1
|
|
br label %for.cond
|
|
}
|