1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu < %s -o -| FileCheck %s
4 define i32 @lsr_bfi(i32 %a) {
5 ; CHECK-LABEL: lsr_bfi:
7 ; CHECK-NEXT: lsr w8, w0, #20
8 ; CHECK-NEXT: bfi w0, w8, #4, #4
10 %and1 = and i32 %a, -241
12 %shl = and i32 %1, 240
13 %or = or i32 %shl, %and1
17 define i32 @negative_lsr_bfi0(i32 %a) {
18 ; CHECK-LABEL: negative_lsr_bfi0:
20 ; CHECK-NEXT: and w0, w0, #0xffffff0f
22 %and1 = and i32 %a, -241
24 %shl = and i32 %1, 240
25 %or = or i32 %shl, %and1
29 define i32 @negative_lsr_bfi1(i32 %a) {
30 ; CHECK-LABEL: negative_lsr_bfi1:
32 ; CHECK-NEXT: lsr w8, w0, #16
33 ; CHECK-NEXT: lsr w9, w8, #4
34 ; CHECK-NEXT: bfi w0, w9, #4, #4
35 ; CHECK-NEXT: add w0, w0, w8
37 %and1 = and i32 %a, -241
39 %shl = and i32 %1, 240
40 %or = or i32 %shl, %and1
41 %add = add i32 %or, %1
45 define i64 @lsr_bfix(i64 %a) {
46 ; CHECK-LABEL: lsr_bfix:
48 ; CHECK-NEXT: lsr x8, x0, #20
49 ; CHECK-NEXT: bfi x0, x8, #4, #4
51 %and1 = and i64 %a, -241
53 %shl = and i64 %1, 240
54 %or = or i64 %shl, %and1
58 define i64 @negative_lsr_bfix0(i64 %a) {
59 ; CHECK-LABEL: negative_lsr_bfix0:
61 ; CHECK-NEXT: and x0, x0, #0xffffffffffffff0f
63 %and1 = and i64 %a, -241
65 %shl = and i64 %1, 240
66 %or = or i64 %shl, %and1
70 define i64 @negative_lsr_bfix1(i64 %a) {
71 ; CHECK-LABEL: negative_lsr_bfix1:
73 ; CHECK-NEXT: lsr x8, x0, #16
74 ; CHECK-NEXT: lsr x9, x8, #4
75 ; CHECK-NEXT: bfi x0, x9, #4, #4
76 ; CHECK-NEXT: add x0, x0, x8
78 %and1 = and i64 %a, -241
80 %shl = and i64 %1, 240
81 %or = or i64 %shl, %and1
82 %add = add i64 %or, %1