1 ; RUN: llc < %s -march=avr | FileCheck %s
3 ; Unit test for: PR 31345
5 define i16 @and16_reg_imm_0xff00(i16 %a) {
6 ; CHECK-LABEL: and16_reg_imm_0xff00
7 ; CHECK: andi {{r[0-9]+}}, 0
8 ; CHECK-NOT: andi {{r[0-9]+}}, 255
9 %result = and i16 %a, 65280
13 define i16 @and16_reg_imm_0xffb3(i16 %a) {
14 ; CHECK-LABEL: and16_reg_imm_0xffb3
15 ; CHECK: andi {{r[0-9]+}}, 179
16 ; CHECK-NOT: andi {{r[0-9]+}}, 255
17 %result = and i16 %a, 65459
21 define i16 @and16_reg_imm_0x00ff(i16 %a) {
22 ; CHECK-LABEL: and16_reg_imm_0x00ff
23 ; CHECK-NOT: andi {{r[0-9]+}}, 255
24 ; CHECK: andi {{r[0-9]+}}, 0
25 %result = and i16 %a, 255
29 define i16 @and16_reg_imm_0xb3ff(i16 %a) {
30 ; CHECK-LABEL: and16_reg_imm_0xb3ff
31 ; CHECK-NOT: andi {{r[0-9]+}}, 255
32 ; CHECK: andi {{r[0-9]+}}, 179
33 %result = and i16 %a, 46079
37 define i16 @and16_reg_imm_0xffff(i16 %a) {
38 ; CHECK-LABEL: and16_reg_imm_0xffff
39 ; CHECK-NOT: andi {{r[0-9]+}}, 255
40 ; CHECK-NOT: andi {{r[0-9]+}}, 255
41 %result = and i16 %a, 65535
45 define i16 @and16_reg_imm_0xabcd(i16 %a) {
46 ; CHECK-LABEL: and16_reg_imm_0xabcd
47 ; CHECK: andi {{r[0-9]+}}, 205
48 ; CHECK: andi {{r[0-9]+}}, 171
49 %result = and i16 %a, 43981