xref: /llvm-project/llvm/test/Transforms/LoopVectorize/X86/int128_no_gather.ll (revision 7d7577256b76e4293f455b8093504d5f7044ab4b)
1; RUN: opt < %s -passes=loop-vectorize -S | FileCheck %s
2
3; This test checks that gather/scatter not used for i128 data type.
4;CHECK-NOT: gather
5;CHECK-NOT: scatter
6
7target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-unknown-linux-gnu"
9
10@x = common global [151 x i128] zeroinitializer, align 16
11@.str = private unnamed_addr constant [46 x i8] c" PASS.....Y3 1/1 (BUBBLE SORT), X(25) = 5085\0A\00", align 1
12@.str.1 = private unnamed_addr constant [44 x i8] c" FAIL.....Y3 1/1 (BUBBLE SORT), X(25) = %d\0A\00", align 1
13@str = private unnamed_addr constant [45 x i8] c" PASS.....Y3 1/1 (BUBBLE SORT), X(25) = 5085\00"
14
15; Function Attrs: noinline nounwind uwtable
16declare i32 @y3inner() #0
17
18define i32 @main() local_unnamed_addr #0 {
19entry:
20  br label %do.body
21
22do.body:                                          ; preds = %do.body, %entry
23  %j.0 = phi i128 [ 99999, %entry ], [ %add10, %do.body ]
24  %i.0 = phi i128 [ 1, %entry ], [ %add11, %do.body ]
25  %and = and i128 %j.0, 32767
26  %idxprom = trunc i128 %i.0 to i64
27  %arrayidx = getelementptr inbounds [151 x i128], ptr @x, i64 0, i64 %idxprom
28  store i128 %and, ptr %arrayidx, align 16
29  %add = add nuw nsw i128 %j.0, 11111
30  %and1 = and i128 %add, 32767
31  %add2 = add nuw nsw i128 %i.0, 1
32  %idxprom3 = trunc i128 %add2 to i64
33  %arrayidx4 = getelementptr inbounds [151 x i128], ptr @x, i64 0, i64 %idxprom3
34  store i128 %and1, ptr %arrayidx4, align 16
35  %add5 = add nuw nsw i128 %j.0, 22222
36  %and6 = and i128 %add5, 32767
37  %add7 = add nuw nsw i128 %i.0, 2
38  %idxprom8 = trunc i128 %add7 to i64
39  %arrayidx9 = getelementptr inbounds [151 x i128], ptr @x, i64 0, i64 %idxprom8
40  store i128 %and6, ptr %arrayidx9, align 16
41  %add10 = add nuw nsw i128 %j.0, 33333
42  %add11 = add nuw nsw i128 %i.0, 3
43  %cmp = icmp slt i128 %add11, 149
44  br i1 %cmp, label %do.body, label %do.end
45
46do.end:                                           ; preds = %do.body
47  store i128 1766649, ptr getelementptr inbounds ([151 x i128], ptr @x, i64 0, i64 149), align 16
48  store i128 1766649, ptr getelementptr inbounds ([151 x i128], ptr @x, i64 0, i64 150), align 16
49  %call = tail call i32 @y3inner()
50  %0 = load i128, ptr getelementptr inbounds ([151 x i128], ptr @x, i64 0, i64 25), align 16
51  %cmp12 = icmp eq i128 %0, 5085
52  br i1 %cmp12, label %if.then, label %if.else
53
54if.then:                                          ; preds = %do.end
55  %puts = tail call i32 @puts(ptr @str)
56  br label %if.end
57
58if.else:                                          ; preds = %do.end
59  %coerce.sroa.0.0.extract.trunc = trunc i128 %0 to i64
60  %coerce.sroa.2.0.extract.shift = lshr i128 %0, 64
61  %coerce.sroa.2.0.extract.trunc = trunc i128 %coerce.sroa.2.0.extract.shift to i64
62  %call14 = tail call i32 (ptr, ...) @printf(ptr @.str.1, i64 %coerce.sroa.0.0.extract.trunc, i64 %coerce.sroa.2.0.extract.trunc)
63  br label %if.end
64
65if.end:                                           ; preds = %if.else, %if.then
66  ret i32 0
67}
68
69; Function Attrs: nounwind
70declare i32 @printf(ptr, ...) #1
71; Function Attrs: nounwind
72declare i32 @puts(ptr nocapture readonly) #2
73
74attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="skylake-avx512" "target-features"="+adx,+aes,+avx,+avx2,+avx512bw,+avx512cd,+avx512dq,+avx512f,+avx512vl,+bmi,+bmi2,+clflushopt,+clwb,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+mpx,+pclmul,+pku,+popcnt,+rdrnd,+rdseed,+rtm,+sgx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" }
75attributes #1 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="skylake-avx512" "target-features"="+adx,+aes,+avx,+avx2,+avx512bw,+avx512cd,+avx512dq,+avx512f,+avx512vl,+bmi,+bmi2,+clflushopt,+clwb,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+mpx,+pclmul,+pku,+popcnt,+rdrnd,+rdseed,+rtm,+sgx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" }
76attributes #2 = { nounwind }
77