diff --git a/test/Transforms/SLPVectorizer/AArch64/widen.ll b/test/Transforms/SLPVectorizer/AArch64/widen.ll new file mode 100644 index 00000000000..89a01b2fba3 --- /dev/null +++ b/test/Transforms/SLPVectorizer/AArch64/widen.ll @@ -0,0 +1,205 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -slp-vectorizer -S < %s | FileCheck %s + +target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" +target triple = "aarch64" + +; FIXME: +; This should not be matched as a load combining candidate. +; There are no 'or' operations, so it can't be a bswap or +; other pattern that we are expecting the backend to handle. + +define void @PR50256(i8* %a, i16* %b, i32 %n) { +; CHECK-LABEL: @PR50256( +; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds i8, i8* [[A:%.*]], i64 1 +; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 2 +; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 3 +; CHECK-NEXT: [[ARRAYIDX_4:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 4 +; CHECK-NEXT: [[ARRAYIDX_5:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 5 +; CHECK-NEXT: [[ARRAYIDX_7:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 7 +; CHECK-NEXT: [[ARRAYIDX_6:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 6 +; CHECK-NEXT: [[ARRAYIDX_8:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 8 +; CHECK-NEXT: [[ARRAYIDX_9:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 9 +; CHECK-NEXT: [[ARRAYIDX_10:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 10 +; CHECK-NEXT: [[ARRAYIDX_11:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 11 +; CHECK-NEXT: [[ARRAYIDX_12:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 12 +; CHECK-NEXT: [[ARRAYIDX_13:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 13 +; CHECK-NEXT: [[ARRAYIDX_14:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 14 +; CHECK-NEXT: [[ARRAYIDX_15:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 15 +; CHECK-NEXT: [[I:%.*]] = load i8, i8* [[A]], align 1 +; CHECK-NEXT: [[I1:%.*]] = load i8, i8* [[ARRAYIDX_1]], align 1 +; CHECK-NEXT: [[I2:%.*]] = load i8, i8* [[ARRAYIDX_2]], align 1 +; CHECK-NEXT: [[I3:%.*]] = load i8, i8* [[ARRAYIDX_3]], align 1 +; CHECK-NEXT: [[I4:%.*]] = load i8, i8* [[ARRAYIDX_4]], align 1 +; CHECK-NEXT: [[I5:%.*]] = load i8, i8* [[ARRAYIDX_5]], align 1 +; CHECK-NEXT: [[I6:%.*]] = load i8, i8* [[ARRAYIDX_6]], align 1 +; CHECK-NEXT: [[I7:%.*]] = load i8, i8* [[ARRAYIDX_7]], align 1 +; CHECK-NEXT: [[I8:%.*]] = load i8, i8* [[ARRAYIDX_8]], align 1 +; CHECK-NEXT: [[I9:%.*]] = load i8, i8* [[ARRAYIDX_9]], align 1 +; CHECK-NEXT: [[I10:%.*]] = load i8, i8* [[ARRAYIDX_10]], align 1 +; CHECK-NEXT: [[I11:%.*]] = load i8, i8* [[ARRAYIDX_11]], align 1 +; CHECK-NEXT: [[I12:%.*]] = load i8, i8* [[ARRAYIDX_12]], align 1 +; CHECK-NEXT: [[I13:%.*]] = load i8, i8* [[ARRAYIDX_13]], align 1 +; CHECK-NEXT: [[I14:%.*]] = load i8, i8* [[ARRAYIDX_14]], align 1 +; CHECK-NEXT: [[I15:%.*]] = load i8, i8* [[ARRAYIDX_15]], align 1 +; CHECK-NEXT: [[CONV5:%.*]] = zext i8 [[I]] to i16 +; CHECK-NEXT: [[CONV5_1:%.*]] = zext i8 [[I1]] to i16 +; CHECK-NEXT: [[CONV5_2:%.*]] = zext i8 [[I2]] to i16 +; CHECK-NEXT: [[CONV5_3:%.*]] = zext i8 [[I3]] to i16 +; CHECK-NEXT: [[CONV5_4:%.*]] = zext i8 [[I4]] to i16 +; CHECK-NEXT: [[CONV5_5:%.*]] = zext i8 [[I5]] to i16 +; CHECK-NEXT: [[CONV5_6:%.*]] = zext i8 [[I6]] to i16 +; CHECK-NEXT: [[CONV5_7:%.*]] = zext i8 [[I7]] to i16 +; CHECK-NEXT: [[CONV5_8:%.*]] = zext i8 [[I8]] to i16 +; CHECK-NEXT: [[CONV5_9:%.*]] = zext i8 [[I9]] to i16 +; CHECK-NEXT: [[CONV5_10:%.*]] = zext i8 [[I10]] to i16 +; CHECK-NEXT: [[CONV5_11:%.*]] = zext i8 [[I11]] to i16 +; CHECK-NEXT: [[CONV5_12:%.*]] = zext i8 [[I12]] to i16 +; CHECK-NEXT: [[CONV5_13:%.*]] = zext i8 [[I13]] to i16 +; CHECK-NEXT: [[CONV5_14:%.*]] = zext i8 [[I14]] to i16 +; CHECK-NEXT: [[CONV5_15:%.*]] = zext i8 [[I15]] to i16 +; CHECK-NEXT: [[SHL:%.*]] = shl nuw i16 [[CONV5]], 8 +; CHECK-NEXT: [[SHL_1:%.*]] = shl nuw i16 [[CONV5_1]], 8 +; CHECK-NEXT: [[SHL_2:%.*]] = shl nuw i16 [[CONV5_2]], 8 +; CHECK-NEXT: [[SHL_3:%.*]] = shl nuw i16 [[CONV5_3]], 8 +; CHECK-NEXT: [[SHL_4:%.*]] = shl nuw i16 [[CONV5_4]], 8 +; CHECK-NEXT: [[SHL_5:%.*]] = shl nuw i16 [[CONV5_5]], 8 +; CHECK-NEXT: [[SHL_6:%.*]] = shl nuw i16 [[CONV5_6]], 8 +; CHECK-NEXT: [[SHL_7:%.*]] = shl nuw i16 [[CONV5_7]], 8 +; CHECK-NEXT: [[SHL_8:%.*]] = shl nuw i16 [[CONV5_8]], 8 +; CHECK-NEXT: [[SHL_9:%.*]] = shl nuw i16 [[CONV5_9]], 8 +; CHECK-NEXT: [[SHL_10:%.*]] = shl nuw i16 [[CONV5_10]], 8 +; CHECK-NEXT: [[SHL_11:%.*]] = shl nuw i16 [[CONV5_11]], 8 +; CHECK-NEXT: [[SHL_12:%.*]] = shl nuw i16 [[CONV5_12]], 8 +; CHECK-NEXT: [[SHL_13:%.*]] = shl nuw i16 [[CONV5_13]], 8 +; CHECK-NEXT: [[SHL_14:%.*]] = shl nuw i16 [[CONV5_14]], 8 +; CHECK-NEXT: [[SHL_15:%.*]] = shl nuw i16 [[CONV5_15]], 8 +; CHECK-NEXT: [[ARRAYIDX3_1:%.*]] = getelementptr inbounds i16, i16* [[B:%.*]], i64 1 +; CHECK-NEXT: [[ARRAYIDX3_2:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 2 +; CHECK-NEXT: [[ARRAYIDX3_3:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 3 +; CHECK-NEXT: [[ARRAYIDX3_4:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 4 +; CHECK-NEXT: [[ARRAYIDX3_5:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 5 +; CHECK-NEXT: [[ARRAYIDX3_6:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 6 +; CHECK-NEXT: [[ARRAYIDX3_7:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 7 +; CHECK-NEXT: [[ARRAYIDX3_8:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 8 +; CHECK-NEXT: [[ARRAYIDX3_9:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 9 +; CHECK-NEXT: [[ARRAYIDX3_10:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 10 +; CHECK-NEXT: [[ARRAYIDX3_11:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 11 +; CHECK-NEXT: [[ARRAYIDX3_12:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 12 +; CHECK-NEXT: [[ARRAYIDX3_13:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 13 +; CHECK-NEXT: [[ARRAYIDX3_14:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 14 +; CHECK-NEXT: [[ARRAYIDX3_15:%.*]] = getelementptr inbounds i16, i16* [[B]], i64 15 +; CHECK-NEXT: store i16 [[SHL]], i16* [[B]], align 2 +; CHECK-NEXT: store i16 [[SHL_1]], i16* [[ARRAYIDX3_1]], align 2 +; CHECK-NEXT: store i16 [[SHL_2]], i16* [[ARRAYIDX3_2]], align 2 +; CHECK-NEXT: store i16 [[SHL_3]], i16* [[ARRAYIDX3_3]], align 2 +; CHECK-NEXT: store i16 [[SHL_4]], i16* [[ARRAYIDX3_4]], align 2 +; CHECK-NEXT: store i16 [[SHL_5]], i16* [[ARRAYIDX3_5]], align 2 +; CHECK-NEXT: store i16 [[SHL_6]], i16* [[ARRAYIDX3_6]], align 2 +; CHECK-NEXT: store i16 [[SHL_7]], i16* [[ARRAYIDX3_7]], align 2 +; CHECK-NEXT: store i16 [[SHL_8]], i16* [[ARRAYIDX3_8]], align 2 +; CHECK-NEXT: store i16 [[SHL_9]], i16* [[ARRAYIDX3_9]], align 2 +; CHECK-NEXT: store i16 [[SHL_10]], i16* [[ARRAYIDX3_10]], align 2 +; CHECK-NEXT: store i16 [[SHL_11]], i16* [[ARRAYIDX3_11]], align 2 +; CHECK-NEXT: store i16 [[SHL_12]], i16* [[ARRAYIDX3_12]], align 2 +; CHECK-NEXT: store i16 [[SHL_13]], i16* [[ARRAYIDX3_13]], align 2 +; CHECK-NEXT: store i16 [[SHL_14]], i16* [[ARRAYIDX3_14]], align 2 +; CHECK-NEXT: store i16 [[SHL_15]], i16* [[ARRAYIDX3_15]], align 2 +; CHECK-NEXT: ret void +; + %arrayidx.1 = getelementptr inbounds i8, i8* %a, i64 1 + %arrayidx.2 = getelementptr inbounds i8, i8* %a, i64 2 + %arrayidx.3 = getelementptr inbounds i8, i8* %a, i64 3 + %arrayidx.4 = getelementptr inbounds i8, i8* %a, i64 4 + %arrayidx.5 = getelementptr inbounds i8, i8* %a, i64 5 + %arrayidx.7 = getelementptr inbounds i8, i8* %a, i64 7 + %arrayidx.6 = getelementptr inbounds i8, i8* %a, i64 6 + %arrayidx.8 = getelementptr inbounds i8, i8* %a, i64 8 + %arrayidx.9 = getelementptr inbounds i8, i8* %a, i64 9 + %arrayidx.10 = getelementptr inbounds i8, i8* %a, i64 10 + %arrayidx.11 = getelementptr inbounds i8, i8* %a, i64 11 + %arrayidx.12 = getelementptr inbounds i8, i8* %a, i64 12 + %arrayidx.13 = getelementptr inbounds i8, i8* %a, i64 13 + %arrayidx.14 = getelementptr inbounds i8, i8* %a, i64 14 + %arrayidx.15 = getelementptr inbounds i8, i8* %a, i64 15 + %i = load i8, i8* %a, align 1 + %i1 = load i8, i8* %arrayidx.1, align 1 + %i2 = load i8, i8* %arrayidx.2, align 1 + %i3 = load i8, i8* %arrayidx.3, align 1 + %i4 = load i8, i8* %arrayidx.4, align 1 + %i5 = load i8, i8* %arrayidx.5, align 1 + %i6 = load i8, i8* %arrayidx.6, align 1 + %i7 = load i8, i8* %arrayidx.7, align 1 + %i8 = load i8, i8* %arrayidx.8, align 1 + %i9 = load i8, i8* %arrayidx.9, align 1 + %i10 = load i8, i8* %arrayidx.10, align 1 + %i11 = load i8, i8* %arrayidx.11, align 1 + %i12 = load i8, i8* %arrayidx.12, align 1 + %i13 = load i8, i8* %arrayidx.13, align 1 + %i14 = load i8, i8* %arrayidx.14, align 1 + %i15 = load i8, i8* %arrayidx.15, align 1 + %conv5 = zext i8 %i to i16 + %conv5.1 = zext i8 %i1 to i16 + %conv5.2 = zext i8 %i2 to i16 + %conv5.3 = zext i8 %i3 to i16 + %conv5.4 = zext i8 %i4 to i16 + %conv5.5 = zext i8 %i5 to i16 + %conv5.6 = zext i8 %i6 to i16 + %conv5.7 = zext i8 %i7 to i16 + %conv5.8 = zext i8 %i8 to i16 + %conv5.9 = zext i8 %i9 to i16 + %conv5.10 = zext i8 %i10 to i16 + %conv5.11 = zext i8 %i11 to i16 + %conv5.12 = zext i8 %i12 to i16 + %conv5.13 = zext i8 %i13 to i16 + %conv5.14 = zext i8 %i14 to i16 + %conv5.15 = zext i8 %i15 to i16 + %shl = shl nuw i16 %conv5, 8 + %shl.1 = shl nuw i16 %conv5.1, 8 + %shl.2 = shl nuw i16 %conv5.2, 8 + %shl.3 = shl nuw i16 %conv5.3, 8 + %shl.4 = shl nuw i16 %conv5.4, 8 + %shl.5 = shl nuw i16 %conv5.5, 8 + %shl.6 = shl nuw i16 %conv5.6, 8 + %shl.7 = shl nuw i16 %conv5.7, 8 + %shl.8 = shl nuw i16 %conv5.8, 8 + %shl.9 = shl nuw i16 %conv5.9, 8 + %shl.10 = shl nuw i16 %conv5.10, 8 + %shl.11 = shl nuw i16 %conv5.11, 8 + %shl.12 = shl nuw i16 %conv5.12, 8 + %shl.13 = shl nuw i16 %conv5.13, 8 + %shl.14 = shl nuw i16 %conv5.14, 8 + %shl.15 = shl nuw i16 %conv5.15, 8 + %arrayidx3.1 = getelementptr inbounds i16, i16* %b, i64 1 + %arrayidx3.2 = getelementptr inbounds i16, i16* %b, i64 2 + %arrayidx3.3 = getelementptr inbounds i16, i16* %b, i64 3 + %arrayidx3.4 = getelementptr inbounds i16, i16* %b, i64 4 + %arrayidx3.5 = getelementptr inbounds i16, i16* %b, i64 5 + %arrayidx3.6 = getelementptr inbounds i16, i16* %b, i64 6 + %arrayidx3.7 = getelementptr inbounds i16, i16* %b, i64 7 + %arrayidx3.8 = getelementptr inbounds i16, i16* %b, i64 8 + %arrayidx3.9 = getelementptr inbounds i16, i16* %b, i64 9 + %arrayidx3.10 = getelementptr inbounds i16, i16* %b, i64 10 + %arrayidx3.11 = getelementptr inbounds i16, i16* %b, i64 11 + %arrayidx3.12 = getelementptr inbounds i16, i16* %b, i64 12 + %arrayidx3.13 = getelementptr inbounds i16, i16* %b, i64 13 + %arrayidx3.14 = getelementptr inbounds i16, i16* %b, i64 14 + %arrayidx3.15 = getelementptr inbounds i16, i16* %b, i64 15 + store i16 %shl, i16* %b, align 2 + store i16 %shl.1, i16* %arrayidx3.1, align 2 + store i16 %shl.2, i16* %arrayidx3.2, align 2 + store i16 %shl.3, i16* %arrayidx3.3, align 2 + store i16 %shl.4, i16* %arrayidx3.4, align 2 + store i16 %shl.5, i16* %arrayidx3.5, align 2 + store i16 %shl.6, i16* %arrayidx3.6, align 2 + store i16 %shl.7, i16* %arrayidx3.7, align 2 + store i16 %shl.8, i16* %arrayidx3.8, align 2 + store i16 %shl.9, i16* %arrayidx3.9, align 2 + store i16 %shl.10, i16* %arrayidx3.10, align 2 + store i16 %shl.11, i16* %arrayidx3.11, align 2 + store i16 %shl.12, i16* %arrayidx3.12, align 2 + store i16 %shl.13, i16* %arrayidx3.13, align 2 + store i16 %shl.14, i16* %arrayidx3.14, align 2 + store i16 %shl.15, i16* %arrayidx3.15, align 2 + ret void +}