[llvm] r283832 - [AArch64][InstructionSelector] Teach how to select FP load/store.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 17:21:14 PDT 2016
Author: qcolombet
Date: Mon Oct 10 19:21:14 2016
New Revision: 283832
URL: http://llvm.org/viewvc/llvm-project?rev=283832&view=rev
Log:
[AArch64][InstructionSelector] Teach how to select FP load/store.
This patch allows to select 32 and 64-bit FP load and store.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir
Modified: llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp?rev=283832&r1=283831&r2=283832&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp Mon Oct 10 19:21:14 2016
@@ -201,6 +201,13 @@ static unsigned selectLoadStoreUIOp(unsi
case 64:
return isStore ? AArch64::STRXui : AArch64::LDRXui;
}
+ case AArch64::FPRRegBankID:
+ switch (OpSize) {
+ case 32:
+ return isStore ? AArch64::STRSui : AArch64::LDRSui;
+ case 64:
+ return isStore ? AArch64::STRDui : AArch64::LDRDui;
+ }
};
return GenericOpc;
}
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir?rev=283832&r1=283831&r2=283832&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir Mon Oct 10 19:21:14 2016
@@ -57,9 +57,13 @@
define void @load_s64_gpr(i64* %addr) { ret void }
define void @load_s32_gpr(i32* %addr) { ret void }
+ define void @load_s64_fpr(i64* %addr) { ret void }
+ define void @load_s32_fpr(i32* %addr) { ret void }
define void @store_s64_gpr(i64* %addr) { ret void }
define void @store_s32_gpr(i32* %addr) { ret void }
+ define void @store_s64_fpr(i64* %addr) { ret void }
+ define void @store_s32_fpr(i32* %addr) { ret void }
define void @frame_index() {
%ptr0 = alloca i64
@@ -1043,6 +1047,56 @@ body: |
...
---
+# CHECK-LABEL: name: load_s64_fpr
+name: load_s64_fpr
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr64sp }
+# CHECK-NEXT: - { id: 1, class: fpr64 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: fpr }
+
+# CHECK: body:
+# CHECK: %0 = COPY %x0
+# CHECK: %1 = LDRDui %0, 0 :: (load 8 from %ir.addr)
+body: |
+ bb.0:
+ liveins: %x0
+
+ %0(p0) = COPY %x0
+ %1(s64) = G_LOAD %0 :: (load 8 from %ir.addr)
+
+...
+
+---
+# CHECK-LABEL: name: load_s32_fpr
+name: load_s32_fpr
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr64sp }
+# CHECK-NEXT: - { id: 1, class: fpr32 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: fpr }
+
+# CHECK: body:
+# CHECK: %0 = COPY %x0
+# CHECK: %1 = LDRSui %0, 0 :: (load 4 from %ir.addr)
+body: |
+ bb.0:
+ liveins: %x0
+
+ %0(p0) = COPY %x0
+ %1(s32) = G_LOAD %0 :: (load 4 from %ir.addr)
+
+...
+
+---
# CHECK-LABEL: name: store_s64_gpr
name: store_s64_gpr
legalized: true
@@ -1095,6 +1149,60 @@ body: |
G_STORE %1, %0 :: (store 4 into %ir.addr)
...
+
+---
+# CHECK-LABEL: name: store_s64_fpr
+name: store_s64_fpr
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr64sp }
+# CHECK-NEXT: - { id: 1, class: fpr64 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: fpr }
+
+# CHECK: body:
+# CHECK: %0 = COPY %x0
+# CHECK: %1 = COPY %d1
+# CHECK: STRDui %1, %0, 0 :: (store 8 into %ir.addr)
+body: |
+ bb.0:
+ liveins: %x0, %d1
+
+ %0(p0) = COPY %x0
+ %1(s64) = COPY %d1
+ G_STORE %1, %0 :: (store 8 into %ir.addr)
+
+...
+
+---
+# CHECK-LABEL: name: store_s32_fpr
+name: store_s32_fpr
+legalized: true
+regBankSelected: true
+
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr64sp }
+# CHECK-NEXT: - { id: 1, class: fpr32 }
+registers:
+ - { id: 0, class: gpr }
+ - { id: 1, class: fpr }
+
+# CHECK: body:
+# CHECK: %0 = COPY %x0
+# CHECK: %1 = COPY %s1
+# CHECK: STRSui %1, %0, 0 :: (store 4 into %ir.addr)
+body: |
+ bb.0:
+ liveins: %x0, %s1
+
+ %0(p0) = COPY %x0
+ %1(s32) = COPY %s1
+ G_STORE %1, %0 :: (store 4 into %ir.addr)
+
+...
---
# CHECK-LABEL: name: frame_index
More information about the llvm-commits
mailing list