From: Quentin Colombet Date: Mon, 16 Oct 2017 22:28:38 +0000 (+0000) Subject: [AArch64][RegisterBankInfo] Add mapping support for G_BITCAST of s128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4ffbabdc0c427086b7046ba13e1e7450689b9cc;p=llvm [AArch64][RegisterBankInfo] Add mapping support for G_BITCAST of s128 Anything bigger than 64-bit just map to FPR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315946 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp index 3c505fcec16..04306d63581 100644 --- a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp +++ b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp @@ -455,8 +455,8 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { LLT DstTy = MRI.getType(MI.getOperand(0).getReg()); LLT SrcTy = MRI.getType(MI.getOperand(1).getReg()); unsigned Size = DstTy.getSizeInBits(); - bool DstIsGPR = !DstTy.isVector(); - bool SrcIsGPR = !SrcTy.isVector(); + bool DstIsGPR = !DstTy.isVector() && DstTy.getSizeInBits() <= 64; + bool SrcIsGPR = !SrcTy.isVector() && SrcTy.getSizeInBits() <= 64; const RegisterBank &DstRB = DstIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank; const RegisterBank &SrcRB = diff --git a/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir b/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir index 296f65c041a..1d4781a9d98 100644 --- a/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir +++ b/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir @@ -66,6 +66,7 @@ define void @bitcast_s64_fpr() { ret void } define void @bitcast_s64_gpr_fpr() { ret void } define void @bitcast_s64_fpr_gpr() { ret void } + define void @bitcast_s128() { ret void } define i64 @greedyWithChainOfComputation(i64 %arg1, <2 x i32>* %addr) { %varg1 = bitcast i64 %arg1 to <2 x i32> @@ -615,6 +616,32 @@ body: | %1(s64) = G_BITCAST %0 ... +--- +# CHECK-LABEL: name: bitcast_s128 +name: bitcast_s128 +legalized: true +tracksRegLiveness: true +registers: + - { id: 0, class: _} + - { id: 1, class: _} + - { id: 2, class: _} + - { id: 3, class: _} +# CHECK: registers: +# CHECK: - { id: 2, class: fpr, preferred-register: '' } +# CHECK: - { id: 3, class: fpr, preferred-register: '' } +# CHECK: %2(<2 x s64>) = G_BITCAST %3(s128) +body: | + bb.1: + liveins: %x0, %x1 + %0(s64) = COPY %x0 + %1(s64) = COPY %x1 + %3(s128) = G_MERGE_VALUES %0(s64), %1(s64) + %2(<2 x s64>) = G_BITCAST %3(s128) + %q0 = COPY %2(<2 x s64>) + RET_ReallyLR implicit %q0 + +... + --- # Make sure the greedy mode is able to take advantage of the # alternative mappings of G_LOAD to coalesce the whole chain