[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / Transforms / SLPVectorizer / vectorize-reorder-alt-shuffle.ll
blob631adf1fa81d53e67895063d6513044ff8f41e13
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: %if x86-registered-target %{ opt -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s %}
3 ; RUN: %if aarch64-registered-target %{ opt -passes=slp-vectorizer -S -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s %}
5 define void @foo(ptr %c, ptr %d) {
6 ; CHECK-LABEL: @foo(
7 ; CHECK-NEXT:  entry:
8 ; CHECK-NEXT:    [[ARRAYIDX4:%.*]] = getelementptr inbounds i8, ptr [[C:%.*]], i64 1
9 ; CHECK-NEXT:    [[ADD_PTR53:%.*]] = getelementptr inbounds float, ptr [[D:%.*]], i64 -4
10 ; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x i8>, ptr [[ARRAYIDX4]], align 1
11 ; CHECK-NEXT:    [[TMP2:%.*]] = zext <4 x i8> [[TMP1]] to <4 x i32>
12 ; CHECK-NEXT:    [[TMP3:%.*]] = shl nuw nsw <4 x i32> [[TMP2]], <i32 2, i32 2, i32 2, i32 3>
13 ; CHECK-NEXT:    [[TMP4:%.*]] = and <4 x i32> [[TMP2]], <i32 2, i32 2, i32 2, i32 3>
14 ; CHECK-NEXT:    [[TMP5:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> [[TMP4]], <4 x i32> <i32 1, i32 2, i32 7, i32 0>
15 ; CHECK-NEXT:    [[TMP6:%.*]] = add nsw <4 x i32> undef, [[TMP5]]
16 ; CHECK-NEXT:    [[TMP7:%.*]] = sitofp <4 x i32> [[TMP6]] to <4 x float>
17 ; CHECK-NEXT:    [[TMP8:%.*]] = fdiv <4 x float> [[TMP7]], undef
18 ; CHECK-NEXT:    store <4 x float> [[TMP8]], ptr [[ADD_PTR53]], align 4
19 ; CHECK-NEXT:    ret void
21 entry:
22   %arrayidx1 = getelementptr inbounds i8, ptr %c, i64 4
23   %0 = load i8, ptr %arrayidx1, align 1
24   %conv2 = zext i8 %0 to i32
25   %and = and i32 %conv2, 3
26   %arrayidx4 = getelementptr inbounds i8, ptr %c, i64 1
27   %1 = load i8, ptr %arrayidx4, align 1
28   %conv5 = zext i8 %1 to i32
29   %shl6 = shl nuw nsw i32 %conv5, 2
30   %arrayidx12 = getelementptr inbounds i8, ptr %c, i64 2
31   %2 = load i8, ptr %arrayidx12, align 1
32   %conv13 = zext i8 %2 to i32
33   %shl14 = shl nuw nsw i32 %conv13, 2
34   %arrayidx17 = getelementptr inbounds i8, ptr %c, i64 3
35   %3 = load i8, ptr %arrayidx17, align 1
36   %conv18 = zext i8 %3 to i32
37   %shl19 = shl nuw nsw i32 %conv18, 2
38   %sub = add nsw i32 undef, %shl6
39   %conv27 = sitofp i32 %sub to float
40   %div = fdiv float %conv27, undef
41   %add.ptr = getelementptr inbounds float, ptr %d, i64 -1
42   store float %div, ptr %add.ptr, align 4
43   %sub32 = add nsw i32 undef, %and
44   %conv33 = sitofp i32 %sub32 to float
45   %div36 = fdiv float %conv33, undef
46   %add.ptr37 = getelementptr inbounds float, ptr %d, i64 -2
47   store float %div36, ptr %add.ptr37, align 4
48   %sub40 = add nsw i32 undef, %shl19
49   %conv41 = sitofp i32 %sub40 to float
50   %div44 = fdiv float %conv41, undef
51   %add.ptr45 = getelementptr inbounds float, ptr %d, i64 -3
52   store float %div44, ptr %add.ptr45, align 4
53   %sub48 = add nsw i32 undef, %shl14
54   %conv49 = sitofp i32 %sub48 to float
55   %div52 = fdiv float %conv49, undef
56   %add.ptr53 = getelementptr inbounds float, ptr %d, i64 -4
57   store float %div52, ptr %add.ptr53, align 4
58   ret void