aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Raiskila <kalle.raiskila@nokia.com>2010-11-23 13:27:59 +0000
committerKalle Raiskila <kalle.raiskila@nokia.com>2010-11-23 13:27:59 +0000
commit0cc5b1f60e02716cac617959d88d4c412fdb3154 (patch)
treeb3feab55bc9327c224c9425f578487f6279049ad
parentbeb6898df8f96ccea4ae147587479b507bb3e491 (diff)
downloadexternal_llvm-0cc5b1f60e02716cac617959d88d4c412fdb3154.zip
external_llvm-0cc5b1f60e02716cac617959d88d4c412fdb3154.tar.gz
external_llvm-0cc5b1f60e02716cac617959d88d4c412fdb3154.tar.bz2
Division by pow-of-2 is not cheap on SPU, do it with
shifts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120022 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/CellSPU/SPUISelLowering.cpp2
-rw-r--r--test/CodeGen/CellSPU/div_ops.ll22
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/Target/CellSPU/SPUISelLowering.cpp b/lib/Target/CellSPU/SPUISelLowering.cpp
index 014fbbe..0fa511e 100644
--- a/lib/Target/CellSPU/SPUISelLowering.cpp
+++ b/lib/Target/CellSPU/SPUISelLowering.cpp
@@ -97,8 +97,6 @@ namespace {
SPUTargetLowering::SPUTargetLowering(SPUTargetMachine &TM)
: TargetLowering(TM, new TargetLoweringObjectFileELF()),
SPUTM(TM) {
- // Fold away setcc operations if possible.
- setPow2DivIsCheap();
// Use _setjmp/_longjmp instead of setjmp/longjmp.
setUseUnderscoreSetJmp(true);
diff --git a/test/CodeGen/CellSPU/div_ops.ll b/test/CodeGen/CellSPU/div_ops.ll
new file mode 100644
index 0000000..0c93d83
--- /dev/null
+++ b/test/CodeGen/CellSPU/div_ops.ll
@@ -0,0 +1,22 @@
+; RUN: llc --march=cellspu %s -o - | FileCheck %s
+
+; signed division rounds towards zero, rotma don't.
+define i32 @sdivide (i32 %val )
+{
+; CHECK: rotmai
+; CHECK: rotmi
+; CHECK: a
+; CHECK: rotmai
+; CHECK: bi $lr
+ %rv = sdiv i32 %val, 4
+ ret i32 %rv
+}
+
+define i32 @udivide (i32 %val )
+{
+; CHECK: rotmi
+; CHECK: bi $lr
+ %rv = udiv i32 %val, 4
+ ret i32 %rv
+}
+