[llvm-commits] [llvm] r120022 - in /llvm/trunk: lib/Target/CellSPU/SPUISelLowering.cpp test/CodeGen/CellSPU/div_ops.ll

Kalle Raiskila kalle.raiskila at nokia.com
Tue Nov 23 05:27:59 PST 2010


Author: kraiskil
Date: Tue Nov 23 07:27:59 2010
New Revision: 120022

URL: http://llvm.org/viewvc/llvm-project?rev=120022&view=rev
Log:
Division by pow-of-2 is not cheap on SPU, do it with 
shifts.

Added:
    llvm/trunk/test/CodeGen/CellSPU/div_ops.ll
Modified:
    llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp

Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=120022&r1=120021&r2=120022&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Tue Nov 23 07:27:59 2010
@@ -97,8 +97,6 @@
 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);

Added: llvm/trunk/test/CodeGen/CellSPU/div_ops.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/div_ops.ll?rev=120022&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/CellSPU/div_ops.ll (added)
+++ llvm/trunk/test/CodeGen/CellSPU/div_ops.ll Tue Nov 23 07:27:59 2010
@@ -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
+}
+





More information about the llvm-commits mailing list