[PATCH] D109615: [ARC] Improve code generated for i32 ADDC/ADDE and SUBC/SUBE
Mark Schimmel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 10 13:05:22 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c82db3634c1: [ARC] Improve code generated for i32 ADDC/ADDE and SUBC/SUBE (authored by marksl).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109615/new/
https://reviews.llvm.org/D109615
Files:
llvm/lib/Target/ARC/ARCISelLowering.cpp
llvm/lib/Target/ARC/ARCInstrInfo.td
llvm/test/CodeGen/ARC/alu.ll
Index: llvm/test/CodeGen/ARC/alu.ll
===================================================================
--- llvm/test/CodeGen/ARC/alu.ll
+++ llvm/test/CodeGen/ARC/alu.ll
@@ -253,3 +253,20 @@
ret i64 %v
}
+; CHECK-LABEL: long_long_add
+; CHECK: add.f %r0, %r0, %r2
+; CHECK-NEXT: adc.f %r1, %r1, %r3
+define i64 @long_long_add(i64 inreg %a, i64 inreg %b) #0 {
+entry:
+ %add = add nsw i64 %a, %b
+ ret i64 %add
+}
+
+; CHECK-LABEL: long_long_sub
+; CHECK: sub.f %r0, %r0, %r2
+; CHECK-NEXT: sbc.f %r1, %r1, %r3
+define i64 @long_long_sub(i64 inreg %a, i64 inreg %b) #0 {
+entry:
+ %sub = sub nsw i64 %a, %b
+ ret i64 %sub
+}
Index: llvm/lib/Target/ARC/ARCInstrInfo.td
===================================================================
--- llvm/lib/Target/ARC/ARCInstrInfo.td
+++ llvm/lib/Target/ARC/ARCInstrInfo.td
@@ -328,6 +328,11 @@
defm : MultiPat<mulhs, MPYM_rrr, MPYM_rru6, MPYM_rrlimm>;
defm : MultiPat<mulhu, MPYMU_rrr, MPYMU_rru6, MPYMU_rrlimm>;
+defm : MultiPat<addc, ADD_f_rrr, ADD_f_rru6, ADD_f_rrlimm>;
+defm : MultiPat<adde, ADC_f_rrr, ADC_f_rru6, ADC_f_rrlimm>;
+defm : MultiPat<subc, SUB_f_rrr, SUB_f_rru6, SUB_f_rrlimm>;
+defm : MultiPat<sube, SBC_f_rrr, SBC_f_rru6, SBC_f_rrlimm>;
+
// ---------------------------------------------------------------------------
// Unary Instruction definitions.
// ---------------------------------------------------------------------------
Index: llvm/lib/Target/ARC/ARCISelLowering.cpp
===================================================================
--- llvm/lib/Target/ARC/ARCISelLowering.cpp
+++ llvm/lib/Target/ARC/ARCISelLowering.cpp
@@ -121,6 +121,11 @@
setOperationAction(ISD::SMAX, MVT::i32, Legal);
setOperationAction(ISD::SMIN, MVT::i32, Legal);
+ setOperationAction(ISD::ADDC, MVT::i32, Legal);
+ setOperationAction(ISD::ADDE, MVT::i32, Legal);
+ setOperationAction(ISD::SUBC, MVT::i32, Legal);
+ setOperationAction(ISD::SUBE, MVT::i32, Legal);
+
// Need barrel shifter.
setOperationAction(ISD::SHL, MVT::i32, Legal);
setOperationAction(ISD::SRA, MVT::i32, Legal);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109615.371995.patch
Type: text/x-patch
Size: 2081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210910/1eda11a2/attachment.bin>
More information about the llvm-commits
mailing list