1 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=k8 | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=opteron | FileCheck %s
3 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=athlon64 | FileCheck %s
4 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=athlon-fx | FileCheck %s
5 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=k8-sse3 | FileCheck %s
6 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=opteron-sse3 | FileCheck %s
7 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=athlon64-sse3 | FileCheck %s
8 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=amdfam10 | FileCheck %s
9 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver1 | FileCheck %s
10 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s
11 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver1 | FileCheck %s
12 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver2 | FileCheck %s
13 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver3 | FileCheck %s
14 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver4 | FileCheck %s
15 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver1 | FileCheck %s
17 ; Verify that for the X86_64 processors that are known to have poor latency
18 ; double precision shift instructions we do not generate 'shld' or 'shrd'
21 ;uint64_t lshift(uint64_t a, uint64_t b, int c)
23 ; return (a << c) | (b >> (64-c));
26 define i64 @lshift(i64 %a, i64 %b, i32 %c) nounwind readnone {
29 %sh_prom = zext i32 %c to i64
30 %shl = shl i64 %a, %sh_prom
31 %sub = sub nsw i32 64, %c
32 %sh_prom1 = zext i32 %sub to i64
33 %shr = lshr i64 %b, %sh_prom1
34 %or = or i64 %shr, %shl
38 ;uint64_t rshift(uint64_t a, uint64_t b, int c)
40 ; return (a >> c) | (b << (64-c));
43 define i64 @rshift(i64 %a, i64 %b, i32 %c) nounwind readnone {
46 %sh_prom = zext i32 %c to i64
47 %shr = lshr i64 %a, %sh_prom
48 %sub = sub nsw i32 64, %c
49 %sh_prom1 = zext i32 %sub to i64
50 %shl = shl i64 %b, %sh_prom1
51 %or = or i64 %shl, %shr