[llvm-commits] [llvm] r122052 - in /llvm/trunk: lib/Target/CellSPU/SPUOperands.td test/CodeGen/CellSPU/immed32.ll
Kalle Raiskila
kalle.raiskila at nokia.com
Fri Dec 17 01:36:09 PST 2010
Author: kraiskil
Date: Fri Dec 17 03:36:09 2010
New Revision: 122052
URL: http://llvm.org/viewvc/llvm-project?rev=122052&view=rev
Log:
Don't feed 19 bit immediates to ILA.
Patch (slightly modified) by Visa Putkinen.
Modified:
llvm/trunk/lib/Target/CellSPU/SPUOperands.td
llvm/trunk/test/CodeGen/CellSPU/immed32.ll
Modified: llvm/trunk/lib/Target/CellSPU/SPUOperands.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUOperands.td?rev=122052&r1=122051&r2=122052&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUOperands.td (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUOperands.td Fri Dec 17 03:36:09 2010
@@ -143,7 +143,7 @@
def imm18 : PatLeaf<(imm), [{
// imm18 predicate: True if the immediate fits into an 18-bit unsigned field.
int Value = (int) N->getZExtValue();
- return ((Value & ((1 << 19) - 1)) == Value);
+ return isUInt<18>(Value);
}]>;
def lo16 : PatLeaf<(imm), [{
@@ -203,7 +203,7 @@
def FPimm_u18 : SDNodeXForm<fpimm, [{
float fval = N->getValueAPF().convertToFloat();
- return getI32Imm(FloatToBits(fval) & ((1 << 19) - 1));
+ return getI32Imm(FloatToBits(fval) & ((1 << 18) - 1));
}]>;
def fpimmSExt16 : PatLeaf<(fpimm), [{
@@ -225,7 +225,7 @@
def fpimm18 : PatLeaf<(fpimm), [{
if (N->getValueType(0) == MVT::f32) {
uint32_t Value = FloatToBits(N->getValueAPF().convertToFloat());
- return ((Value & ((1 << 19) - 1)) == Value);
+ return isUInt<18>(Value);
}
return false;
Modified: llvm/trunk/test/CodeGen/CellSPU/immed32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/immed32.ll?rev=122052&r1=122051&r2=122052&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/CellSPU/immed32.ll (original)
+++ llvm/trunk/test/CodeGen/CellSPU/immed32.ll Fri Dec 17 03:36:09 2010
@@ -1,6 +1,6 @@
; RUN: llc < %s -march=cellspu > %t1.s
-; RUN: grep ilhu %t1.s | count 8
-; RUN: grep iohl %t1.s | count 6
+; RUN: grep ilhu %t1.s | count 9
+; RUN: grep iohl %t1.s | count 7
; RUN: grep -w il %t1.s | count 3
; RUN: grep 16429 %t1.s | count 1
; RUN: grep 63572 %t1.s | count 1
@@ -12,6 +12,7 @@
; RUN: grep 49077 %t1.s | count 1
; RUN: grep 1267 %t1.s | count 2
; RUN: grep 16309 %t1.s | count 1
+; RUN: cat %t1.s | FileCheck %s
target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
target triple = "spu"
@@ -31,6 +32,16 @@
ret i32 -512 ;; IL via pattern
}
+define i32 @test_5()
+{
+;CHECK: test_5:
+;CHECK-NOT: ila $3, 40000
+;CHECK: ilhu
+;CHECK: iohl
+;CHECK: bi $lr
+ ret i32 400000
+}
+
;; double float floatval
;; 0x4005bf0a80000000 0x402d|f854 2.718282
define float @float_const_1() {
More information about the llvm-commits
mailing list