llvm.org GIT mirror llvm / 417485b
AMDGPU/GlobalISel: Basic G_GEP legality git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327773 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 2 years ago
2 changed file(s) with 110 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
3131 return LLT::pointer(AS, TM.getPointerSizeInBits(AS));
3232 };
3333
34 auto AMDGPUAS = ST.getAMDGPUAS();
35
3436 const LLT S1 = LLT::scalar(1);
3537 const LLT V2S16 = LLT::vector(2, 16);
3638
3941
4042 const LLT GlobalPtr = GetAddrSpacePtr(AMDGPUAS::GLOBAL_ADDRESS);
4143 const LLT ConstantPtr = GetAddrSpacePtr(AMDGPUAS::CONSTANT_ADDRESS);
42
44 const LLT LocalPtr = GetAddrSpacePtr(AMDGPUAS::LOCAL_ADDRESS);
45 const LLT FlatPtr = GetAddrSpacePtr(AMDGPUAS.FLAT_ADDRESS);
46 const LLT PrivatePtr = GetAddrSpacePtr(AMDGPUAS.PRIVATE_ADDRESS);
47
48 const LLT AddrSpaces[] = {
49 GlobalPtr,
50 ConstantPtr,
51 LocalPtr,
52 FlatPtr,
53 PrivatePtr
54 };
4355
4456 setAction({G_ADD, S32}, Legal);
4557 setAction({G_MUL, S32}, Legal);
8395 setAction({G_FPTOUI, S32}, Legal);
8496 setAction({G_FPTOUI, 1, S32}, Legal);
8597
86 setAction({G_GEP, GlobalPtr}, Legal);
87 setAction({G_GEP, ConstantPtr}, Legal);
88 setAction({G_GEP, 1, S64}, Legal);
98 for (LLT PtrTy : AddrSpaces) {
99 LLT IdxTy = LLT::scalar(PtrTy.getSizeInBits());
100 setAction({G_GEP, PtrTy}, Legal);
101 setAction({G_GEP, 1, IdxTy}, Legal);
102 }
89103
90104 setAction({G_ICMP, S1}, Legal);
91105 setAction({G_ICMP, 1, S32}, Legal);
0 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
1 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer -global-isel %s -o - | FileCheck %s
2
3 ---
4 name: test_gep_global_i64_idx
5 body: |
6 bb.0:
7 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
8
9 ; CHECK-LABEL: name: test_gep_global_i64_idx
10 ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
11 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
12 ; CHECK: [[GEP:%[0-9]+]]:_(p1) = G_GEP [[COPY]], [[COPY1]](s64)
13 ; CHECK: $vgpr0_vgpr1 = COPY [[GEP]](p1)
14 %0:_(p1) = COPY $vgpr0_vgpr1
15 %1:_(s64) = COPY $vgpr2_vgpr3
16 %2:_(p1) = G_GEP %0, %1
17
18 $vgpr0_vgpr1 = COPY %2
19 ...
20
21 ---
22 name: test_gep_flat_i64_idx
23 body: |
24 bb.0:
25 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
26
27 ; CHECK-LABEL: name: test_gep_flat_i64_idx
28 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
29 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
30 ; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY]], [[COPY1]](s64)
31 ; CHECK: $vgpr0_vgpr1 = COPY [[GEP]](p0)
32 %0:_(p0) = COPY $vgpr0_vgpr1
33 %1:_(s64) = COPY $vgpr2_vgpr3
34 %2:_(p0) = G_GEP %0, %1
35
36 $vgpr0_vgpr1 = COPY %2
37 ...
38
39 ---
40 name: test_gep_constant_i64_idx
41 body: |
42 bb.0:
43 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
44
45 ; CHECK-LABEL: name: test_gep_constant_i64_idx
46 ; CHECK: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
47 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
48 ; CHECK: [[GEP:%[0-9]+]]:_(p4) = G_GEP [[COPY]], [[COPY1]](s64)
49 ; CHECK: $vgpr0_vgpr1 = COPY [[GEP]](p4)
50 %0:_(p4) = COPY $vgpr0_vgpr1
51 %1:_(s64) = COPY $vgpr2_vgpr3
52 %2:_(p4) = G_GEP %0, %1
53
54 $vgpr0_vgpr1 = COPY %2
55 ...
56
57 ---
58 name: test_gep_local_i32_idx
59 body: |
60 bb.0:
61 liveins: $vgpr0, $vgpr1
62
63 ; CHECK-LABEL: name: test_gep_local_i32_idx
64 ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
65 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
66 ; CHECK: [[GEP:%[0-9]+]]:_(p3) = G_GEP [[COPY]], [[COPY1]](s32)
67 ; CHECK: $vgpr0 = COPY [[GEP]](p3)
68 %0:_(p3) = COPY $vgpr0
69 %1:_(s32) = COPY $vgpr1
70 %2:_(p3) = G_GEP %0, %1
71
72 $vgpr0 = COPY %2
73 ...
74
75 ---
76 name: test_gep_private_i32_idx
77 body: |
78 bb.0:
79 liveins: $vgpr0, $vgpr1
80
81 ; CHECK-LABEL: name: test_gep_private_i32_idx
82 ; CHECK: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
83 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
84 ; CHECK: [[GEP:%[0-9]+]]:_(p5) = G_GEP [[COPY]], [[COPY1]](s32)
85 ; CHECK: $vgpr0 = COPY [[GEP]](p5)
86 %0:_(p5) = COPY $vgpr0
87 %1:_(s32) = COPY $vgpr1
88 %2:_(p5) = G_GEP %0, %1
89
90 $vgpr0 = COPY %2
91 ...