1 ; This test check if redundant truncate for eq/ne cmp is skipped during code gen.
2 ;RUN: llc -mtriple=thumbv7-eabi < %s | FileCheck %s
4 define void @test_zero(i16 signext %x) optsize {
5 ;CHECK-LABEL: test_zero
7 %tobool = icmp eq i16 %x, 0
8 br i1 %tobool, label %if.else, label %if.then
9 ;CHECK-NOT: movw {{.*}}, #65535
11 if.then: ; preds = %entry
12 tail call void bitcast (void (...)* @foo1 to void ()*)()
15 if.else: ; preds = %entry
16 tail call void bitcast (void (...)* @foo2 to void ()*)()
19 if.end: ; preds = %if.else, %if.then
23 define void @test_i8_nonzero(i18 signext %x) optsize {
24 ;CHECK-LABEL: test_i8_nonzero
26 %tobool = icmp eq i18 %x, 150
27 br i1 %tobool, label %if.else, label %if.then
29 ;CHECK: cmp r{{[0-9]+}}, #150
30 if.then: ; preds = %entry
31 tail call void bitcast (void (...)* @foo1 to void ()*)()
34 if.else: ; preds = %entry
35 tail call void bitcast (void (...)* @foo2 to void ()*)()
38 if.end: ; preds = %if.else, %if.then
42 define void @test_i8_i16(i8 signext %x) optsize {
43 ;CHECK-LABEL: test_i8_i16
45 %x16 = sext i8 %x to i16
46 %tobool = icmp eq i16 %x16, 300
47 br i1 %tobool, label %if.else, label %if.then
48 ;CHECK-NOT: uxth r0, r0
49 ;CHECK: cmp.w r0, #300
50 if.then: ; preds = %entry
51 tail call void bitcast (void (...)* @foo1 to void ()*)()
54 if.else: ; preds = %entry
55 tail call void bitcast (void (...)* @foo2 to void ()*)()
58 if.end: ; preds = %if.else, %if.then
62 define void @test_i16_i8(i16 signext %x) optsize {
63 ;CHECK-LABEL: test_i16_i8
65 ;CHECK: uxtb [[REG:r[0-9+]]], r0
66 ;CHECK: cmp [[REG]], #128
67 %x8 = trunc i16 %x to i8
68 %tobool = icmp eq i8 %x8, 128
69 br i1 %tobool, label %if.else, label %if.then
70 if.then: ; preds = %entry
71 tail call void bitcast (void (...)* @foo1 to void ()*)()
74 if.else: ; preds = %entry
75 tail call void bitcast (void (...)* @foo2 to void ()*)()
78 if.end: ; preds = %if.else, %if.then
82 define void @test_zext_zero(i16 zeroext %x) optsize {
83 ;CHECK-LABEL: test_zext_zero
85 %tobool = icmp eq i16 %x, 0
86 br i1 %tobool, label %if.else, label %if.then
87 ;CHECK-NOT: movw {{.*}}, #65535
89 if.then: ; preds = %entry
90 tail call void bitcast (void (...)* @foo1 to void ()*)()
93 if.else: ; preds = %entry
94 tail call void bitcast (void (...)* @foo2 to void ()*)()
97 if.end: ; preds = %if.else, %if.then
102 declare void @foo1(...)
103 declare void @foo2(...)