forked from OSchip/llvm-project
[AArch64][GlobalISel] Widen G_FPTO*I before clamping
Going through our legalization rules and doing some cleanup. Widening and then clamping is usually easier than clamping and then widening. This allows us to legalize some weird types like s88. Differential Revision: https://reviews.llvm.org/D107413
This commit is contained in:
parent
6660cec568
commit
7d97de60b3
|
@ -459,10 +459,10 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
|
|||
// Conversions
|
||||
getActionDefinitionsBuilder({G_FPTOSI, G_FPTOUI})
|
||||
.legalForCartesianProduct({s32, s64, v2s64, v4s32, v2s32})
|
||||
.clampScalar(0, s32, s64)
|
||||
.widenScalarToNextPow2(0)
|
||||
.clampScalar(1, s32, s64)
|
||||
.widenScalarToNextPow2(1);
|
||||
.clampScalar(0, s32, s64)
|
||||
.widenScalarToNextPow2(1)
|
||||
.clampScalar(1, s32, s64);
|
||||
|
||||
getActionDefinitionsBuilder({G_SITOFP, G_UITOFP})
|
||||
.legalForCartesianProduct({s32, s64, v2s64, v4s32, v2s32})
|
||||
|
|
|
@ -266,3 +266,48 @@ body: |
|
|||
%1:_(s128) = G_FPTOSI %0
|
||||
$q0 = COPY %1
|
||||
...
|
||||
---
|
||||
name: test_fptosi_s88_s88
|
||||
body: |
|
||||
bb.0:
|
||||
liveins: $x0
|
||||
; CHECK-LABEL: name: test_fptosi_s88_s88
|
||||
; CHECK: [[DEF:%[0-9]+]]:_(s88) = G_IMPLICIT_DEF
|
||||
; CHECK: [[FPTOSI:%[0-9]+]]:_(s128) = G_FPTOSI [[DEF]](s88)
|
||||
; CHECK: [[TRUNC:%[0-9]+]]:_(s88) = G_TRUNC [[FPTOSI]](s128)
|
||||
; CHECK: %trunc:_(s64) = G_TRUNC [[TRUNC]](s88)
|
||||
; CHECK: $x0 = COPY %trunc(s64)
|
||||
%0:_(s88) = G_IMPLICIT_DEF
|
||||
%1:_(s88) = G_FPTOSI %0
|
||||
%trunc:_(s64) = G_TRUNC %1
|
||||
$x0 = COPY %trunc
|
||||
...
|
||||
---
|
||||
name: test_fptosi_s88_s64
|
||||
body: |
|
||||
bb.0:
|
||||
liveins: $x0
|
||||
; CHECK-LABEL: name: test_fptosi_s88_s64
|
||||
; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
|
||||
; CHECK: [[FPTOSI:%[0-9]+]]:_(s128) = G_FPTOSI [[DEF]](s64)
|
||||
; CHECK: [[TRUNC:%[0-9]+]]:_(s88) = G_TRUNC [[FPTOSI]](s128)
|
||||
; CHECK: %trunc:_(s64) = G_TRUNC [[TRUNC]](s88)
|
||||
; CHECK: $x0 = COPY %trunc(s64)
|
||||
%0:_(s64) = G_IMPLICIT_DEF
|
||||
%1:_(s88) = G_FPTOSI %0
|
||||
%trunc:_(s64) = G_TRUNC %1
|
||||
$x0 = COPY %trunc
|
||||
...
|
||||
---
|
||||
name: test_fptosi_s64_s88
|
||||
body: |
|
||||
bb.0:
|
||||
liveins: $x0
|
||||
; CHECK-LABEL: name: test_fptosi_s64_s88
|
||||
; CHECK: [[DEF:%[0-9]+]]:_(s88) = G_IMPLICIT_DEF
|
||||
; CHECK: [[FPEXT:%[0-9]+]]:_(s128) = G_FPEXT [[DEF]](s88)
|
||||
; CHECK: [[FPTOSI:%[0-9]+]]:_(s64) = G_FPTOSI [[FPEXT]](s128)
|
||||
; CHECK: $x0 = COPY [[FPTOSI]](s64)
|
||||
%0:_(s88) = G_IMPLICIT_DEF
|
||||
%1:_(s64) = G_FPTOSI %0
|
||||
$x0 = COPY %1
|
||||
|
|
Loading…
Reference in New Issue