AMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP

llvm-svn: 371811
This commit is contained in:
Matt Arsenault 2019-09-13 04:04:55 +00:00
parent a49a16ddd0
commit a4be3eff5c
3 changed files with 35 additions and 1 deletions

View File

@ -416,7 +416,7 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
.scalarize(0);
getActionDefinitionsBuilder({G_SITOFP, G_UITOFP})
.legalFor({{S32, S32}, {S64, S32}})
.legalFor({{S32, S32}, {S64, S32}, {S16, S32}})
.lowerFor({{S32, S64}})
.customFor({{S64, S64}})
.scalarize(0);

View File

@ -141,3 +141,20 @@ body: |
%1:_(s64) = G_SITOFP %0
$vgpr0_vgpr1 = COPY %1
...
---
name: test_sitofp_s32_to_s16
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_sitofp_s32_to_s16
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[SITOFP:%[0-9]+]]:_(s16) = G_SITOFP [[COPY]](s32)
; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SITOFP]](s16)
; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s16) = G_SITOFP %0
%2:_(s32) = G_ANYEXT %1
$vgpr0 = COPY %2
...

View File

@ -110,3 +110,20 @@ body: |
%1:_(s64) = G_UITOFP %0
$vgpr0_vgpr1 = COPY %1
...
---
name: test_uitofp_s32_to_s16
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_uitofp_s32_to_s16
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[COPY]](s32)
; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s16) = G_UITOFP %0
%2:_(s32) = G_ANYEXT %1
$vgpr0 = COPY %2
...