From 9620fe02dfedf7b272a61ff2dd16777ff53e4b03 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 5 Apr 2020 10:53:47 -0400 Subject: [PATCH] AMDGPU/GlobalISel: Add some G_INSERT/G_EXTRACT select tests --- .../AMDGPU/GlobalISel/inst-select-extract.mir | 36 ++++++++++++++++++++ .../AMDGPU/GlobalISel/inst-select-insert.mir | 38 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-extract.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-extract.mir index d015982..0d8739b 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-extract.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-extract.mir @@ -219,3 +219,39 @@ body: | S_ENDPGM 0, implicit %1, implicit %2 ... + +--- +name: extract_sgpr_v2s16_from_v4s16_offset0 +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0_sgpr1 + ; CHECK-LABEL: name: extract_sgpr_v2s16_from_v4s16_offset0 + ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 + ; CHECK: S_ENDPGM 0, implicit [[COPY1]] + %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 + %1:sgpr(<2 x s16>) = G_EXTRACT %0, 0 + S_ENDPGM 0, implicit %1 + +... + +--- +name: extract_sgpr_v2s16_from_v4s16_offset32 +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0_sgpr1 + ; CHECK-LABEL: name: extract_sgpr_v2s16_from_v4s16_offset32 + ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 + ; CHECK: S_ENDPGM 0, implicit [[COPY1]] + %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 + %1:sgpr(<2 x s16>) = G_EXTRACT %0, 32 + S_ENDPGM 0, implicit %1 + +... diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.mir index 9284fcd..c6f67fb 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.mir @@ -560,3 +560,41 @@ body: | %2:vgpr(s256) = G_INSERT %0, %1, 128 S_ENDPGM 0, implicit %2 ... + +--- +name: insert_sgpr_v2s16_to_v4s16_offset0 +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0_sgpr1, $sgpr2 + ; CHECK-LABEL: name: insert_sgpr_v2s16_to_v4s16_offset0 + ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr2 + ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:sreg_64 = INSERT_SUBREG [[COPY]], [[COPY1]], %subreg.sub0 + ; CHECK: S_ENDPGM 0, implicit [[INSERT_SUBREG]] + %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 + %1:sgpr(<2 x s16>) = COPY $sgpr2 + %2:sgpr(<4 x s16>) = G_INSERT %0, %1, 0 + S_ENDPGM 0, implicit %2 + +... + +--- +name: insert_sgpr_v2s16_to_v4s16_offset32 +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0_sgpr1, $sgpr2 + ; CHECK-LABEL: name: insert_sgpr_v2s16_to_v4s16_offset32 + ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr2 + ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:sreg_64 = INSERT_SUBREG [[COPY]], [[COPY1]], %subreg.sub1 + ; CHECK: S_ENDPGM 0, implicit [[INSERT_SUBREG]] + %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 + %1:sgpr(<2 x s16>) = COPY $sgpr2 + %2:sgpr(<4 x s16>) = G_INSERT %0, %1, 32 + S_ENDPGM 0, implicit %2 -- 2.7.4