-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AARCH64] Enable STORE of v4i8 to help more vectorization opportunities
For the attached test case, currently llvm generates instructions to load/or/store the bytes one by one. Although NEON doesn't support v4i8 natively, we can promote it to v4i16 and operate on v4i16 vectors. So this patch override getStoreMinimumVF and specify the minimum VF for i8 vector is v4i8. Differential Revision: https://reviews.llvm.org/D145614
- Loading branch information
Showing
3 changed files
with
116 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 | ||
; RUN: opt -passes=slp-vectorizer -S < %s | FileCheck %s | ||
|
||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | ||
target triple = "aarch64-unknown-linux-gnu" | ||
|
||
%S = type { i8, i8, i8, i8 } | ||
|
||
define ptr @foo(ptr %this, ptr %rhs) { | ||
; CHECK-LABEL: define ptr @foo | ||
; CHECK-SAME: (ptr [[THIS:%.*]], ptr [[RHS:%.*]]) { | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i8>, ptr [[RHS]], align 1, !tbaa [[TBAA0:![0-9]+]] | ||
; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i8>, ptr [[THIS]], align 1, !tbaa [[TBAA0]] | ||
; CHECK-NEXT: [[TMP2:%.*]] = or <4 x i8> [[TMP0]], [[TMP1]] | ||
; CHECK-NEXT: store <4 x i8> [[TMP2]], ptr [[THIS]], align 1, !tbaa [[TBAA0]] | ||
; CHECK-NEXT: ret ptr [[THIS]] | ||
; | ||
entry: | ||
%right1 = load i8, ptr %rhs, align 1, !tbaa !6, !range !11, !noundef !12 | ||
%left1 = load i8, ptr %this, align 1, !tbaa !6, !range !11, !noundef !12 | ||
%res1 = or i8 %right1, %left1 | ||
store i8 %res1, ptr %this, align 1, !tbaa !6 | ||
%b = getelementptr inbounds %S, ptr %rhs, i64 0, i32 1 | ||
%right2 = load i8, ptr %b, align 1, !tbaa !13, !range !11, !noundef !12 | ||
%b8 = getelementptr inbounds %S, ptr %this, i64 0, i32 1 | ||
%left2 = load i8, ptr %b8, align 1, !tbaa !13, !range !11, !noundef !12 | ||
%res2 = or i8 %right2, %left2 | ||
store i8 %res2, ptr %b8, align 1, !tbaa !13 | ||
%c = getelementptr inbounds %S, ptr %rhs, i64 0, i32 2 | ||
%right3 = load i8, ptr %c, align 1, !tbaa !14, !range !11, !noundef !12 | ||
%c16 = getelementptr inbounds %S, ptr %this, i64 0, i32 2 | ||
%left3 = load i8, ptr %c16, align 1, !tbaa !14, !range !11, !noundef !12 | ||
%res3 = or i8 %right3, %left3 | ||
store i8 %res3, ptr %c16, align 1, !tbaa !14 | ||
%d = getelementptr inbounds %S, ptr %rhs, i64 0, i32 3 | ||
%right4 = load i8, ptr %d, align 1, !tbaa !15, !range !11, !noundef !12 | ||
%d24 = getelementptr inbounds %S, ptr %this, i64 0, i32 3 | ||
%left4 = load i8, ptr %d24, align 1, !tbaa !15, !range !11, !noundef !12 | ||
%res4 = or i8 %right4, %left4 | ||
store i8 %res4, ptr %d24, align 1, !tbaa !15 | ||
ret ptr %this | ||
} | ||
|
||
|
||
!6 = !{!7, !8, i64 0} | ||
!7 = !{!"S", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3} | ||
!8 = !{!"bool", !9, i64 0} | ||
!9 = !{!"omnipotent char", !10, i64 0} | ||
!10 = !{!"Simple C++ TBAA"} | ||
!11 = !{i8 0, i8 2} | ||
!12 = !{} | ||
!13 = !{!7, !8, i64 1} | ||
!14 = !{!7, !8, i64 2} | ||
!15 = !{!7, !8, i64 3} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters