Index: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp =================================================================== --- llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp +++ llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp @@ -459,10 +459,10 @@ // 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}) Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir +++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir @@ -266,3 +266,48 @@ %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