1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
4 define i64 @f0(i64 %val, i64 %amt) minsize optsize {
7 ; CHECK-NEXT: movq %rsi, %rcx
8 ; CHECK-NEXT: movq %rdi, %rax
9 ; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx
10 ; CHECK-NEXT: shlq %cl, %rax
12 %res = shl i64 %val, %amt
16 define i32 @f1(i64 %x, i64 %y) minsize optsize {
19 ; CHECK-NEXT: movq %rsi, %rcx
20 ; CHECK-NEXT: movq %rdi, %rax
21 ; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx
22 ; CHECK-NEXT: shlq %cl, %rax
23 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
26 %b = trunc i64 %a to i32
30 define i32 @f2(i64 %x, i64 %y) minsize optsize {
33 ; CHECK-NEXT: movq %rsi, %rcx
34 ; CHECK-NEXT: movq %rdi, %rax
35 ; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx
36 ; CHECK-NEXT: sarq %cl, %rax
37 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
40 %b = trunc i64 %a to i32
44 define i32 @f3(i64 %x, i64 %y) minsize optsize {
47 ; CHECK-NEXT: movq %rsi, %rcx
48 ; CHECK-NEXT: movq %rdi, %rax
49 ; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx
50 ; CHECK-NEXT: shrq %cl, %rax
51 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
54 %b = trunc i64 %a to i32
58 define dso_local { i64, i64 } @shl128(i64 %x.coerce0, i64 %x.coerce1, i8 signext %y) minsize optsize {
59 ; CHECK-LABEL: shl128:
60 ; CHECK: # %bb.0: # %entry
61 ; CHECK-NEXT: pushq %rax
62 ; CHECK-NEXT: .cfi_def_cfa_offset 16
63 ; CHECK-NEXT: movzbl %dl, %edx
64 ; CHECK-NEXT: callq __ashlti3
65 ; CHECK-NEXT: popq %rcx
66 ; CHECK-NEXT: .cfi_def_cfa_offset 8
69 %x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
70 %x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64
71 %x.sroa.0.0.insert.ext = zext i64 %x.coerce0 to i128
72 %x.sroa.0.0.insert.insert = or i128 %x.sroa.2.0.insert.shift, %x.sroa.0.0.insert.ext
73 %conv = sext i8 %y to i32
74 %sh_prom = zext i32 %conv to i128
75 %shl = shl i128 %x.sroa.0.0.insert.insert, %sh_prom
76 %retval.sroa.0.0.extract.trunc = trunc i128 %shl to i64
77 %retval.sroa.2.0.extract.shift = lshr i128 %shl, 64
78 %retval.sroa.2.0.extract.trunc = trunc i128 %retval.sroa.2.0.extract.shift to i64
79 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.extract.trunc, 0
80 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.extract.trunc, 1
81 ret { i64, i64 } %.fca.1.insert
84 define dso_local { i64, i64 } @ashr128(i64 %x.coerce0, i64 %x.coerce1, i8 signext %y) minsize optsize {
85 ; CHECK-LABEL: ashr128:
86 ; CHECK: # %bb.0: # %entry
87 ; CHECK-NEXT: pushq %rax
88 ; CHECK-NEXT: .cfi_def_cfa_offset 16
89 ; CHECK-NEXT: callq __ashrti3
90 ; CHECK-NEXT: popq %rcx
91 ; CHECK-NEXT: .cfi_def_cfa_offset 8
94 %x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
95 %x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64
96 %x.sroa.0.0.insert.ext = zext i64 %x.coerce0 to i128
97 %x.sroa.0.0.insert.insert = or i128 %x.sroa.2.0.insert.shift, %x.sroa.0.0.insert.ext
98 %conv = sext i8 %y to i32
99 %sh_prom = zext i32 %conv to i128
100 %shr = ashr i128 %x.sroa.0.0.insert.insert, %sh_prom
101 %retval.sroa.0.0.extract.trunc = trunc i128 %shr to i64
102 %retval.sroa.2.0.extract.shift = lshr i128 %shr, 64
103 %retval.sroa.2.0.extract.trunc = trunc i128 %retval.sroa.2.0.extract.shift to i64
104 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.extract.trunc, 0
105 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.extract.trunc, 1
106 ret { i64, i64 } %.fca.1.insert
109 define dso_local { i64, i64 } @lshr128(i64 %x.coerce0, i64 %x.coerce1, i8 signext %y) minsize optsize {
110 ; CHECK-LABEL: lshr128:
111 ; CHECK: # %bb.0: # %entry
112 ; CHECK-NEXT: pushq %rax
113 ; CHECK-NEXT: .cfi_def_cfa_offset 16
114 ; CHECK-NEXT: movzbl %dl, %edx
115 ; CHECK-NEXT: callq __lshrti3
116 ; CHECK-NEXT: popq %rcx
117 ; CHECK-NEXT: .cfi_def_cfa_offset 8
120 %x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
121 %x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64
122 %x.sroa.0.0.insert.ext = zext i64 %x.coerce0 to i128
123 %x.sroa.0.0.insert.insert = or i128 %x.sroa.2.0.insert.shift, %x.sroa.0.0.insert.ext
124 %conv = sext i8 %y to i32
125 %sh_prom = zext i32 %conv to i128
126 %shr = lshr i128 %x.sroa.0.0.insert.insert, %sh_prom
127 %retval.sroa.0.0.extract.trunc = trunc i128 %shr to i64
128 %retval.sroa.2.0.extract.shift = lshr i128 %shr, 64
129 %retval.sroa.2.0.extract.trunc = trunc i128 %retval.sroa.2.0.extract.shift to i64
130 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.extract.trunc, 0
131 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.extract.trunc, 1
132 ret { i64, i64 } %.fca.1.insert