namespace llvm {
namespace ARM {
RegisterBankInfo::PartialMapping GPRPartialMapping{0, 32, GPRRegBank};
-RegisterBankInfo::PartialMapping FPRPartialMapping{0, 32, FPRRegBank};
+RegisterBankInfo::PartialMapping SPRPartialMapping{0, 32, FPRRegBank};
+RegisterBankInfo::PartialMapping DPRPartialMapping{0, 64, FPRRegBank};
+// FIXME: Add the mapping for S(2n+1) as {32, 64, FPRRegBank}
RegisterBankInfo::ValueMapping ValueMappings[] = {
{&GPRPartialMapping, 1}, {&GPRPartialMapping, 1}, {&GPRPartialMapping, 1},
- {&FPRPartialMapping, 1}, {&FPRPartialMapping, 1}, {&FPRPartialMapping, 1}};
+ {&SPRPartialMapping, 1}, {&SPRPartialMapping, 1}, {&SPRPartialMapping, 1},
+ {&DPRPartialMapping, 1}, {&DPRPartialMapping, 1}, {&DPRPartialMapping, 1}};
} // end namespace arm
} // end namespace llvm
return getRegBank(ARM::GPRRegBankID);
case SPR_8RegClassID:
case SPRRegClassID:
+ case DPR_8RegClassID:
+ case DPRRegClassID:
return getRegBank(ARM::FPRRegBankID);
default:
llvm_unreachable("Unsupported register kind");
using namespace TargetOpcode;
+ const MachineFunction &MF = *MI.getParent()->getParent();
+ const MachineRegisterInfo &MRI = MF.getRegInfo();
+ LLT Ty = MRI.getType(MI.getOperand(0).getReg());
+
unsigned NumOperands = MI.getNumOperands();
const ValueMapping *OperandsMapping = &ARM::ValueMappings[0];
switch (Opc) {
case G_ADD:
- case G_LOAD:
case G_SEXT:
case G_ZEXT:
// FIXME: We're abusing the fact that everything lives in a GPR for now; in
// the real world we would use different mappings.
OperandsMapping = &ARM::ValueMappings[0];
break;
+ case G_LOAD:
+ OperandsMapping = Ty.getSizeInBits() == 64
+ ? getOperandsMapping({&ARM::ValueMappings[6],
+ &ARM::ValueMappings[0]})
+ : &ARM::ValueMappings[0];
+ break;
case G_FADD:
- OperandsMapping = &ARM::ValueMappings[3];
+ assert((Ty.getSizeInBits() == 32 || Ty.getSizeInBits() == 64) &&
+ "Unsupported size for G_FADD");
+ OperandsMapping = Ty.getSizeInBits() == 64 ? &ARM::ValueMappings[6]
+ : &ARM::ValueMappings[3];
break;
case G_FRAME_INDEX:
OperandsMapping = getOperandsMapping({&ARM::ValueMappings[0], nullptr});
define void @test_loads() { ret void }
define void @test_fadd_s32() { ret void }
+ define void @test_fadd_s64() { ret void }
...
---
name: test_add_s32
# CHECK: - { id: 3, class: gprb }
# CHECK: - { id: 4, class: gprb }
# CHECK: - { id: 5, class: gprb }
+# CHECK: - { id: 6, class: fprb }
registers:
- { id: 0, class: _ }
- { id: 3, class: _ }
- { id: 4, class: _ }
- { id: 5, class: _ }
+ - { id: 6, class: _ }
body: |
bb.0:
liveins: %r0
%0(p0) = COPY %r0
+ %6(s64) = G_LOAD %0
%1(s32) = G_LOAD %0
%2(s16) = G_LOAD %0
%3(s8) = G_LOAD %0
- { id: 2, class: _ }
body: |
bb.0:
- liveins: %r0, %r1
+ liveins: %s0, %s1
%0(s32) = COPY %s0
%1(s32) = COPY %s1
%2(s32) = G_FADD %0, %1
%s0 = COPY %2(s32)
- BX_RET 14, _, implicit %r0
+ BX_RET 14, _, implicit %s0
+
+...
+---
+name: test_fadd_s64
+# CHECK-LABEL: name: test_fadd_s64
+legalized: true
+regBankSelected: false
+selected: false
+# CHECK: registers:
+# CHECK: - { id: 0, class: fprb }
+# CHECK: - { id: 1, class: fprb }
+# CHECK: - { id: 2, class: fprb }
+
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+body: |
+ bb.0:
+ liveins: %d0, %d1
+
+ %0(s64) = COPY %d0
+ %1(s64) = COPY %d1
+ %2(s64) = G_FADD %0, %1
+ %d0 = COPY %2(s64)
+ BX_RET 14, _, implicit %d0
+
+...
...