AMDGPU/GlobalISel: Legalize f32->f16 fptrunc

llvm-svn: 351695
This commit is contained in:
Matt Arsenault 2019-01-20 19:10:26 +00:00
parent 9fddc3fd00
commit cfd9e7f594
2 changed files with 20 additions and 3 deletions

View File

@ -139,7 +139,7 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST,
.legalFor({S32, S64});
getActionDefinitionsBuilder(G_FPTRUNC)
.legalFor({{S32, S64}});
.legalFor({{S32, S64}, {S16, S32}});
getActionDefinitionsBuilder(G_FPEXT)
.legalFor({{S64, S32}, {S32, S16}})

View File

@ -2,12 +2,12 @@
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel %s -o - | FileCheck %s
---
name: test_fptrunc_f64_to_f32
name: test_fptrunc_s64_to_s32
body: |
bb.0:
liveins: $vgpr0_vgpr1
; CHECK-LABEL: name: test_fptrunc_f64_to_f32
; CHECK-LABEL: name: test_fptrunc_s64_to_s32
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
; CHECK: [[FPTRUNC:%[0-9]+]]:_(s32) = G_FPTRUNC [[COPY]](s64)
; CHECK: $vgpr0 = COPY [[FPTRUNC]](s32)
@ -15,3 +15,20 @@ body: |
%1:_(s32) = G_FPTRUNC %0
$vgpr0 = COPY %1
...
---
name: test_fptrunc_s32_to_s16
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_fptrunc_s32_to_s16
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY]](s32)
; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[FPTRUNC]](s16)
; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s16) = G_FPTRUNC %0
%2:_(s32) = G_ANYEXT %1
$vgpr0 = COPY %2
...