diff --git a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp --- a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp @@ -527,6 +527,8 @@ case TargetOpcode::G_UITOFP: case TargetOpcode::G_EXTRACT_VECTOR_ELT: case TargetOpcode::G_INSERT_VECTOR_ELT: + case TargetOpcode::G_BUILD_VECTOR: + case TargetOpcode::G_BUILD_VECTOR_TRUNC: return true; default: break; @@ -880,7 +882,8 @@ })) break; if (isPreISelGenericFloatingPointOpcode(DefOpc) || - SrcTy.getSizeInBits() < 32) { + SrcTy.getSizeInBits() < 32 || + getRegBank(VReg, MRI, TRI) == &AArch64::FPRRegBank) { // Have a floating point op. // Make sure every operand gets mapped to a FPR register class. unsigned NumOperands = MI.getNumOperands(); diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-build-vector.mir b/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-build-vector.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-build-vector.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-build-vector.mir @@ -69,3 +69,43 @@ RET_ReallyLR implicit $q0 ... +--- +name: fed_by_fp_load +alignment: 4 +legalized: true +tracksRegLiveness: true +liveins: + - { reg: '$x0' } + - { reg: '$x1' } + - { reg: '$x2' } + - { reg: '$s0' } +frameInfo: + maxAlignment: 1 +body: | + bb.1: + liveins: $s0, $x0, $x1, $x2 + + ; CHECK-LABEL: name: fed_by_fp_load + ; CHECK: liveins: $s0, $x0, $x1, $x2 + ; CHECK: [[COPY:%[0-9]+]]:gpr(p0) = COPY $x0 + ; CHECK: [[C:%[0-9]+]]:gpr(s64) = G_CONSTANT i64 328 + ; CHECK: [[PTR_ADD:%[0-9]+]]:gpr(p0) = G_PTR_ADD [[COPY]], [[C]](s64) + ; CHECK: [[C1:%[0-9]+]]:gpr(s64) = G_CONSTANT i64 344 + ; CHECK: [[PTR_ADD1:%[0-9]+]]:gpr(p0) = G_PTR_ADD [[COPY]], [[C1]](s64) + ; CHECK: [[LOAD:%[0-9]+]]:fpr(s32) = G_LOAD [[PTR_ADD]](p0) :: (load 4) + ; CHECK: [[LOAD1:%[0-9]+]]:fpr(s32) = G_LOAD [[PTR_ADD1]](p0) :: (load 4) + ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:fpr(<2 x s32>) = G_BUILD_VECTOR [[LOAD]](s32), [[LOAD1]](s32) + ; CHECK: $d0 = COPY [[BUILD_VECTOR]](<2 x s32>) + ; CHECK: RET_ReallyLR implicit $d0 + %0:_(p0) = COPY $x0 + %4:_(s64) = G_CONSTANT i64 328 + %5:_(p0) = G_PTR_ADD %0, %4(s64) + %6:_(s64) = G_CONSTANT i64 344 + %7:_(p0) = G_PTR_ADD %0, %6(s64) + %15:_(s32) = G_LOAD %5(p0) :: (load 4) + %20:_(s32) = G_LOAD %7(p0) :: (load 4) + %21:_(<2 x s32>) = G_BUILD_VECTOR %15(s32), %20(s32) + $d0 = COPY %21(<2 x s32>) + RET_ReallyLR implicit $d0 + +...