AMDGPU/GlobalISel: Legalize more fp<->int conversions

llvm-svn: 351767
This commit is contained in:
Matt Arsenault 2019-01-22 00:20:17 +00:00
parent dec3ae0936
commit 7bd184dc17
5 changed files with 94 additions and 17 deletions

View File

@ -163,17 +163,11 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST,
.legalFor({{S64, S32}, {S32, S16}, {S64, S16},
{S32, S1}, {S64, S1}, {S16, S1}});
setAction({G_FPTOSI, S32}, Legal);
setAction({G_FPTOSI, 1, S32}, Legal);
getActionDefinitionsBuilder({G_SITOFP, G_UITOFP})
.legalFor({{S32, S32}, {S64, S32}});
setAction({G_SITOFP, S32}, Legal);
setAction({G_SITOFP, 1, S32}, Legal);
setAction({G_UITOFP, S32}, Legal);
setAction({G_UITOFP, 1, S32}, Legal);
setAction({G_FPTOUI, S32}, Legal);
setAction({G_FPTOUI, 1, S32}, Legal);
getActionDefinitionsBuilder({G_FPTOSI, G_FPTOUI})
.legalFor({{S32, S32}, {S32, S64}});
setAction({G_FPOW, S32}, Legal);
setAction({G_FEXP2, S32}, Legal);

View File

@ -2,13 +2,25 @@
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer %s -o - | FileCheck %s
---
name: test_fptosi_f32_to_i32
name: test_fptosi_s32_to_s32
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_fptosi_f32_to_i32
; CHECK-LABEL: name: test_fptosi_s32_to_s32
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
%0:_(s32) = COPY $vgpr0
%1:_(s32) = G_FPTOSI %0
...
---
name: test_fptosi_s64_to_s32
body: |
bb.0:
liveins: $vgpr0_vgpr1
; CHECK-LABEL: name: test_fptosi_s64_to_s32
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
%0:_(s64) = COPY $vgpr0_vgpr1
%1:_(s32) = G_FPTOSI %0
...

View File

@ -1,14 +1,33 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -run-pass=legalizer %s -o - | FileCheck %s
---
name: test_fptoui
name: test_fptoui_s32_s32
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_fptoui
; CHECK: %1:_(s32) = G_FPTOUI %0
; CHECK-LABEL: name: test_fptoui_s32_s32
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[FPTOUI:%[0-9]+]]:_(s32) = G_FPTOUI [[COPY]](s32)
; CHECK: $vgpr0 = COPY [[FPTOUI]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s32) = G_FPTOUI %0
$vgpr0 = COPY %1
...
---
name: test_fptoui_s32_s64
body: |
bb.0:
liveins: $vgpr0_vgpr1
; CHECK-LABEL: name: test_fptoui_s32_s64
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
; CHECK: [[FPTOUI:%[0-9]+]]:_(s32) = G_FPTOUI [[COPY]](s64)
; CHECK: $vgpr0 = COPY [[FPTOUI]](s32)
%0:_(s64) = COPY $vgpr0_vgpr1
%1:_(s32) = G_FPTOUI %0
$vgpr0 = COPY %1
...

View File

@ -2,13 +2,32 @@
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel %s -o - | FileCheck %s
---
name: test_sitofp_f32_to_i32
name: test_sitofp_s32_to_s32
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_sitofp_f32_to_i32
; CHECK-LABEL: name: test_sitofp_s32_to_s32
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s32)
; CHECK: $vgpr0 = COPY [[SITOFP]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s32) = G_SITOFP %0
$vgpr0 = COPY %1
...
---
name: test_sitofp_s32_to_s64
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_sitofp_s32_to_s64
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[COPY]](s32)
; CHECK: $vgpr0_vgpr1 = COPY [[SITOFP]](s64)
%0:_(s32) = COPY $vgpr0
%1:_(s64) = G_SITOFP %0
$vgpr0_vgpr1 = COPY %1
...

View File

@ -0,0 +1,33 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel %s -o - | FileCheck %s
---
name: test_uitofp_s32_to_s32
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_uitofp_s32_to_s32
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s32)
; CHECK: $vgpr0 = COPY [[UITOFP]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s32) = G_UITOFP %0
$vgpr0 = COPY %1
...
---
name: test_uitofp_s32_to_s64
body: |
bb.0:
liveins: $vgpr0
; CHECK-LABEL: name: test_uitofp_s32_to_s64
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
; CHECK: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[COPY]](s32)
; CHECK: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
%0:_(s32) = COPY $vgpr0
%1:_(s64) = G_UITOFP %0
$vgpr0_vgpr1 = COPY %1
...