If we have an integer->fp convert that has differing sizes, e.g. s32 to s64,
then don't try to convert it to AArch64::G_SITOF since it won't select.
// Otherwise, it ends up matching an fpr/gpr variant and adding a cross-bank
// copy.
Register SrcReg = I.getOperand(1).getReg();
- if (MRI.getType(SrcReg).isVector())
+ LLT SrcTy = MRI.getType(SrcReg);
+ LLT DstTy = MRI.getType(I.getOperand(0).getReg());
+ if (SrcTy.isVector() || SrcTy.getSizeInBits() != DstTy.getSizeInBits())
return false;
+
if (RBI.getRegBank(SrcReg, MRI, TRI)->getID() == AArch64::FPRRegBankID) {
if (I.getOpcode() == TargetOpcode::G_SITOFP)
I.setDesc(TII.get(AArch64::G_SITOF));
...
---
+name: sitofp_s64_s32_fpr_both
+legalized: true
+regBankSelected: true
+
+registers:
+ - { id: 0, class: fpr }
+ - { id: 1, class: fpr }
+
+body: |
+ bb.0:
+ liveins: $s0
+
+ ; CHECK-LABEL: name: sitofp_s64_s32_fpr
+ ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY $s0
+ ; CHECK: [[COPY2:%[0-9]+]]:gpr32 = COPY [[COPY]]
+ ; CHECK: [[SCVTFUWDri:%[0-9]+]]:fpr64 = SCVTFUWDri [[COPY2]]
+ ; CHECK: $d0 = COPY [[SCVTFUWDri]]
+ %0(s32) = COPY $s0
+ %1(s64) = G_SITOFP %0
+ $d0 = COPY %1(s64)
+...
+
+---
name: sitofp_s64_s64_fpr
legalized: true
regBankSelected: true