Skip to content

Commit 75d1625

Browse files
committed
clang-format; add lit.local.cfg; regenerate checks
1 parent 8f8e444 commit 75d1625

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,9 +2018,10 @@ bool VectorCombine::scalarizeExtExtract(Instruction &I) {
20182018
auto *Extract = cast<ExtractElementInst>(U);
20192019
uint64_t Idx =
20202020
cast<ConstantInt>(Extract->getIndexOperand())->getZExtValue();
2021-
uint64_t ShiftAmt = DL->isBigEndian()
2022-
? (TotalBits - SrcEltSizeInBits - Idx * SrcEltSizeInBits)
2023-
: (Idx * SrcEltSizeInBits);
2021+
uint64_t ShiftAmt =
2022+
DL->isBigEndian()
2023+
? (TotalBits - SrcEltSizeInBits - Idx * SrcEltSizeInBits)
2024+
: (Idx * SrcEltSizeInBits);
20242025
Value *LShr = Builder.CreateLShr(ScalarV, ShiftAmt);
20252026
Value *And = Builder.CreateAnd(LShr, Mask);
20262027
U->replaceAllUsesWith(And);
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
; RUN: opt -passes='vector-combine,dce' -S -mtriple=aarch64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=LE
23
; RUN: opt -passes='vector-combine,dce' -S -mtriple=aarch64_be-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=BE
34

45
define i64 @g(<8 x i8> %v) {
6+
; LE-LABEL: @g(
7+
; LE-NEXT: [[TMP1:%.*]] = freeze <8 x i8> [[V:%.*]]
8+
; LE-NEXT: [[TMP2:%.*]] = bitcast <8 x i8> [[TMP1]] to i64
9+
; LE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 56
10+
; LE-NEXT: [[TMP4:%.*]] = and i64 [[TMP2]], 255
11+
; LE-NEXT: [[SUM:%.*]] = add i64 [[TMP4]], [[TMP3]]
12+
; LE-NEXT: ret i64 [[SUM]]
13+
;
14+
; BE-LABEL: @g(
15+
; BE-NEXT: [[TMP1:%.*]] = freeze <8 x i8> [[V:%.*]]
16+
; BE-NEXT: [[TMP2:%.*]] = bitcast <8 x i8> [[TMP1]] to i64
17+
; BE-NEXT: [[TMP3:%.*]] = and i64 [[TMP2]], 255
18+
; BE-NEXT: [[TMP4:%.*]] = lshr i64 [[TMP2]], 56
19+
; BE-NEXT: [[SUM:%.*]] = add i64 [[TMP4]], [[TMP3]]
20+
; BE-NEXT: ret i64 [[SUM]]
21+
;
522
%z = zext <8 x i8> %v to <8 x i64>
623
%e0 = extractelement <8 x i64> %z, i32 0
724
%e7 = extractelement <8 x i64> %z, i32 7
825
%sum = add i64 %e0, %e7
926
ret i64 %sum
1027
}
1128

12-
; LE-LABEL: @g(
13-
; LE: bitcast <8 x i8> %{{.*}} to i64
14-
; LE: lshr i64 %{{.*}}, 56
15-
; LE: and i64 %{{.*}}, 255
16-
; LE-NOT: extractelement
1729

18-
; BE-LABEL: @g(
19-
; BE: bitcast <8 x i8> %{{.*}} to i64
20-
; BE: and i64 %{{.*}}, 255
21-
; BE: lshr i64 %{{.*}}, 56
22-
; BE-NOT: extractelement
2330

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if 'PowerPC' not in config.root.targets:
2+
config.unsupported = True
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
; RUN: opt -passes='vector-combine,dce' -S -mtriple=aarch64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=LE
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt -passes='vector-combine,dce' -S -mtriple=powerpc64-ibm-aix-xcoff %s -o - | FileCheck %s --check-prefix=BE
33

44
define i64 @g(<8 x i8> %v) {
5+
; BE-LABEL: @g(
6+
; BE-NEXT: [[TMP1:%.*]] = freeze <8 x i8> [[V:%.*]]
7+
; BE-NEXT: [[TMP2:%.*]] = bitcast <8 x i8> [[TMP1]] to i64
8+
; BE-NEXT: [[TMP3:%.*]] = and i64 [[TMP2]], 255
9+
; BE-NEXT: [[TMP4:%.*]] = lshr i64 [[TMP2]], 56
10+
; BE-NEXT: [[SUM:%.*]] = add i64 [[TMP4]], [[TMP3]]
11+
; BE-NEXT: ret i64 [[SUM]]
12+
;
513
%z = zext <8 x i8> %v to <8 x i64>
614
%e0 = extractelement <8 x i64> %z, i32 0
715
%e7 = extractelement <8 x i64> %z, i32 7
816
%sum = add i64 %e0, %e7
917
ret i64 %sum
1018
}
1119

12-
; LE-LABEL: @g(
13-
; LE: bitcast <8 x i8> %{{.*}} to i64
14-
; LE: lshr i64 %{{.*}}, 56
15-
; LE: and i64 %{{.*}}, 255
16-
; LE-NOT: extractelement
17-
18-
; BE-LABEL: @g(
19-
; BE: bitcast <8 x i8> %{{.*}} to i64
20-
; BE: and i64 %{{.*}}, 255
21-
; BE: lshr i64 %{{.*}}, 56
22-
; BE-NOT: extractelement
23-

0 commit comments

Comments
 (0)