llvm/test/CodeGen/AVR/PR31344.ll
Dylan McKay 54223aed57 [AVR] Optimize 16-bit ORs with '0'
Summary: Fixes PR 31344

Authored by Anmol P. Paralkar

Reviewers: dylanmckay

Subscribers: fhahn, llvm-commits

Differential Revision: https://reviews.llvm.org/D28121

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290732 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-30 00:21:56 +00:00

36 lines
835 B
LLVM

; RUN: llc < %s -march=avr | FileCheck %s
; Unit test for: PR 31344
define i16 @or16_reg_imm_0xff00(i16 %a) {
; CHECK-LABEL: or16_reg_imm_0xff00
; CHECK-NOT: ori {{r[0-9]+}}, 0
; CHECK: ori {{r[0-9]+}}, 255
%result = or i16 %a, 65280
ret i16 %result
}
define i16 @or16_reg_imm_0xffb3(i16 %a) {
; CHECK-LABEL: or16_reg_imm_0xffb3
; CHECK: ori {{r[0-9]+}}, 179
; CHECK: ori {{r[0-9]+}}, 255
%result = or i16 %a, 65459
ret i16 %result
}
define i16 @or16_reg_imm_0x00ff(i16 %a) {
; CHECK-LABEL: or16_reg_imm_0x00ff
; CHECK: ori {{r[0-9]+}}, 255
; CHECK-NOT: ori {{r[0-9]+}}, 0
%result = or i16 %a, 255
ret i16 %result
}
define i16 @or16_reg_imm_0xb3ff(i16 %a) {
; CHECK-LABEL: or16_reg_imm_0xb3ff
; CHECK: ori {{r[0-9]+}}, 255
; CHECK: ori {{r[0-9]+}}, 179
%result = or i16 %a, 46079
ret i16 %result
}