1; RUN: llc < %s -march=avr | FileCheck %s 2 3define i8 @sub8_reg_reg(i8 %a, i8 %b) { 4; CHECK-LABEL: sub8_reg_reg: 5; CHECK: sub r24, r22 6 %result = sub i8 %a, %b 7 ret i8 %result 8} 9 10define i8 @sub8_reg_imm(i8 %a) { 11; CHECK-LABEL: sub8_reg_imm: 12; CHECK: subi r24, 5 13 %result = sub i8 %a, 5 14 ret i8 %result 15} 16 17define i8 @sub8_reg_decrement(i8 %a) { 18; CHECK-LABEL: sub8_reg_decrement: 19; CHECK: dec r24 20 %result = sub i8 %a, 1 21 ret i8 %result 22} 23 24define i16 @sub16_reg_reg(i16 %a, i16 %b) { 25; CHECK-LABEL: sub16_reg_reg: 26; CHECK: sub r24, r22 27; CHECK: sbc r25, r23 28 %result = sub i16 %a, %b 29 ret i16 %result 30} 31 32define i16 @sub16_reg_imm(i16 %a) { 33; CHECK-LABEL: sub16_reg_imm: 34; CHECK: sbiw r24, 63 35 %result = sub i16 %a, 63 36 ret i16 %result 37} 38 39define i16 @sub16_reg_imm_subi(i16 %a) { 40; CHECK-LABEL: sub16_reg_imm_subi: 41; CHECK: subi r24, 210 42; CHECK: sbci r25, 4 43 %result = sub i16 %a, 1234 44 ret i16 %result 45} 46 47define i32 @sub32_reg_reg(i32 %a, i32 %b) { 48; CHECK-LABEL: sub32_reg_reg: 49; CHECK: sub r22, r18 50; CHECK: sbc r23, r19 51; CHECK: sbc r24, r20 52; CHECK: sbc r25, r21 53 %result = sub i32 %a, %b 54 ret i32 %result 55} 56 57define i32 @sub32_reg_imm(i32 %a) { 58; CHECK-LABEL: sub32_reg_imm: 59; CHECK: subi r22, 21 60; CHECK: sbci r23, 205 61; CHECK: sbci r24, 91 62; CHECK: sbci r25, 7 63 %result = sub i32 %a, 123456789 64 ret i32 %result 65} 66 67define i64 @sub64_reg_reg(i64 %a, i64 %b) { 68; CHECK-LABEL: sub64_reg_reg: 69; CHECK: sub r18, r10 70; CHECK: sbc r20, r12 71; CHECK: sbc r21, r13 72; CHECK: sbc r22, r14 73; CHECK: sbc r23, r15 74; CHECK: sbc r24, r16 75; CHECK: sbc r25, r17 76 %result = sub i64 %a, %b 77 ret i64 %result 78} 79 80define i64 @sub64_reg_imm(i64 %a) { 81; CHECK-LABEL: sub64_reg_imm: 82; CHECK: subi r18, 204 83; CHECK: sbci r19, 204 84; CHECK: sbci r20, 104 85; CHECK: sbci r21, 37 86; CHECK: sbci r22, 25 87; CHECK: sbci r23, 22 88; CHECK: sbci r24, 236 89; CHECK: sbci r25, 190 90 %result = sub i64 %a, 13757395258967641292 91 ret i64 %result 92} 93