[PATCH] D60315: AMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 5 07:33:01 PDT 2019
arsenm updated this revision to Diff 193873.
arsenm added a comment.
Fix not calling observer
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60315/new/
https://reviews.llvm.org/D60315
Files:
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
Index: test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
===================================================================
--- test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
+++ test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
@@ -705,9 +705,10 @@
; CHECK-LABEL: name: test_extract_s1_s8_offset0
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
- ; CHECK: [[EXTRACT:%[0-9]+]]:_(s1) = G_EXTRACT [[TRUNC]](s8), 0
- ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[EXTRACT]](s1)
- ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
+ ; CHECK: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[TRUNC]](s8)
+ ; CHECK: [[EXTRACT:%[0-9]+]]:_(s1) = G_EXTRACT [[ANYEXT]](s16), 0
+ ; CHECK: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[EXTRACT]](s1)
+ ; CHECK: $vgpr0 = COPY [[ANYEXT1]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s8) = G_TRUNC %0
%2:_(s1) = G_EXTRACT %1, 0
@@ -723,9 +724,10 @@
; CHECK-LABEL: name: test_extract_s1_s8_offset2
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
- ; CHECK: [[EXTRACT:%[0-9]+]]:_(s1) = G_EXTRACT [[TRUNC]](s8), 2
- ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[EXTRACT]](s1)
- ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
+ ; CHECK: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[TRUNC]](s8)
+ ; CHECK: [[EXTRACT:%[0-9]+]]:_(s1) = G_EXTRACT [[ANYEXT]](s16), 2
+ ; CHECK: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[EXTRACT]](s1)
+ ; CHECK: $vgpr0 = COPY [[ANYEXT1]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s8) = G_TRUNC %0
%2:_(s1) = G_EXTRACT %1, 2
Index: lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -898,6 +898,13 @@
return Legalized;
}
+ if (SrcTy.isScalar()) {
+ Observer.changingInstr(MI);
+ widenScalarSrc(MI, WideTy, 1, TargetOpcode::G_ANYEXT);
+ Observer.changedInstr(MI);
+ return UnableToLegalize;
+ }
+
if (!SrcTy.isVector())
return UnableToLegalize;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60315.193873.patch
Type: text/x-patch
Size: 2159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190405/005c68ea/attachment.bin>
More information about the llvm-commits
mailing list