1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=thumbv7m-none-eabi -mattr=v7 | FileCheck %s --check-prefixes=CHECK
4 declare i16 @llvm.bswap.i16(i16) readnone
5 declare i32 @llvm.bswap.i32(i32) readnone
6 declare i32 @llvm.bitreverse.i32(i32) readnone
8 define i32 @brev_and_lhs_brev32(i32 %a, i32 %b) #0 {
9 ; CHECK-LABEL: brev_and_lhs_brev32:
11 ; CHECK-NEXT: rbit r0, r0
12 ; CHECK-NEXT: ands r0, r1
13 ; CHECK-NEXT: rbit r0, r0
15 %1 = tail call i32 @llvm.bitreverse.i32(i32 %a)
17 %3 = tail call i32 @llvm.bitreverse.i32(i32 %2)
21 define i32 @brev_or_lhs_brev32(i32 %a, i32 %b) #0 {
22 ; CHECK-LABEL: brev_or_lhs_brev32:
24 ; CHECK-NEXT: rbit r0, r0
25 ; CHECK-NEXT: orrs r0, r1
26 ; CHECK-NEXT: rbit r0, r0
28 %1 = tail call i32 @llvm.bitreverse.i32(i32 %a)
30 %3 = tail call i32 @llvm.bitreverse.i32(i32 %2)
34 define i32 @brev_xor_rhs_brev32(i32 %a, i32 %b) #0 {
35 ; CHECK-LABEL: brev_xor_rhs_brev32:
37 ; CHECK-NEXT: rbit r1, r1
38 ; CHECK-NEXT: eors r0, r1
39 ; CHECK-NEXT: rbit r0, r0
41 %1 = tail call i32 @llvm.bitreverse.i32(i32 %b)
43 %3 = tail call i32 @llvm.bitreverse.i32(i32 %2)
47 define i32 @brev_and_all_operand_multiuse(i32 %a, i32 %b) #0 {
48 ; CHECK-LABEL: brev_and_all_operand_multiuse:
50 ; CHECK-NEXT: rbit r1, r1
51 ; CHECK-NEXT: rbit r0, r0
52 ; CHECK-NEXT: and.w r2, r0, r1
53 ; CHECK-NEXT: rbit r2, r2
54 ; CHECK-NEXT: muls r0, r2, r0
55 ; CHECK-NEXT: muls r0, r1, r0
57 %1 = tail call i32 @llvm.bitreverse.i32(i32 %a)
58 %2 = tail call i32 @llvm.bitreverse.i32(i32 %b)
60 %4 = tail call i32 @llvm.bitreverse.i32(i32 %3)
61 %5 = mul i32 %1, %4 ;increase use of left bitreverse
62 %6 = mul i32 %2, %5 ;increase use of right bitreverse
68 define i32 @brev_and_rhs_brev32_multiuse1(i32 %a, i32 %b) #0 {
69 ; CHECK-LABEL: brev_and_rhs_brev32_multiuse1:
71 ; CHECK-NEXT: rbit r1, r1
72 ; CHECK-NEXT: ands r0, r1
73 ; CHECK-NEXT: rbit r1, r0
74 ; CHECK-NEXT: muls r0, r1, r0
76 %1 = tail call i32 @llvm.bitreverse.i32(i32 %b)
78 %3 = tail call i32 @llvm.bitreverse.i32(i32 %2)
79 %4 = mul i32 %2, %3 ;increase use of logical op
84 define i32 @brev_and_rhs_brev32_multiuse2(i32 %a, i32 %b) #0 {
85 ; CHECK-LABEL: brev_and_rhs_brev32_multiuse2:
87 ; CHECK-NEXT: rbit r1, r1
88 ; CHECK-NEXT: ands r0, r1
89 ; CHECK-NEXT: rbit r0, r0
90 ; CHECK-NEXT: muls r0, r1, r0
92 %1 = tail call i32 @llvm.bitreverse.i32(i32 %b)
94 %3 = tail call i32 @llvm.bitreverse.i32(i32 %2)
95 %4 = mul i32 %1, %3 ;increase use of inner bitreverse
100 define i32 @brev_xor_rhs_bs32(i32 %a, i32 %b) #0 {
101 ; CHECK-LABEL: brev_xor_rhs_bs32:
103 ; CHECK-NEXT: rev r1, r1
104 ; CHECK-NEXT: eors r0, r1
105 ; CHECK-NEXT: rbit r0, r0
107 %1 = tail call i32 @llvm.bswap.i32(i32 %b)
109 %3 = tail call i32 @llvm.bitreverse.i32(i32 %2)