1 ; RUN: llc < %s -march=avr | FileCheck %s 2 3 declare void @f1(i8) 4 declare void @f2(i8) 5 define void @cmp8(i8 %a, i8 %b) { 6 ; CHECK-LABEL: cmp8: 7 ; CHECK: cp 8 ; CHECK-NOT: cpc 9 %cmp = icmp eq i8 %a, %b 10 br i1 %cmp, label %if.then, label %if.else 11 if.then: 12 tail call void @f1(i8 %a) 13 br label %if.end 14 if.else: 15 tail call void @f2(i8 %b) 16 br label %if.end 17 if.end: 18 ret void 19 } 20 21 declare void @f3(i16) 22 declare void @f4(i16) 23 define void @cmp16(i16 %a, i16 %b) { 24 ; CHECK-LABEL: cmp16: 25 ; CHECK: cp 26 ; CHECK-NEXT: cpc 27 %cmp = icmp eq i16 %a, %b 28 br i1 %cmp, label %if.then, label %if.else 29 if.then: 30 tail call void @f3(i16 %a) 31 br label %if.end 32 if.else: 33 tail call void @f4(i16 %b) 34 br label %if.end 35 if.end: 36 ret void 37 } 38 39 declare void @f5(i32) 40 declare void @f6(i32) 41 define void @cmp32(i32 %a, i32 %b) { 42 ; CHECK-LABEL: cmp32: 43 ; CHECK: cp 44 ; CHECK-NEXT: cpc 45 ; CHECK-NEXT: cpc 46 ; CHECK-NEXT: cpc 47 %cmp = icmp eq i32 %a, %b 48 br i1 %cmp, label %if.then, label %if.else 49 if.then: 50 tail call void @f5(i32 %a) 51 br label %if.end 52 if.else: 53 tail call void @f6(i32 %b) 54 br label %if.end 55 if.end: 56 ret void 57 } 58 59 declare void @f7(i64) 60 declare void @f8(i64) 61 define void @cmp64(i64 %a, i64 %b) { 62 ; CHECK-LABEL: cmp64: 63 ; CHECK: cp 64 ; CHECK-NEXT: cpc 65 ; CHECK-NEXT: cpc 66 ; CHECK-NEXT: cpc 67 ; CHECK-NEXT: cpc 68 ; CHECK-NEXT: cpc 69 ; CHECK-NEXT: cpc 70 ; CHECK-NEXT: cpc 71 %cmp = icmp eq i64 %a, %b 72 br i1 %cmp, label %if.then, label %if.else 73 if.then: 74 tail call void @f7(i64 %a) 75 br label %if.end 76 if.else: 77 tail call void @f8(i64 %b) 78 br label %if.end 79 if.end: 80 ret void 81 } 82 83 declare void @f9() 84 declare void @f10() 85 86 define void @tst8(i8 %a) { 87 ; CHECK-LABEL: tst8: 88 ; CHECK: tst r24 89 ; CHECK-NEXT: brmi 90 %cmp = icmp sgt i8 %a, -1 91 br i1 %cmp, label %if.then, label %if.else 92 if.then: 93 tail call void @f9() 94 br label %if.end 95 if.else: 96 tail call void @f10() 97 br label %if.end 98 if.end: 99 ret void 100 } 101 102 define void @tst16(i16 %a) { 103 ; CHECK-LABEL: tst16: 104 ; CHECK: tst r25 105 ; CHECK-NEXT: brmi 106 %cmp = icmp sgt i16 %a, -1 107 br i1 %cmp, label %if.then, label %if.else 108 if.then: 109 tail call void @f9() 110 br label %if.end 111 if.else: 112 tail call void @f10() 113 br label %if.end 114 if.end: 115 ret void 116 } 117 118 define void @tst32(i32 %a) { 119 ; CHECK-LABEL: tst32: 120 ; CHECK: tst r25 121 ; CHECK-NEXT: brmi 122 %cmp = icmp sgt i32 %a, -1 123 br i1 %cmp, label %if.then, label %if.else 124 if.then: 125 tail call void @f9() 126 br label %if.end 127 if.else: 128 tail call void @f10() 129 br label %if.end 130 if.end: 131 ret void 132 } 133 134 define void @tst64(i64 %a) { 135 ; CHECK-LABEL: tst64: 136 ; CHECK: tst r25 137 ; CHECK-NEXT: brmi 138 %cmp = icmp sgt i64 %a, -1 139 br i1 %cmp, label %if.then, label %if.else 140 if.then: 141 tail call void @f9() 142 br label %if.end 143 if.else: 144 tail call void @f10() 145 br label %if.end 146 if.end: 147 ret void 148 } 149