1; RUN: llc -O3 < %s | FileCheck %s
2target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
3target triple = "arm64--linux-gnu"
4
5; Function Attrs: nounwind readnone
6define i32 @test1(i8 %a) {
7; CHECK-LABLE: @test1
8; CHECK: ubfx {{w[0-9]+}}, w0, #3, #5
9entry:
10  %conv = zext i8 %a to i32
11  %shr1 = lshr i32 %conv, 3
12  ret i32 %shr1
13}
14
15; Function Attrs: nounwind readnone
16define i32 @test2(i8 %a) {
17; CHECK-LABLE: @test2
18; CHECK: and {{w[0-9]+}}, w0, #0xff
19; CHECK: ubfx {{w[0-9]+}}, w0, #3, #5
20entry:
21  %conv = zext i8 %a to i32
22  %cmp = icmp ugt i8 %a, 47
23  %shr5 = lshr i32 %conv, 3
24  %retval.0 = select i1 %cmp, i32 %shr5, i32 %conv
25  ret i32 %retval.0
26}
27
28
29