mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-24 07:35:04 +00:00
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
This commit is contained in:
parent
beb6898df8
commit
0cc5b1f60e
@ -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);
|
||||
|
22
test/CodeGen/CellSPU/div_ops.ll
Normal file
22
test/CodeGen/CellSPU/div_ops.ll
Normal file
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user