1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=msp430-- -msp430-no-legal-immediate=true < %s | FileCheck %s
3
4; Test case for the following transformation in TargetLowering::SimplifySetCC
5; (X & -256) == 256 -> (X >> 8) == 1
6define i16 @testSimplifySetCC_2(i16 %x) {
7; CHECK-LABEL: testSimplifySetCC_2:
8; CHECK:       ; %bb.0: ; %entry
9; CHECK-NEXT:    and #-64, r12
10; CHECK-NEXT:    cmp #64, r12
11; CHECK-NEXT:    mov r2, r12
12; CHECK-NEXT:    rra r12
13; CHECK-NEXT:    and #1, r12
14; CHECK-NEXT:    ret
15entry:
16  %and = and i16 %x, -64
17  %cmp = icmp eq i16 %and, 64
18  %conv = zext i1 %cmp to i16
19  ret i16 %conv
20}
21
22; Test case for the following transformation in TargetLowering::SimplifySetCC
23; X >  0x0ffffffff -> (X >> 32) >= 1
24define i16 @testSimplifySetCC_3(i16 %x) {
25; CHECK-LABEL: testSimplifySetCC_3:
26; CHECK:       ; %bb.0: ; %entry
27; CHECK-NEXT:    cmp #64, r12
28; CHECK-NEXT:    mov r2, r12
29; CHECK-NEXT:    and #1, r12
30; CHECK-NEXT:    ret
31entry:
32  %cmp = icmp ugt i16 %x, 63
33  %conv = zext i1 %cmp to i16
34  ret i16 %conv
35}
36
37; Test case for the following transformation in TargetLowering::SimplifySetCC
38; X <  0x100000000 -> (X >> 32) <  1
39define i16 @testSimplifySetCC_4(i16 %x) {
40; CHECK-LABEL: testSimplifySetCC_4:
41; CHECK:       ; %bb.0: ; %entry
42; CHECK-NEXT:    cmp #64, r12
43; CHECK-NEXT:    mov #1, r12
44; CHECK-NEXT:    bic r2, r12
45; CHECK-NEXT:    ret
46entry:
47  %cmp = icmp ult i16 %x, 64
48  %conv = zext i1 %cmp to i16
49  ret i16 %conv
50}
51