llvm.org GIT mirror llvm / c7709a4
Test case I forgot to 'add' for r201126. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201207 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 6 years ago
1 changed file(s) with 53 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt %s -O2 -S | FileCheck %s
1
2 ; Check that llvm.x86.avx2.gather.d.ps.256 intrinsic is not eliminated as gather and store memory accesses are based on arr.ptr
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
5
6 ; Function Attrs: nounwind readonly
7 declare <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float>, i8*, <8 x i32>, <8 x float>, i8) #0
8
9 ; Function Attrs: nounwind
10 define <8 x float> @foo1(i8* noalias readonly %arr.ptr, <8 x i32>* noalias readonly %vix.ptr, i8* noalias %t2.ptr) #1 {
11 allocas:
12 %vix = load <8 x i32>* %vix.ptr, align 4
13 %t1.ptr = getelementptr i8* %arr.ptr, i8 4
14
15 %v1 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> , i8 1) #2
16 store i8 1, i8* %t1.ptr, align 4
17
18 %v2 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> , i8 1) #2
19 %res = fadd <8 x float> %v1, %v2
20
21 ret <8 x float> %res
22 }
23 ; CHECK: foo1
24 ; CHECK: llvm.x86.avx2.gather.d.ps.256
25 ; CHECK: store
26 ; CHECK: llvm.x86.avx2.gather.d.ps.256
27
28 ; Check that second gather is eliminated as gather and store memory accesses are based on different no-aliasing pointers
29
30 ; Function Attrs: nounwind
31 define <8 x float> @foo2(i8* noalias readonly %arr.ptr, <8 x i32>* noalias readonly %vix.ptr, i8* noalias %t2.ptr) #1 {
32 allocas:
33 %vix = load <8 x i32>* %vix.ptr, align 4
34 %t1.ptr = getelementptr i8* %arr.ptr, i8 4
35
36 %v1 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> , i8 1) #2
37 store i8 1, i8* %t2.ptr, align 4
38
39 %v2 = tail call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, i8* %arr.ptr, <8 x i32> %vix, <8 x float> , i8 1) #2
40 %res = fadd <8 x float> %v1, %v2
41
42 ret <8 x float> %res
43 }
44 ; CHECK: foo2
45 ; CHECK: llvm.x86.avx2.gather.d.ps.256
46 ; CHECK: store
47 ; CHECK-NOT: llvm.x86.avx2.gather.d.ps.256
48
49 attributes #0 = { nounwind readonly }
50 attributes #1 = { nounwind "target-cpu"="corei7-avx" "target-features"="+avx2,+popcnt,+cmov,+f16c,+rdrnd,+fma" }
51 attributes #2 = { nounwind }
52