1 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver1 | FileCheck %s
3 ; clang -Oz -c test1.cpp -emit-llvm -S -o
4 ; Verify that we generate shld insruction when we are optimizing for size,
5 ; even for X86_64 processors that are known to have poor latency double
6 ; precision shift instructions.
7 ; uint64_t lshift10(uint64_t a, uint64_t b)
9 ; return (a << 10) | (b >> 54);
12 ; Function Attrs: minsize nounwind readnone uwtable
13 define i64 @_Z8lshift10mm(i64 %a, i64 %b) #0 {
17 %shr = lshr i64 %b, 54
18 %or = or i64 %shr, %shl
22 attributes #0 = { minsize nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
25 ; clang -Os -c test2.cpp -emit-llvm -S
26 ; Verify that we generate shld insruction when we are optimizing for size,
27 ; even for X86_64 processors that are known to have poor latency double
28 ; precision shift instructions.
29 ; uint64_t lshift11(uint64_t a, uint64_t b)
31 ; return (a << 11) | (b >> 53);
34 ; Function Attrs: nounwind optsize readnone uwtable
35 define i64 @_Z8lshift11mm(i64 %a, i64 %b) #1 {
39 %shr = lshr i64 %b, 53
40 %or = or i64 %shr, %shl
44 attributes #1 = { nounwind optsize readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
46 ; clang -O2 -c test2.cpp -emit-llvm -S
47 ; Verify that we do not generate shld insruction when we are not optimizing
48 ; for size for X86_64 processors that are known to have poor latency double
49 ; precision shift instructions.
50 ; uint64_t lshift12(uint64_t a, uint64_t b)
52 ; return (a << 12) | (b >> 52);
55 ; Function Attrs: nounwind optsize readnone uwtable
56 define i64 @_Z8lshift12mm(i64 %a, i64 %b) #2 {
59 ; CHECK-NEXT: shrq $52
61 %shr = lshr i64 %b, 52
62 %or = or i64 %shr, %shl
66 attributes #2= { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }