1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; This test check if redundant truncate for eq/ne cmp is skipped during code gen.
3 ;RUN: llc -mtriple=thumbv7-eabi < %s | FileCheck %s
5 define void @test_zero(i16 signext %x) optsize {
6 ; CHECK-LABEL: test_zero:
7 ; CHECK: @ %bb.0: @ %entry
8 ; CHECK-NEXT: cbz r0, .LBB0_2
9 ; CHECK-NEXT: @ %bb.1: @ %if.then
11 ; CHECK-NEXT: .LBB0_2: @ %if.else
14 %tobool = icmp eq i16 %x, 0
15 br i1 %tobool, label %if.else, label %if.then
16 if.then: ; preds = %entry
17 tail call void @foo1()
20 if.else: ; preds = %entry
21 tail call void @foo2()
24 if.end: ; preds = %if.else, %if.then
28 define void @test_i8_nonzero(i18 signext %x) optsize {
29 ; CHECK-LABEL: test_i8_nonzero:
30 ; CHECK: @ %bb.0: @ %entry
31 ; CHECK-NEXT: cmp r0, #150
33 ; CHECK-NEXT: beq foo2
34 ; CHECK-NEXT: .LBB1_1: @ %if.then
37 %tobool = icmp eq i18 %x, 150
38 br i1 %tobool, label %if.else, label %if.then
39 if.then: ; preds = %entry
40 tail call void @foo1()
43 if.else: ; preds = %entry
44 tail call void @foo2()
47 if.end: ; preds = %if.else, %if.then
51 define void @test_i8_i16(i8 signext %x) optsize {
52 ; CHECK-LABEL: test_i8_i16:
53 ; CHECK: @ %bb.0: @ %entry
54 ; CHECK-NEXT: cmp.w r0, #300
56 ; CHECK-NEXT: beq foo2
57 ; CHECK-NEXT: .LBB2_1: @ %if.then
60 %x16 = sext i8 %x to i16
61 %tobool = icmp eq i16 %x16, 300
62 br i1 %tobool, label %if.else, label %if.then
63 if.then: ; preds = %entry
64 tail call void @foo1()
67 if.else: ; preds = %entry
68 tail call void @foo2()
71 if.end: ; preds = %if.else, %if.then
75 define void @test_i16_i8(i16 signext %x) optsize {
76 ; CHECK-LABEL: test_i16_i8:
77 ; CHECK: @ %bb.0: @ %entry
78 ; CHECK-NEXT: uxtb r0, r0
79 ; CHECK-NEXT: cmp r0, #128
81 ; CHECK-NEXT: beq foo2
82 ; CHECK-NEXT: .LBB3_1: @ %if.then
85 %x8 = trunc i16 %x to i8
86 %tobool = icmp eq i8 %x8, 128
87 br i1 %tobool, label %if.else, label %if.then
88 if.then: ; preds = %entry
89 tail call void @foo1()
92 if.else: ; preds = %entry
93 tail call void @foo2()
96 if.end: ; preds = %if.else, %if.then
100 define void @test_zext_zero(i16 zeroext %x) optsize {
101 ; CHECK-LABEL: test_zext_zero:
102 ; CHECK: @ %bb.0: @ %entry
103 ; CHECK-NEXT: cbz r0, .LBB4_2
104 ; CHECK-NEXT: @ %bb.1: @ %if.then
106 ; CHECK-NEXT: .LBB4_2: @ %if.else
109 %tobool = icmp eq i16 %x, 0
110 br i1 %tobool, label %if.else, label %if.then
111 if.then: ; preds = %entry
112 tail call void @foo1()
115 if.else: ; preds = %entry
116 tail call void @foo2()
119 if.end: ; preds = %if.else, %if.then
123 declare void @foo1(...)
124 declare void @foo2(...)