1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver1 | FileCheck %s
4 ; Verify that for the architectures that are known to have poor latency
5 ; double precision shift instructions we generate alternative sequence
6 ; of instructions with lower latencies instead of shld instruction.
8 ;uint64_t lshift1(uint64_t a, uint64_t b)
10 ; return (a << 1) | (b >> 63);
13 define i64 @lshift1(i64 %a, i64 %b) nounwind readnone uwtable {
14 ; CHECK-LABEL: lshift1:
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: shrq $63, %rsi
17 ; CHECK-NEXT: leaq (%rsi,%rdi,2), %rax
21 %shr = lshr i64 %b, 63
22 %or = or i64 %shr, %shl
26 ;uint64_t lshift2(uint64_t a, uint64_t b)
28 ; return (a << 2) | (b >> 62);
31 define i64 @lshift2(i64 %a, i64 %b) nounwind readnone uwtable {
32 ; CHECK-LABEL: lshift2:
33 ; CHECK: # %bb.0: # %entry
34 ; CHECK-NEXT: shrq $62, %rsi
35 ; CHECK-NEXT: leaq (%rsi,%rdi,4), %rax
39 %shr = lshr i64 %b, 62
40 %or = or i64 %shr, %shl
44 ;uint64_t lshift7(uint64_t a, uint64_t b)
46 ; return (a << 7) | (b >> 57);
49 define i64 @lshift7(i64 %a, i64 %b) nounwind readnone uwtable {
50 ; CHECK-LABEL: lshift7:
51 ; CHECK: # %bb.0: # %entry
52 ; CHECK-NEXT: shlq $7, %rdi
53 ; CHECK-NEXT: shrq $57, %rsi
54 ; CHECK-NEXT: leaq (%rsi,%rdi), %rax
58 %shr = lshr i64 %b, 57
59 %or = or i64 %shr, %shl
63 ;uint64_t lshift63(uint64_t a, uint64_t b)
65 ; return (a << 63) | (b >> 1);
68 define i64 @lshift63(i64 %a, i64 %b) nounwind readnone uwtable {
69 ; CHECK-LABEL: lshift63:
70 ; CHECK: # %bb.0: # %entry
71 ; CHECK-NEXT: shlq $63, %rdi
72 ; CHECK-NEXT: shrq %rsi
73 ; CHECK-NEXT: leaq (%rsi,%rdi), %rax
78 %or = or i64 %shr, %shl