llvm.org GIT mirror llvm / 4e77263
AMDGPU/GlobalISel: Make some G_EXTRACTs legal As far as I can tell legalization of weird sizes for the output type isn't implemented. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326714 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 2 years ago
2 changed file(s) with 117 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
105105 setAction({G_LOAD, 1, S64}, Legal);
106106 setAction({G_STORE, 1, S64}, Legal);
107107
108 // FIXME: Doesn't handle extract of illegal sizes.
109 getActionDefinitionsBuilder(G_EXTRACT)
110 .unsupportedIf([=](const LegalityQuery &Query) {
111 return Query.Types[0].getSizeInBits() >= Query.Types[1].getSizeInBits();
112 })
113 .legalIf([=](const LegalityQuery &Query) {
114 const LLT &Ty0 = Query.Types[0];
115 const LLT &Ty1 = Query.Types[1];
116 return (Ty0.getSizeInBits() % 32 == 0) &&
117 (Ty1.getSizeInBits() % 32 == 0);
118 });
119
108120 computeTables();
109121 }
0 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
1 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel %s -o - | FileCheck %s
2
3 ---
4 name: test_extract_lo32_i64
5 body: |
6 bb.0.entry:
7 liveins: $vgpr0_vgpr1
8
9 ; CHECK-LABEL: name: test_extract_lo32_i64
10 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
11 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 0
12 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
13 %0:_(s64) = COPY $vgpr0_vgpr1
14 %1:_(s32) = G_EXTRACT %0, 0
15 S_ENDPGM implicit %1
16 ...
17 ---
18 name: test_extract_hi32_i64
19 body: |
20 bb.0.entry:
21 liveins: $vgpr0_vgpr1
22
23 ; CHECK-LABEL: name: test_extract_hi32_i64
24 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
25 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 32
26 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
27 %0:_(s64) = COPY $vgpr0_vgpr1
28 %1:_(s32) = G_EXTRACT %0, 32
29 S_ENDPGM implicit %1
30 ...
31
32 ---
33 name: test_extract_dword0_i128
34 body: |
35 bb.0.entry:
36 liveins: $vgpr0_vgpr1
37
38 ; CHECK-LABEL: name: test_extract_dword0_i128
39 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
40 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 0
41 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
42 %0:_(s64) = COPY $vgpr0_vgpr1
43 %1:_(s32) = G_EXTRACT %0, 0
44 S_ENDPGM implicit %1
45 ...
46
47 ---
48 name: test_extract_dword1_i128
49 body: |
50 bb.0.entry:
51 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
52
53 ; CHECK-LABEL: name: test_extract_dword1_i128
54 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
55 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s128), 32
56 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
57 %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
58 %1:_(s32) = G_EXTRACT %0, 32
59 S_ENDPGM implicit %1
60 ...
61
62 ---
63 name: test_extract_dword2_i128
64 body: |
65 bb.0.entry:
66 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
67
68 ; CHECK-LABEL: name: test_extract_dword2_i128
69 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
70 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s128), 64
71 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
72 %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
73 %1:_(s32) = G_EXTRACT %0, 64
74 S_ENDPGM implicit %1
75 ...
76
77 ---
78 name: test_extract_dword3_i128
79 body: |
80 bb.0.entry:
81 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
82
83 ; CHECK-LABEL: name: test_extract_dword3_i128
84 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
85 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s128), 96
86 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
87 %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
88 %1:_(s32) = G_EXTRACT %0, 96
89 S_ENDPGM implicit %1
90 ...
91 ---
92 name: test_extract_dword2_i96
93 body: |
94 bb.0.entry:
95 liveins: $vgpr0_vgpr1_vgpr2
96
97 ; CHECK-LABEL: name: test_extract_dword2_i96
98 ; CHECK: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
99 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s96), 64
100 ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
101 %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
102 %1:_(s32) = G_EXTRACT %0, 64
103 S_ENDPGM implicit %1
104 ...