llvm.org GIT mirror llvm / 65181f7
AMDGPU/GlobalISel: Cleanup constant legality git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327774 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 2 years ago
2 changed file(s) with 27 addition(s) and 64 deletion(s). Raw diff Collapse all Expand all
6565 setAction({G_BITCAST, S32}, Legal);
6666 setAction({G_BITCAST, 1, V2S16}, Legal);
6767
68 getActionDefinitionsBuilder(G_FCONSTANT)
69 .legalFor({S32, S64});
70 getActionDefinitionsBuilder({G_IMPLICIT_DEF, G_CONSTANT})
71 .legalFor({S1, S32, S64});
72
6873 // FIXME: i1 operands to intrinsics should always be legal, but other i1
6974 // values may not be legal. We need to figure out how to distinguish
7075 // between these two scenarios.
7176 setAction({G_CONSTANT, S1}, Legal);
72 setAction({G_CONSTANT, S32}, Legal);
73 setAction({G_CONSTANT, S64}, Legal);
74
75 setAction({G_FCONSTANT, S32}, Legal);
76 setAction({G_FCONSTANT, S64}, Legal);
77
78 setAction({G_IMPLICIT_DEF, S32}, Legal);
79 setAction({G_IMPLICIT_DEF, S64}, Legal);
8077
8178 setAction({G_FADD, S32}, Legal);
8279
0 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
11 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer -global-isel %s -o - | FileCheck %s
22
3 --- |
4 define void @test_constant_i32() {
5 ret void
6 }
7
8 define void @test_constant_i64() {
9 ret void
10 }
11
12 define void @test_fconstant_f32() {
13 ret void
14 }
15
16 define void @test_fconstant_f64() {
17 ret void
18 }
19
20 declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
21
22 attributes #1 = { nounwind }
23
24 ...
25
263 ---
274 name: test_constant_i32
28 registers:
29 - { id: 0, class: _ }
30 - { id: 1, class: _ }
315 body: |
326 bb.0:
337
348 ; CHECK-LABEL: name: test_constant_i32
359 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
36 ; CHECK: [[C1:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
37 ; CHECK: G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.exp), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C1]](s1), [[C1]](s1)
38 %0(s32) = G_CONSTANT i32 5
39 %1(s1) = G_CONSTANT i1 0
40 G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.exp.f32), %0, %0, %0, %0, %0, %0, %1, %1;
10 ; CHECK: $vgpr0 = COPY [[C]](s32)
11 %0:_(s32) = G_CONSTANT i32 5
12 $vgpr0 = COPY %0
4113 ...
4214 ---
4315 name: test_constant_i64
44 registers:
45 - { id: 0, class: _ }
46 - { id: 1, class: _ }
4716 body: |
4817 bb.0:
4918
5019 ; CHECK-LABEL: name: test_constant_i64
51 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
52 ; CHECK: [[C1:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
53 ; CHECK: G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.exp), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C1]](s1), [[C1]](s1)
54 %0(s32) = G_CONSTANT i32 5
55 %1(s1) = G_CONSTANT i1 0
56 G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.exp.f32), %0, %0, %0, %0, %0, %0, %1, %1;
20 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
21 ; CHECK: $vgpr0_vgpr1 = COPY [[C]](s64)
22 %0:_(s64) = G_CONSTANT i64 5
23 $vgpr0_vgpr1 = COPY %0
24
5725 ...
5826 ---
5927 name: test_fconstant_f32
60 registers:
61 - { id: 0, class: _ }
62 - { id: 1, class: _ }
6328 body: |
6429 bb.0:
6530
6631 ; CHECK-LABEL: name: test_fconstant_f32
6732 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
6833 ; CHECK: $vgpr0 = COPY [[C]](s32)
69 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 7.500000e+00
70 ; CHECK: $vgpr0 = COPY [[C1]](s32)
71 %0(s32) = G_FCONSTANT float 1.0
34 %0:_(s32) = G_FCONSTANT float 1.0
7235 $vgpr0 = COPY %0
73 %1(s32) = G_FCONSTANT float 7.5
74 $vgpr0 = COPY %1
7536 ...
7637 ---
7738 name: test_fconstant_f64
78 registers:
79 - { id: 0, class: _ }
80 - { id: 1, class: _ }
8139 body: |
8240 bb.0:
8341
8442 ; CHECK-LABEL: name: test_fconstant_f64
8543 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
8644 ; CHECK: $vgpr0_vgpr1 = COPY [[C]](s64)
87 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 7.500000e+00
88 ; CHECK: $vgpr0_vgpr1 = COPY [[C1]](s64)
89 %0(s64) = G_FCONSTANT double 1.0
45 %0:_(s64) = G_FCONSTANT double 1.0
9046 $vgpr0_vgpr1 = COPY %0
91 %1(s64) = G_FCONSTANT double 7.5
92 $vgpr0_vgpr1 = COPY %1
9347 ...
48
49 ---
50 name: test_constant_1
51 body: |
52 bb.0:
53
54 ; CHECK-LABEL: name: test_constant_1
55 ; CHECK: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
56 ; CHECK: S_ENDPGM implicit [[C]](s1)
57 %1:_(s1) = G_CONSTANT i1 0
58 S_ENDPGM implicit %1
59 ...