1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-unknown-unknown | FileCheck %s
3 ; RUN: llc < %s -mtriple=aarch64-windows | FileCheck %s -check-prefix=CHECK-WIN
5 ; The Windows runtime doesn't have these.
6 ; CHECK-WIN-NOT: __ashlti3
7 ; CHECK-WIN-NOT: __ashrti3
9 define i64 @f0(i64 %val, i64 %amt) minsize optsize {
12 ; CHECK-NEXT: lsl x0, x0, x1
14 %res = shl i64 %val, %amt
18 define i32 @f1(i64 %x, i64 %y) minsize optsize {
21 ; CHECK-NEXT: lsl x0, x0, x1
22 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
25 %b = trunc i64 %a to i32
29 define i32 @f2(i64 %x, i64 %y) minsize optsize {
32 ; CHECK-NEXT: asr x0, x0, x1
33 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
36 %b = trunc i64 %a to i32
40 define i32 @f3(i64 %x, i64 %y) minsize optsize {
43 ; CHECK-NEXT: lsr x0, x0, x1
44 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
47 %b = trunc i64 %a to i32
51 define dso_local { i64, i64 } @shl128(i64 %x.coerce0, i64 %x.coerce1, i8 signext %y) minsize optsize {
52 ; CHECK-LABEL: shl128:
53 ; CHECK: // %bb.0: // %entry
54 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
55 ; CHECK-NEXT: .cfi_def_cfa_offset 16
56 ; CHECK-NEXT: .cfi_offset w30, -16
57 ; CHECK-NEXT: // kill: def $w2 killed $w2 def $x2
58 ; CHECK-NEXT: bl __ashlti3
59 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
63 %x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
64 %x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64
65 %x.sroa.0.0.insert.ext = zext i64 %x.coerce0 to i128
66 %x.sroa.0.0.insert.insert = or i128 %x.sroa.2.0.insert.shift, %x.sroa.0.0.insert.ext
67 %conv = sext i8 %y to i32
68 %sh_prom = zext i32 %conv to i128
69 %shl = shl i128 %x.sroa.0.0.insert.insert, %sh_prom
70 %retval.sroa.0.0.extract.trunc = trunc i128 %shl to i64
71 %retval.sroa.2.0.extract.shift = lshr i128 %shl, 64
72 %retval.sroa.2.0.extract.trunc = trunc i128 %retval.sroa.2.0.extract.shift to i64
73 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.extract.trunc, 0
74 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.extract.trunc, 1
75 ret { i64, i64 } %.fca.1.insert
78 define dso_local { i64, i64 } @ashr128(i64 %x.coerce0, i64 %x.coerce1, i8 signext %y) minsize optsize {
79 ; CHECK-LABEL: ashr128:
80 ; CHECK: // %bb.0: // %entry
81 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
82 ; CHECK-NEXT: .cfi_def_cfa_offset 16
83 ; CHECK-NEXT: .cfi_offset w30, -16
84 ; CHECK-NEXT: // kill: def $w2 killed $w2 def $x2
85 ; CHECK-NEXT: bl __ashrti3
86 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
89 %x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
90 %x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64
91 %x.sroa.0.0.insert.ext = zext i64 %x.coerce0 to i128
92 %x.sroa.0.0.insert.insert = or i128 %x.sroa.2.0.insert.shift, %x.sroa.0.0.insert.ext
93 %conv = sext i8 %y to i32
94 %sh_prom = zext i32 %conv to i128
95 %shr = ashr i128 %x.sroa.0.0.insert.insert, %sh_prom
96 %retval.sroa.0.0.extract.trunc = trunc i128 %shr to i64
97 %retval.sroa.2.0.extract.shift = lshr i128 %shr, 64
98 %retval.sroa.2.0.extract.trunc = trunc i128 %retval.sroa.2.0.extract.shift to i64
99 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.extract.trunc, 0
100 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.extract.trunc, 1
101 ret { i64, i64 } %.fca.1.insert
104 define dso_local { i64, i64 } @lshr128(i64 %x.coerce0, i64 %x.coerce1, i8 signext %y) minsize optsize {
105 ; CHECK-LABEL: lshr128:
106 ; CHECK: // %bb.0: // %entry
107 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
108 ; CHECK-NEXT: .cfi_def_cfa_offset 16
109 ; CHECK-NEXT: .cfi_offset w30, -16
110 ; CHECK-NEXT: // kill: def $w2 killed $w2 def $x2
111 ; CHECK-NEXT: bl __lshrti3
112 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
115 %x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
116 %x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64
117 %x.sroa.0.0.insert.ext = zext i64 %x.coerce0 to i128
118 %x.sroa.0.0.insert.insert = or i128 %x.sroa.2.0.insert.shift, %x.sroa.0.0.insert.ext
119 %conv = sext i8 %y to i32
120 %sh_prom = zext i32 %conv to i128
121 %shr = lshr i128 %x.sroa.0.0.insert.insert, %sh_prom
122 %retval.sroa.0.0.extract.trunc = trunc i128 %shr to i64
123 %retval.sroa.2.0.extract.shift = lshr i128 %shr, 64
124 %retval.sroa.2.0.extract.trunc = trunc i128 %retval.sroa.2.0.extract.shift to i64
125 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.extract.trunc, 0
126 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.extract.trunc, 1
127 ret { i64, i64 } %.fca.1.insert