[llvm-commits] [llvm] r96734 - in /llvm/trunk: lib/Target/MSP430/MSP430ISelLowering.cpp test/CodeGen/MSP430/setcc.ll
Anton Korobeynikov
asl at math.spbu.ru
Sun Feb 21 04:28:58 PST 2010
Author: asl
Date: Sun Feb 21 06:28:58 2010
New Revision: 96734
URL: http://llvm.org/viewvc/llvm-project?rev=96734&view=rev
Log:
IT turns out that during jumpless setcc lowering eq and ne were swapped.
This fixes PR6348
Modified:
llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
llvm/trunk/test/CodeGen/MSP430/setcc.ll
Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=96734&r1=96733&r2=96734&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Sun Feb 21 06:28:58 2010
@@ -795,18 +795,15 @@
if (andCC) {
// C = ~Z, thus Res = SRW & 1, no processing is required
} else {
- // Res = (SRW >> 1) & 1
+ // Res = ~((SRW >> 1) & 1)
Shift = true;
+ Invert = true;
}
break;
case MSP430CC::COND_E:
- if (andCC) {
- // C = ~Z, thus Res = ~(SRW & 1)
- } else {
- // Res = ~((SRW >> 1) & 1)
- Shift = true;
- }
- Invert = true;
+ Shift = true;
+ // C = ~Z for AND instruction, thus we can put Res = ~(SRW & 1), however,
+ // Res = (SRW >> 1) & 1 is 1 word shorter.
break;
}
EVT VT = Op.getValueType();
Modified: llvm/trunk/test/CodeGen/MSP430/setcc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MSP430/setcc.ll?rev=96734&r1=96733&r2=96734&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MSP430/setcc.ll (original)
+++ llvm/trunk/test/CodeGen/MSP430/setcc.ll Sun Feb 21 06:28:58 2010
@@ -10,9 +10,9 @@
}
; CHECK: sccweqand:
; CHECK: bit.w r14, r15
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: and.w #1, r15
-; CHECK-NEXT: xor.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: rra.w r15
+; CHECK: and.w #1, r15
define i16 @sccwneand(i16 %a, i16 %b) nounwind {
%t1 = and i16 %a, %b
@@ -22,8 +22,8 @@
}
; CHECK: sccwneand:
; CHECK: bit.w r14, r15
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: and.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: and.w #1, r15
define i16 @sccwne(i16 %a, i16 %b) nounwind {
%t1 = icmp ne i16 %a, %b
@@ -32,9 +32,10 @@
}
; CHECK:sccwne:
; CHECK: cmp.w r14, r15
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: rra.w r15
-; CHECK-NEXT: and.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: rra.w r15
+; CHECK: and.w #1, r15
+; CHECK: xor.w #1, r15
define i16 @sccweq(i16 %a, i16 %b) nounwind {
%t1 = icmp eq i16 %a, %b
@@ -43,10 +44,9 @@
}
; CHECK:sccweq:
; CHECK: cmp.w r14, r15
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: rra.w r15
-; CHECK-NEXT: and.w #1, r15
-; CHECK-NEXT: xor.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: rra.w r15
+; CHECK: and.w #1, r15
define i16 @sccwugt(i16 %a, i16 %b) nounwind {
%t1 = icmp ugt i16 %a, %b
@@ -55,9 +55,9 @@
}
; CHECK:sccwugt:
; CHECK: cmp.w r15, r14
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: and.w #1, r15
-; CHECK-NEXT: xor.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: and.w #1, r15
+; CHECK: xor.w #1, r15
define i16 @sccwuge(i16 %a, i16 %b) nounwind {
%t1 = icmp uge i16 %a, %b
@@ -66,8 +66,8 @@
}
; CHECK:sccwuge:
; CHECK: cmp.w r14, r15
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: and.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: and.w #1, r15
define i16 @sccwult(i16 %a, i16 %b) nounwind {
%t1 = icmp ult i16 %a, %b
@@ -76,9 +76,9 @@
}
; CHECK:sccwult:
; CHECK: cmp.w r14, r15
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: and.w #1, r15
-; CHECK-NEXT: xor.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: and.w #1, r15
+; CHECK: xor.w #1, r15
define i16 @sccwule(i16 %a, i16 %b) nounwind {
%t1 = icmp ule i16 %a, %b
@@ -87,8 +87,8 @@
}
; CHECK:sccwule:
; CHECK: cmp.w r15, r14
-; CHECK-NEXT: mov.w r2, r15
-; CHECK-NEXT: and.w #1, r15
+; CHECK: mov.w r2, r15
+; CHECK: and.w #1, r15
define i16 @sccwsgt(i16 %a, i16 %b) nounwind {
%t1 = icmp sgt i16 %a, %b
More information about the llvm-commits
mailing list