2014-08-30 01:02:28 +08:00
|
|
|
; RUN: llc -mtriple=thumbv7-linux-gnueabihf -o - -show-mc-encoding -t2-reduce-limit=0 -t2-reduce-limit2=0 %s | FileCheck %s
|
2014-08-29 23:04:40 +08:00
|
|
|
; RUN: llc -mtriple=thumbv7-linux-gnueabihf -o - -show-mc-encoding %s | FileCheck %s --check-prefix=CHECK-OPT
|
|
|
|
|
|
|
|
define i32 @and(i32 %a, i32 %b) nounwind readnone {
|
|
|
|
; CHECK-LABEL: and:
|
|
|
|
; CHECK: and.w r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
2014-08-29 23:13:35 +08:00
|
|
|
; CHECK-OPT: ands r{{[0-7]}}, r{{[0-7]}} @ encoding: [{{0x..,0x..}}]
|
2014-08-29 23:04:40 +08:00
|
|
|
entry:
|
|
|
|
%and = and i32 %b, %a
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
2014-08-30 01:02:28 +08:00
|
|
|
define i32 @asr-imm(i32 %a) nounwind readnone {
|
|
|
|
; CHECK-LABEL: "asr-imm":
|
|
|
|
; CHECK: asr.w r{{[0-9]+}}, r{{[0-9]+}}, #13 @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: asrs r{{[0-7]}}, r{{[0-7]}}, #13 @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%shr = ashr i32 %a, 13
|
|
|
|
ret i32 %shr
|
|
|
|
}
|
2014-08-30 01:19:00 +08:00
|
|
|
|
|
|
|
define i32 @asr-reg(i32 %a, i32 %b) nounwind readnone {
|
|
|
|
; CHECK-LABEL: "asr-reg":
|
|
|
|
; CHECK: asr.w r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: asrs r{{[0-7]}}, r{{[0-7]}} @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%shr = ashr i32 %a, %b
|
|
|
|
ret i32 %shr
|
|
|
|
}
|
2014-09-01 20:53:29 +08:00
|
|
|
|
|
|
|
define i32 @bic(i32 %a, i32 %b) nounwind readnone {
|
|
|
|
; CHECK-LABEL: bic:
|
|
|
|
; CHECK: bic.w r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: bics r{{[0-7]}}, r{{[0-7]}} @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%neg = xor i32 %b, -1
|
|
|
|
%and = and i32 %neg, %a
|
|
|
|
ret i32 %and
|
|
|
|
}
|
2014-09-01 20:59:34 +08:00
|
|
|
|
|
|
|
define i32 @eor(i32 %a, i32 %b) nounwind readnone {
|
|
|
|
; CHECK-LABEL: eor:
|
|
|
|
; CHECK: eor.w r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: eors r{{[0-7]}}, r{{[0-7]}} @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%eor = xor i32 %a, %b
|
|
|
|
ret i32 %eor
|
|
|
|
}
|
2014-09-11 18:29:42 +08:00
|
|
|
|
|
|
|
define i32 @lsl-imm(i32 %a) nounwind readnone {
|
|
|
|
; CHECK-LABEL: "lsl-imm":
|
|
|
|
; CHECK: lsl.w r{{[0-9]+}}, r{{[0-9]+}}, #13 @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: lsls r{{[0-7]}}, r{{[0-7]}}, #13 @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%shl = shl i32 %a, 13
|
|
|
|
ret i32 %shl
|
|
|
|
}
|
2014-09-11 18:33:39 +08:00
|
|
|
|
|
|
|
define i32 @lsl-reg(i32 %a, i32 %b) nounwind readnone {
|
|
|
|
; CHECK-LABEL: "lsl-reg":
|
|
|
|
; CHECK: lsl.w r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: lsls r{{[0-7]}}, r{{[0-7]}} @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%shl = shl i32 %a, %b
|
|
|
|
ret i32 %shl
|
|
|
|
}
|
2014-09-11 18:42:17 +08:00
|
|
|
|
|
|
|
define i32 @lsr-imm(i32 %a) nounwind readnone {
|
|
|
|
; CHECK-LABEL: "lsr-imm":
|
|
|
|
; CHECK: lsr.w r{{[0-9]+}}, r{{[0-9]+}}, #13 @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: lsrs r{{[0-7]}}, r{{[0-7]}}, #13 @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%shr = lshr i32 %a, 13
|
|
|
|
ret i32 %shr
|
|
|
|
}
|
2014-09-11 18:45:50 +08:00
|
|
|
|
|
|
|
define i32 @lsr-reg(i32 %a, i32 %b) nounwind readnone {
|
|
|
|
; CHECK-LABEL: "lsr-reg":
|
|
|
|
; CHECK: lsr.w r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} @ encoding: [{{0x..,0x..,0x..,0x..}}]
|
|
|
|
; CHECK-OPT: lsrs r{{[0-7]}}, r{{[0-7]}} @ encoding: [{{0x..,0x..}}]
|
|
|
|
entry:
|
|
|
|
%shr = lshr i32 %a, %b
|
|
|
|
ret i32 %shr
|
|
|
|
}
|
2016-06-18 02:40:46 +08:00
|
|
|
|
|
|
|
define i32 @bundled_instruction(i32* %addr, i32** %addr2, i1 %tst) minsize {
|
|
|
|
; CHECK-LABEL: bundled_instruction:
|
2021-06-24 18:15:39 +08:00
|
|
|
; CHECK: itee ne
|
|
|
|
; CHECK: ldmeq r3!, {{{r[0-9]+}}}
|
2016-06-18 02:40:46 +08:00
|
|
|
br i1 %tst, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
ret i32 0
|
|
|
|
|
|
|
|
false:
|
|
|
|
%res = load i32, i32* %addr, align 4
|
|
|
|
%next = getelementptr i32, i32* %addr, i32 1
|
|
|
|
store i32* %next, i32** %addr2
|
|
|
|
ret i32 %res
|
|
|
|
}
|
2016-09-19 17:11:09 +08:00
|
|
|
|
|
|
|
; ldm instructions fault on misaligned accesses so we mustn't convert
|
|
|
|
; this post-indexed ldr into one.
|
|
|
|
define i32* @misaligned_post(i32* %src, i32* %dest) minsize {
|
|
|
|
; CHECK-LABEL: misaligned_post:
|
|
|
|
; CHECK: ldr [[VAL:.*]], [r0], #4
|
|
|
|
; CHECK: str [[VAL]], [r1]
|
|
|
|
|
|
|
|
%val = load i32, i32* %src, align 1
|
|
|
|
store i32 %val, i32* %dest
|
|
|
|
%next = getelementptr i32, i32* %src, i32 1
|
|
|
|
ret i32* %next
|
|
|
|
}
|