[PATCH] D15277: [ARMv8-M] [4/9] Add SDIV/UDIV instructions to ARMv8-M Baseline
Bradley Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 4 06:18:26 PST 2016
bsmith updated this revision to Diff 43878.
bsmith added a comment.
Rebase patch against latest trunk changes.
Repository:
rL LLVM
http://reviews.llvm.org/D15277
Files:
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMInstrThumb2.td
test/MC/ARM/thumbv8m.s
Index: test/MC/ARM/thumbv8m.s
===================================================================
--- test/MC/ARM/thumbv8m.s
+++ test/MC/ARM/thumbv8m.s
@@ -21,6 +21,14 @@
// CHECK: isb sy @ encoding: [0xbf,0xf3,0x6f,0x8f]
isb sy
+// 'Code optimization'
+
+// CHECK: sdiv r1, r2, r3 @ encoding: [0x92,0xfb,0xf3,0xf1]
+sdiv r1, r2, r3
+
+// CHECK: udiv r1, r2, r3 @ encoding: [0xb2,0xfb,0xf3,0xf1]
+udiv r1, r2, r3
+
// 'XO generation'
// CHECK: movw r1, #65535 @ encoding: [0x4f,0xf6,0xff,0x71]
Index: lib/Target/ARM/ARMInstrThumb2.td
===================================================================
--- lib/Target/ARM/ARMInstrThumb2.td
+++ lib/Target/ARM/ARMInstrThumb2.td
@@ -2926,7 +2926,7 @@
def t2SDIV : T2ThreeReg<(outs rGPR:$Rd), (ins rGPR:$Rn, rGPR:$Rm), IIC_iDIV,
"sdiv", "\t$Rd, $Rn, $Rm",
[(set rGPR:$Rd, (sdiv rGPR:$Rn, rGPR:$Rm))]>,
- Requires<[HasDivide, IsThumb2]> {
+ Requires<[HasDivide, IsThumb, HasV8MBaseline]> {
let Inst{31-27} = 0b11111;
let Inst{26-21} = 0b011100;
let Inst{20} = 0b1;
@@ -2937,7 +2937,7 @@
def t2UDIV : T2ThreeReg<(outs rGPR:$Rd), (ins rGPR:$Rn, rGPR:$Rm), IIC_iDIV,
"udiv", "\t$Rd, $Rn, $Rm",
[(set rGPR:$Rd, (udiv rGPR:$Rn, rGPR:$Rm))]>,
- Requires<[HasDivide, IsThumb2]> {
+ Requires<[HasDivide, IsThumb, HasV8MBaseline]> {
let Inst{31-27} = 0b11111;
let Inst{26-21} = 0b011101;
let Inst{20} = 0b1;
Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -773,8 +773,9 @@
if (!Subtarget->hasV6Ops())
setOperationAction(ISD::BSWAP, MVT::i32, Expand);
- if (!(Subtarget->hasDivide() && Subtarget->isThumb2()) &&
- !(Subtarget->hasDivideInARMMode() && !Subtarget->isThumb())) {
+ bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivide()
+ : Subtarget->hasDivideInARMMode();
+ if (!hasDivide) {
// These are expanded into libcalls if the cpu doesn't have HW divider.
setOperationAction(ISD::SDIV, MVT::i32, LibCall);
setOperationAction(ISD::UDIV, MVT::i32, LibCall);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15277.43878.patch
Type: text/x-patch
Size: 2319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160104/55e36906/attachment.bin>
More information about the llvm-commits
mailing list