1 # REQUIRES: amdgpu-registered-target
2 # RUN: llvm-reduce -abort-on-invalid-reduction -simplify-mir --delta-passes=instructions -mtriple=amdgcn-amd-amdhsa --test FileCheck --test-arg --check-prefix=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2> %t.log
3 # RUN: FileCheck --match-full-lines --check-prefix=RESULT %s < %t
5 # CHECK-INTERESTINGNESS: G_LOAD
6 # CHECK-INTERESTINGNESS: G_LOAD
7 # CHECK-INTERESTINGNESS: G_LOAD
8 # CHECK-INTERESTINGNESS: G_LOAD
9 # CHECK-INTERESTINGNESS: G_STORE
10 # CHECK-INTERESTINGNESS: G_STORE
11 # CHECK-INTERESTINGNESS: G_STORE
12 # CHECK-INTERESTINGNESS: G_LOAD
13 # CHECK-INTERESTINGNESS: G_LOAD
14 # CHECK-INTERESTINGNESS: G_LOAD
15 # CHECK-INTERESTINGNESS: G_LOAD
16 # CHECK-INTERESTINGNESS: G_STORE
17 # CHECK-INTERESTINGNESS: G_STORE
20 # RESULT: %{{[0-9]+}}:_(<2 x s16>) = G_LOAD %{{[0-9]+}}(p1) :: (load (<2 x s16>) from %ir.argptr0, align 32, addrspace 1)
21 # RESULT: %{{[0-9]+}}:_(<2 x s32>) = G_LOAD %{{[0-9]+}}(p1) :: (load (<2 x s32>) from %ir.argptr1, addrspace 3)
22 # RESULT: %{{[0-9]+}}:_(<2 x s32>) = G_LOAD %{{[0-9]+}}(p1) :: (load (<2 x s32>) from %ir.argptr1 + 8, addrspace 3)
23 # RESULT: %{{[0-9]+}}:_(<2 x s32>) = G_LOAD %{{[0-9]+}}(p1) :: (load (<2 x s32>) from %ir.argptr1 + 12, align 4, basealign 8, addrspace 3)
24 # RESULT: G_STORE %{{[0-9]+}}(<2 x s32>), %{{[0-9]+}}(p3) :: (store (<2 x s32>) into %fixed-stack.0, addrspace 5)
25 # RESULT: G_STORE %{{[0-9]+}}(<2 x s32>), %{{[0-9]+}}(p3) :: (store (<2 x s32>) into %stack.0, addrspace 5)
26 # RESULT: G_STORE %{{[0-9]+}}(p3), %{{[0-9]+}}(p3) :: (store (p3), addrspace 5)
27 # RESULT: %{{[0-9]+}}:_(s32) = G_LOAD %{{[0-9]+}}(p0) :: (load (s32) from call-entry @foo, addrspace 4)
28 # RESULT: %{{[0-9]+}}:_(s32) = G_LOAD %{{[0-9]+}}(p1) :: (load (s32) from constant-pool, addrspace 1)
29 # RESULT: %{{[0-9]+}}:_(p1) = G_LOAD %{{[0-9]+}}(p0) :: (load (p1) from got, addrspace 4)
30 # RESULT: %{{[0-9]+}}:_(p1) = G_LOAD %{{[0-9]+}}(p0) :: (load (p1) from jump-table, addrspace 4)
31 # RESULT: G_STORE %{{[0-9]+}}(<3 x s32>), %{{[0-9]+}}(p5) :: (store (<3 x s32>) into stack, align 8, addrspace 5)
32 # RESULT: G_STORE %{{[0-9]+}}(<3 x s32>), %{{[0-9]+}}(p5) :: (store (<3 x s32>) into stack + 12, align 4, basealign 8, addrspace 5)
36 define void @func(<2 x i16> addrspace(1)* %argptr0, <2 x i32> addrspace(3)* %argptr1) {
43 tracksRegLiveness: true
45 - { id: 0, offset: 16, size: 8, alignment: 4 }
47 - { id: 0, size: 4, alignment: 16 }
53 %0:_(p1) = G_IMPLICIT_DEF
54 %1:_(<2 x s16>) = G_LOAD %0 :: (load (<2 x s16>) from %ir.argptr0, align 32, addrspace 1)
55 %2:_(<2 x s32>) = G_ZEXT %1
56 %3:_(<2 x s32>) = G_LOAD %0 :: (load (<2 x s32>) from %ir.argptr1, addrspace 3)
57 %4:_(<2 x s32>) = G_LOAD %0 :: (load (<2 x s32>) from %ir.argptr1 + 8, addrspace 3)
58 %5:_(<2 x s32>) = G_LOAD %0 :: (load (<2 x s32>) from %ir.argptr1 + 12, addrspace 3)
59 %6:_(<2 x s32>) = G_ADD %2, %3
60 %7:_(<2 x s32>) = G_ADD %6, %4
61 %8:_(<2 x s32>) = G_ADD %7, %5
62 %9:_(p3) = G_IMPLICIT_DEF
63 G_STORE %8, %9 :: (store (<2 x s32>) into %fixed-stack.0, addrspace 5)
64 G_STORE %8, %9 :: (store (<2 x s32>) into %stack.0, addrspace 5)
66 ; Check address space, no value
67 G_STORE %9, %9 :: (store (p3), addrspace 5)
69 %10:_(p0) = G_IMPLICIT_DEF
70 %11:_(s32) = G_LOAD %10 :: (load (s32) from call-entry @foo, addrspace 4)
71 %12:_(s32) = G_LOAD %0 :: (load (s32) from constant-pool, addrspace 1)
73 %13:_(p1) = G_LOAD %10 :: (load (p1) from got, addrspace 4)
75 %14:_(p1) = G_LOAD %10 :: (load (p1) from jump-table, addrspace 4)
77 %15:_(<3 x s32>) = G_IMPLICIT_DEF
78 %16:_(p5) = G_IMPLICIT_DEF
79 G_STORE %15, %16 :: (store (<3 x s32>) into stack, align 8, addrspace 5)
80 G_STORE %15, %16 :: (store (<3 x s32>) into stack + 12, basealign 8, addrspace 5)
82 S_ENDPGM 0, implicit %10, implicit %12, implicit %13, implicit %14