1 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -mattr=+lsl-fast | FileCheck %s
3 %struct.a = type [256 x i16]
4 %struct.b = type [256 x i32]
5 %struct.c = type [256 x i64]
8 define i16 @halfword(%struct.a* %ctx, i32 %xor72) nounwind {
9 ; CHECK-LABEL: halfword:
10 ; CHECK: ubfx [[REG:x[0-9]+]], x1, #9, #8
11 ; CHECK: ldrh [[REG1:w[0-9]+]], [{{.*}}[[REG2:x[0-9]+]], [[REG]], lsl #1]
12 ; CHECK: mov [[REG3:x[0-9]+]], [[REG2]]
13 ; CHECK: strh [[REG1]], [{{.*}}[[REG3]], [[REG]], lsl #1]
14 %shr81 = lshr i32 %xor72, 9
15 %conv82 = zext i32 %shr81 to i64
16 %idxprom83 = and i64 %conv82, 255
17 %arrayidx86 = getelementptr inbounds %struct.a, %struct.a* %ctx, i64 0, i64 %idxprom83
18 %result = load i16, i16* %arrayidx86, align 2
20 store i16 %result, i16* %arrayidx86, align 2
24 define i32 @word(%struct.b* %ctx, i32 %xor72) nounwind {
26 ; CHECK: ubfx [[REG:x[0-9]+]], x1, #9, #8
27 ; CHECK: ldr [[REG1:w[0-9]+]], [{{.*}}[[REG2:x[0-9]+]], [[REG]], lsl #2]
28 ; CHECK: mov [[REG3:x[0-9]+]], [[REG2]]
29 ; CHECK: str [[REG1]], [{{.*}}[[REG3]], [[REG]], lsl #2]
30 %shr81 = lshr i32 %xor72, 9
31 %conv82 = zext i32 %shr81 to i64
32 %idxprom83 = and i64 %conv82, 255
33 %arrayidx86 = getelementptr inbounds %struct.b, %struct.b* %ctx, i64 0, i64 %idxprom83
34 %result = load i32, i32* %arrayidx86, align 4
36 store i32 %result, i32* %arrayidx86, align 4
40 define i64 @doubleword(%struct.c* %ctx, i32 %xor72) nounwind {
41 ; CHECK-LABEL: doubleword:
42 ; CHECK: ubfx [[REG:x[0-9]+]], x1, #9, #8
43 ; CHECK: ldr [[REG1:x[0-9]+]], [{{.*}}[[REG2:x[0-9]+]], [[REG]], lsl #3]
44 ; CHECK: mov [[REG3:x[0-9]+]], [[REG2]]
45 ; CHECK: str [[REG1]], [{{.*}}[[REG3]], [[REG]], lsl #3]
46 %shr81 = lshr i32 %xor72, 9
47 %conv82 = zext i32 %shr81 to i64
48 %idxprom83 = and i64 %conv82, 255
49 %arrayidx86 = getelementptr inbounds %struct.c, %struct.c* %ctx, i64 0, i64 %idxprom83
50 %result = load i64, i64* %arrayidx86, align 8
52 store i64 %result, i64* %arrayidx86, align 8
56 define i64 @multi_use_non_memory(i64 %a, i64 %b) {
57 ; CHECK-LABEL: multi_use_non_memory:
58 ; CHECK: lsl [[REG1:x[0-9]+]], x0, #3
59 ; CHECK-NOT: cmp [[REG1]], x1, lsl # 3
60 ; CHECK-NEXT: lsl [[REG2:x[0-9]+]], x1, #3
61 ; CHECK-NEXT: cmp [[REG1]], [[REG2]]
65 %cmp = icmp slt i64 %mul1, %mul2
66 br i1 %cmp, label %truebb, label %falsebb
71 %cmp2 = icmp sgt i64 %mul1, %mul2
72 br i1 %cmp2, label %exitbb, label %endbb