From 52f6f63fbd1339c08b982355b62b85dc344add50 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 9 Sep 2009 06:05:16 +0000 Subject: [PATCH] Cast MO.getImm() to unsigned before comparing with an unsigned limit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81318 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/Thumb2SizeReduction.cpp | 2 +- test/CodeGen/Thumb2/thumb2-cmp.ll | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Target/ARM/Thumb2SizeReduction.cpp b/lib/Target/ARM/Thumb2SizeReduction.cpp index 0784fbed88..e1fb3585f7 100644 --- a/lib/Target/ARM/Thumb2SizeReduction.cpp +++ b/lib/Target/ARM/Thumb2SizeReduction.cpp @@ -504,7 +504,7 @@ Thumb2SizeReduce::ReduceToNarrow(MachineBasicBlock &MBB, MachineInstr *MI, return false; } else if (MO.isImm() && !TID.OpInfo[i].isPredicate()) { - if (MO.getImm() > Limit || (MO.getImm() & (Scale-1)) != 0) + if (((unsigned)MO.getImm()) > Limit || (MO.getImm() & (Scale-1)) != 0) return false; } } diff --git a/test/CodeGen/Thumb2/thumb2-cmp.ll b/test/CodeGen/Thumb2/thumb2-cmp.ll index 86fc542f25..d4773bb580 100644 --- a/test/CodeGen/Thumb2/thumb2-cmp.ll +++ b/test/CodeGen/Thumb2/thumb2-cmp.ll @@ -19,7 +19,7 @@ define i1 @f2(i32 %a) { ; 0xcc00cc00 = 3422604288 define i1 @f3(i32 %a) { ; CHECK: f3: -; CHECK: cmp r0, #-872363008 +; CHECK: cmp.w r0, #-872363008 %tmp = icmp ne i32 %a, 3422604288 ret i1 %tmp } @@ -27,7 +27,7 @@ define i1 @f3(i32 %a) { ; 0xdddddddd = 3722304989 define i1 @f4(i32 %a) { ; CHECK: f4: -; CHECK: cmp r0, #-572662307 +; CHECK: cmp.w r0, #-572662307 %tmp = icmp ne i32 %a, 3722304989 ret i1 %tmp } -- 2.11.4.GIT