Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=x86-64 | FileCheck %s --check-prefix=CHECK --check-prefix=GENERIC
      3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=BTVER2
      4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=bdver1 | FileCheck %s --check-prefix=CHECK --check-prefix=BDVER1
      5 
      6 
      7 ; uint64_t lshift10(uint64_t a, uint64_t b)
      8 ; {
      9 ;     return (a << 10) | (b >> 54);
     10 ; }
     11 
     12 define i64 @lshift10_optsize(i64 %a, i64 %b) nounwind readnone optsize {
     13 ; GENERIC-LABEL: lshift10_optsize:
     14 ; GENERIC:       # %bb.0: # %entry
     15 ; GENERIC-NEXT:    shldq $10, %rsi, %rdi # sched: [2:0.67]
     16 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
     17 ; GENERIC-NEXT:    retq # sched: [1:1.00]
     18 ;
     19 ; BTVER2-LABEL: lshift10_optsize:
     20 ; BTVER2:       # %bb.0: # %entry
     21 ; BTVER2-NEXT:    shldq $10, %rsi, %rdi # sched: [3:3.00]
     22 ; BTVER2-NEXT:    movq %rdi, %rax # sched: [1:0.50]
     23 ; BTVER2-NEXT:    retq # sched: [4:1.00]
     24 ;
     25 ; BDVER1-LABEL: lshift10_optsize:
     26 ; BDVER1:       # %bb.0: # %entry
     27 ; BDVER1-NEXT:    shldq $10, %rsi, %rdi
     28 ; BDVER1-NEXT:    movq %rdi, %rax
     29 ; BDVER1-NEXT:    retq
     30 entry:
     31   %shl = shl i64 %a, 10
     32   %shr = lshr i64 %b, 54
     33   %or = or i64 %shr, %shl
     34   ret i64 %or
     35 }
     36 
     37 define i64 @lshift10(i64 %a, i64 %b) nounwind readnone {
     38 ; GENERIC-LABEL: lshift10:
     39 ; GENERIC:       # %bb.0: # %entry
     40 ; GENERIC-NEXT:    shldq $10, %rsi, %rdi # sched: [2:0.67]
     41 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
     42 ; GENERIC-NEXT:    retq # sched: [1:1.00]
     43 ;
     44 ; BTVER2-LABEL: lshift10:
     45 ; BTVER2:       # %bb.0: # %entry
     46 ; BTVER2-NEXT:    shlq $10, %rdi # sched: [1:0.50]
     47 ; BTVER2-NEXT:    shrq $54, %rsi # sched: [1:0.50]
     48 ; BTVER2-NEXT:    leaq (%rsi,%rdi), %rax # sched: [1:0.50]
     49 ; BTVER2-NEXT:    retq # sched: [4:1.00]
     50 ;
     51 ; BDVER1-LABEL: lshift10:
     52 ; BDVER1:       # %bb.0: # %entry
     53 ; BDVER1-NEXT:    shlq $10, %rdi
     54 ; BDVER1-NEXT:    shrq $54, %rsi
     55 ; BDVER1-NEXT:    leaq (%rsi,%rdi), %rax
     56 ; BDVER1-NEXT:    retq
     57 entry:
     58   %shl = shl i64 %a, 10
     59   %shr = lshr i64 %b, 54
     60   %or = or i64 %shr, %shl
     61   ret i64 %or
     62 }
     63 
     64 ; uint64_t rshift10(uint64_t a, uint64_t b)
     65 ; {
     66 ;     return (a >> 62) | (b << 2);
     67 ; }
     68 
     69 ; Should be done via shld
     70 define i64 @rshift10_optsize(i64 %a, i64 %b) nounwind readnone optsize {
     71 ; GENERIC-LABEL: rshift10_optsize:
     72 ; GENERIC:       # %bb.0: # %entry
     73 ; GENERIC-NEXT:    shrdq $62, %rsi, %rdi # sched: [2:0.67]
     74 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
     75 ; GENERIC-NEXT:    retq # sched: [1:1.00]
     76 ;
     77 ; BTVER2-LABEL: rshift10_optsize:
     78 ; BTVER2:       # %bb.0: # %entry
     79 ; BTVER2-NEXT:    shrdq $62, %rsi, %rdi # sched: [3:3.00]
     80 ; BTVER2-NEXT:    movq %rdi, %rax # sched: [1:0.50]
     81 ; BTVER2-NEXT:    retq # sched: [4:1.00]
     82 ;
     83 ; BDVER1-LABEL: rshift10_optsize:
     84 ; BDVER1:       # %bb.0: # %entry
     85 ; BDVER1-NEXT:    shrdq $62, %rsi, %rdi
     86 ; BDVER1-NEXT:    movq %rdi, %rax
     87 ; BDVER1-NEXT:    retq
     88 entry:
     89   %shl = lshr i64 %a, 62
     90   %shr = shl i64 %b, 2
     91   %or = or i64 %shr, %shl
     92   ret i64 %or
     93 }
     94 
     95 ; Should be done via lea (x,y,4),z
     96 define i64 @rshift10(i64 %a, i64 %b) nounwind readnone {
     97 ; GENERIC-LABEL: rshift10:
     98 ; GENERIC:       # %bb.0: # %entry
     99 ; GENERIC-NEXT:    shrdq $62, %rsi, %rdi # sched: [2:0.67]
    100 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
    101 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    102 ;
    103 ; BTVER2-LABEL: rshift10:
    104 ; BTVER2:       # %bb.0: # %entry
    105 ; BTVER2-NEXT:    shrq $62, %rdi # sched: [1:0.50]
    106 ; BTVER2-NEXT:    leaq (%rdi,%rsi,4), %rax # sched: [2:1.00]
    107 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    108 ;
    109 ; BDVER1-LABEL: rshift10:
    110 ; BDVER1:       # %bb.0: # %entry
    111 ; BDVER1-NEXT:    shrq $62, %rdi
    112 ; BDVER1-NEXT:    leaq (%rdi,%rsi,4), %rax
    113 ; BDVER1-NEXT:    retq
    114 entry:
    115   %shl = lshr i64 %a, 62
    116   %shr = shl i64 %b, 2
    117   %or = or i64 %shr, %shl
    118   ret i64 %or
    119 }
    120 
    121 ;uint64_t lshift(uint64_t a, uint64_t b, uint64_t c)
    122 ;{
    123 ;    return (a << c) | (b >> (64-c));
    124 ;}
    125 
    126 define i64 @lshift_cl_optsize(i64 %a, i64 %b, i64 %c) nounwind readnone optsize {
    127 ; GENERIC-LABEL: lshift_cl_optsize:
    128 ; GENERIC:       # %bb.0: # %entry
    129 ; GENERIC-NEXT:    movl %edx, %ecx # sched: [1:0.33]
    130 ; GENERIC-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:1.50]
    131 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
    132 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    133 ;
    134 ; BTVER2-LABEL: lshift_cl_optsize:
    135 ; BTVER2:       # %bb.0: # %entry
    136 ; BTVER2-NEXT:    movl %edx, %ecx # sched: [1:0.50]
    137 ; BTVER2-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:4.00]
    138 ; BTVER2-NEXT:    movq %rdi, %rax # sched: [1:0.50]
    139 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    140 ;
    141 ; BDVER1-LABEL: lshift_cl_optsize:
    142 ; BDVER1:       # %bb.0: # %entry
    143 ; BDVER1-NEXT:    movl %edx, %ecx
    144 ; BDVER1-NEXT:    shldq %cl, %rsi, %rdi
    145 ; BDVER1-NEXT:    movq %rdi, %rax
    146 ; BDVER1-NEXT:    retq
    147 entry:
    148   %shl = shl i64 %a, %c
    149   %sub = sub nsw i64 64, %c
    150   %shr = lshr i64 %b, %sub
    151   %or = or i64 %shr, %shl
    152   ret i64 %or
    153 }
    154 
    155 define i64 @lshift_cl(i64 %a, i64 %b, i64 %c) nounwind readnone {
    156 ; GENERIC-LABEL: lshift_cl:
    157 ; GENERIC:       # %bb.0: # %entry
    158 ; GENERIC-NEXT:    movl %edx, %ecx # sched: [1:0.33]
    159 ; GENERIC-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:1.50]
    160 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
    161 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    162 ;
    163 ; BTVER2-LABEL: lshift_cl:
    164 ; BTVER2:       # %bb.0: # %entry
    165 ; BTVER2-NEXT:    movl %edx, %ecx # sched: [1:0.50]
    166 ; BTVER2-NEXT:    shlq %cl, %rdi # sched: [1:0.50]
    167 ; BTVER2-NEXT:    movl $64, %ecx # sched: [1:0.50]
    168 ; BTVER2-NEXT:    subl %edx, %ecx # sched: [1:0.50]
    169 ; BTVER2-NEXT:    # kill: def $cl killed $cl killed $ecx
    170 ; BTVER2-NEXT:    shrq %cl, %rsi # sched: [1:0.50]
    171 ; BTVER2-NEXT:    orq %rdi, %rsi # sched: [1:0.50]
    172 ; BTVER2-NEXT:    movq %rsi, %rax # sched: [1:0.50]
    173 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    174 ;
    175 ; BDVER1-LABEL: lshift_cl:
    176 ; BDVER1:       # %bb.0: # %entry
    177 ; BDVER1-NEXT:    movl %edx, %ecx
    178 ; BDVER1-NEXT:    shlq %cl, %rdi
    179 ; BDVER1-NEXT:    movl $64, %ecx
    180 ; BDVER1-NEXT:    subl %edx, %ecx
    181 ; BDVER1-NEXT:    # kill: def $cl killed $cl killed $ecx
    182 ; BDVER1-NEXT:    shrq %cl, %rsi
    183 ; BDVER1-NEXT:    orq %rdi, %rsi
    184 ; BDVER1-NEXT:    movq %rsi, %rax
    185 ; BDVER1-NEXT:    retq
    186 entry:
    187   %shl = shl i64 %a, %c
    188   %sub = sub nsw i64 64, %c
    189   %shr = lshr i64 %b, %sub
    190   %or = or i64 %shr, %shl
    191   ret i64 %or
    192 }
    193 
    194 
    195 ;uint64_t rshift(uint64_t a, uint64_t b, int c)
    196 ;{
    197 ;    return (a >> c) | (b << (64-c));
    198 ;}
    199 
    200 define i64 @rshift_cl_optsize(i64 %a, i64 %b, i64 %c) nounwind readnone optsize {
    201 ; GENERIC-LABEL: rshift_cl_optsize:
    202 ; GENERIC:       # %bb.0: # %entry
    203 ; GENERIC-NEXT:    movl %edx, %ecx # sched: [1:0.33]
    204 ; GENERIC-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:1.50]
    205 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
    206 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    207 ;
    208 ; BTVER2-LABEL: rshift_cl_optsize:
    209 ; BTVER2:       # %bb.0: # %entry
    210 ; BTVER2-NEXT:    movl %edx, %ecx # sched: [1:0.50]
    211 ; BTVER2-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:4.00]
    212 ; BTVER2-NEXT:    movq %rdi, %rax # sched: [1:0.50]
    213 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    214 ;
    215 ; BDVER1-LABEL: rshift_cl_optsize:
    216 ; BDVER1:       # %bb.0: # %entry
    217 ; BDVER1-NEXT:    movl %edx, %ecx
    218 ; BDVER1-NEXT:    shrdq %cl, %rsi, %rdi
    219 ; BDVER1-NEXT:    movq %rdi, %rax
    220 ; BDVER1-NEXT:    retq
    221 entry:
    222   %shr = lshr i64 %a, %c
    223   %sub = sub nsw i64 64, %c
    224   %shl = shl i64 %b, %sub
    225   %or = or i64 %shr, %shl
    226   ret i64 %or
    227 }
    228 
    229 define i64 @rshift_cl(i64 %a, i64 %b, i64 %c) nounwind readnone {
    230 ; GENERIC-LABEL: rshift_cl:
    231 ; GENERIC:       # %bb.0: # %entry
    232 ; GENERIC-NEXT:    movl %edx, %ecx # sched: [1:0.33]
    233 ; GENERIC-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:1.50]
    234 ; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
    235 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    236 ;
    237 ; BTVER2-LABEL: rshift_cl:
    238 ; BTVER2:       # %bb.0: # %entry
    239 ; BTVER2-NEXT:    movl %edx, %ecx # sched: [1:0.50]
    240 ; BTVER2-NEXT:    shrq %cl, %rdi # sched: [1:0.50]
    241 ; BTVER2-NEXT:    movl $64, %ecx # sched: [1:0.50]
    242 ; BTVER2-NEXT:    subl %edx, %ecx # sched: [1:0.50]
    243 ; BTVER2-NEXT:    # kill: def $cl killed $cl killed $ecx
    244 ; BTVER2-NEXT:    shlq %cl, %rsi # sched: [1:0.50]
    245 ; BTVER2-NEXT:    orq %rdi, %rsi # sched: [1:0.50]
    246 ; BTVER2-NEXT:    movq %rsi, %rax # sched: [1:0.50]
    247 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    248 ;
    249 ; BDVER1-LABEL: rshift_cl:
    250 ; BDVER1:       # %bb.0: # %entry
    251 ; BDVER1-NEXT:    movl %edx, %ecx
    252 ; BDVER1-NEXT:    shrq %cl, %rdi
    253 ; BDVER1-NEXT:    movl $64, %ecx
    254 ; BDVER1-NEXT:    subl %edx, %ecx
    255 ; BDVER1-NEXT:    # kill: def $cl killed $cl killed $ecx
    256 ; BDVER1-NEXT:    shlq %cl, %rsi
    257 ; BDVER1-NEXT:    orq %rdi, %rsi
    258 ; BDVER1-NEXT:    movq %rsi, %rax
    259 ; BDVER1-NEXT:    retq
    260 entry:
    261   %shr = lshr i64 %a, %c
    262   %sub = sub nsw i64 64, %c
    263   %shl = shl i64 %b, %sub
    264   %or = or i64 %shr, %shl
    265   ret i64 %or
    266 }
    267 
    268 ; extern uint64_t x;
    269 ;void lshift(uint64_t a, uint64_t b, uint_64_t c)
    270 ;{
    271 ;    x = (x << c) | (a >> (64-c));
    272 ;}
    273 @x = global i64 0, align 4
    274 
    275 define void @lshift_mem_cl_optsize(i64 %a, i64 %c) nounwind readnone optsize {
    276 ; GENERIC-LABEL: lshift_mem_cl_optsize:
    277 ; GENERIC:       # %bb.0: # %entry
    278 ; GENERIC-NEXT:    movl %esi, %ecx # sched: [1:0.33]
    279 ; GENERIC-NEXT:    shldq %cl, %rdi, {{.*}}(%rip) # sched: [10:1.50]
    280 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    281 ;
    282 ; BTVER2-LABEL: lshift_mem_cl_optsize:
    283 ; BTVER2:       # %bb.0: # %entry
    284 ; BTVER2-NEXT:    movl %esi, %ecx # sched: [1:0.50]
    285 ; BTVER2-NEXT:    shldq %cl, %rdi, {{.*}}(%rip) # sched: [9:11.00]
    286 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    287 ;
    288 ; BDVER1-LABEL: lshift_mem_cl_optsize:
    289 ; BDVER1:       # %bb.0: # %entry
    290 ; BDVER1-NEXT:    movl %esi, %ecx
    291 ; BDVER1-NEXT:    shldq %cl, %rdi, {{.*}}(%rip)
    292 ; BDVER1-NEXT:    retq
    293 entry:
    294   %b = load i64, i64* @x
    295   %shl = shl i64 %b, %c
    296   %sub = sub nsw i64 64, %c
    297   %shr = lshr i64 %a, %sub
    298   %or = or i64 %shl, %shr
    299   store i64 %or, i64* @x
    300   ret void
    301 }
    302 
    303 define void @lshift_mem_cl(i64 %a, i64 %c) nounwind readnone {
    304 ; GENERIC-LABEL: lshift_mem_cl:
    305 ; GENERIC:       # %bb.0: # %entry
    306 ; GENERIC-NEXT:    movl %esi, %ecx # sched: [1:0.33]
    307 ; GENERIC-NEXT:    shldq %cl, %rdi, {{.*}}(%rip) # sched: [10:1.50]
    308 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    309 ;
    310 ; BTVER2-LABEL: lshift_mem_cl:
    311 ; BTVER2:       # %bb.0: # %entry
    312 ; BTVER2-NEXT:    movq {{.*}}(%rip), %rax # sched: [5:1.00]
    313 ; BTVER2-NEXT:    movl %esi, %ecx # sched: [1:0.50]
    314 ; BTVER2-NEXT:    shlq %cl, %rax # sched: [1:0.50]
    315 ; BTVER2-NEXT:    movl $64, %ecx # sched: [1:0.50]
    316 ; BTVER2-NEXT:    subl %esi, %ecx # sched: [1:0.50]
    317 ; BTVER2-NEXT:    # kill: def $cl killed $cl killed $ecx
    318 ; BTVER2-NEXT:    shrq %cl, %rdi # sched: [1:0.50]
    319 ; BTVER2-NEXT:    orq %rax, %rdi # sched: [1:0.50]
    320 ; BTVER2-NEXT:    movq %rdi, {{.*}}(%rip) # sched: [1:1.00]
    321 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    322 ;
    323 ; BDVER1-LABEL: lshift_mem_cl:
    324 ; BDVER1:       # %bb.0: # %entry
    325 ; BDVER1-NEXT:    movq {{.*}}(%rip), %rax
    326 ; BDVER1-NEXT:    movl %esi, %ecx
    327 ; BDVER1-NEXT:    shlq %cl, %rax
    328 ; BDVER1-NEXT:    movl $64, %ecx
    329 ; BDVER1-NEXT:    subl %esi, %ecx
    330 ; BDVER1-NEXT:    # kill: def $cl killed $cl killed $ecx
    331 ; BDVER1-NEXT:    shrq %cl, %rdi
    332 ; BDVER1-NEXT:    orq %rax, %rdi
    333 ; BDVER1-NEXT:    movq %rdi, {{.*}}(%rip)
    334 ; BDVER1-NEXT:    retq
    335 entry:
    336   %b = load i64, i64* @x
    337   %shl = shl i64 %b, %c
    338   %sub = sub nsw i64 64, %c
    339   %shr = lshr i64 %a, %sub
    340   %or = or i64 %shl, %shr
    341   store i64 %or, i64* @x
    342   ret void
    343 }
    344 
    345 define void @lshift_mem(i64 %a) nounwind readnone {
    346 ; GENERIC-LABEL: lshift_mem:
    347 ; GENERIC:       # %bb.0: # %entry
    348 ; GENERIC-NEXT:    shldq $10, %rdi, {{.*}}(%rip) # sched: [8:1.00]
    349 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    350 ;
    351 ; BTVER2-LABEL: lshift_mem:
    352 ; BTVER2:       # %bb.0: # %entry
    353 ; BTVER2-NEXT:    movq {{.*}}(%rip), %rax # sched: [5:1.00]
    354 ; BTVER2-NEXT:    shrq $54, %rdi # sched: [1:0.50]
    355 ; BTVER2-NEXT:    shlq $10, %rax # sched: [1:0.50]
    356 ; BTVER2-NEXT:    orq %rax, %rdi # sched: [1:0.50]
    357 ; BTVER2-NEXT:    movq %rdi, {{.*}}(%rip) # sched: [1:1.00]
    358 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    359 ;
    360 ; BDVER1-LABEL: lshift_mem:
    361 ; BDVER1:       # %bb.0: # %entry
    362 ; BDVER1-NEXT:    movq {{.*}}(%rip), %rax
    363 ; BDVER1-NEXT:    shlq $10, %rax
    364 ; BDVER1-NEXT:    shrq $54, %rdi
    365 ; BDVER1-NEXT:    orq %rax, %rdi
    366 ; BDVER1-NEXT:    movq %rdi, {{.*}}(%rip)
    367 ; BDVER1-NEXT:    retq
    368 entry:
    369   %b = load i64, i64* @x
    370   %shl = shl i64 %b, 10
    371   %shr = lshr i64 %a, 54
    372   %or = or i64 %shr, %shl
    373   store i64 %or, i64* @x
    374   ret void
    375 }
    376 
    377 define void @lshift_mem_optsize(i64 %a) nounwind readnone optsize {
    378 ; GENERIC-LABEL: lshift_mem_optsize:
    379 ; GENERIC:       # %bb.0: # %entry
    380 ; GENERIC-NEXT:    shldq $10, %rdi, {{.*}}(%rip) # sched: [8:1.00]
    381 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    382 ;
    383 ; BTVER2-LABEL: lshift_mem_optsize:
    384 ; BTVER2:       # %bb.0: # %entry
    385 ; BTVER2-NEXT:    shldq $10, %rdi, {{.*}}(%rip) # sched: [9:11.00]
    386 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    387 ;
    388 ; BDVER1-LABEL: lshift_mem_optsize:
    389 ; BDVER1:       # %bb.0: # %entry
    390 ; BDVER1-NEXT:    shldq $10, %rdi, {{.*}}(%rip)
    391 ; BDVER1-NEXT:    retq
    392 entry:
    393   %b = load i64, i64* @x
    394   %shl = shl i64 %b, 10
    395   %shr = lshr i64 %a, 54
    396   %or = or i64 %shr, %shl
    397   store i64 %or, i64* @x
    398   ret void
    399 }
    400 
    401 define void @lshift_mem_b(i64 %b) nounwind readnone {
    402 ; GENERIC-LABEL: lshift_mem_b:
    403 ; GENERIC:       # %bb.0: # %entry
    404 ; GENERIC-NEXT:    movq {{.*}}(%rip), %rax # sched: [5:0.50]
    405 ; GENERIC-NEXT:    shrdq $54, %rdi, %rax # sched: [2:0.67]
    406 ; GENERIC-NEXT:    movq %rax, {{.*}}(%rip) # sched: [1:1.00]
    407 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    408 ;
    409 ; BTVER2-LABEL: lshift_mem_b:
    410 ; BTVER2:       # %bb.0: # %entry
    411 ; BTVER2-NEXT:    movq {{.*}}(%rip), %rax # sched: [5:1.00]
    412 ; BTVER2-NEXT:    shlq $10, %rdi # sched: [1:0.50]
    413 ; BTVER2-NEXT:    shrq $54, %rax # sched: [1:0.50]
    414 ; BTVER2-NEXT:    orq %rdi, %rax # sched: [1:0.50]
    415 ; BTVER2-NEXT:    movq %rax, {{.*}}(%rip) # sched: [1:1.00]
    416 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    417 ;
    418 ; BDVER1-LABEL: lshift_mem_b:
    419 ; BDVER1:       # %bb.0: # %entry
    420 ; BDVER1-NEXT:    movq {{.*}}(%rip), %rax
    421 ; BDVER1-NEXT:    shlq $10, %rdi
    422 ; BDVER1-NEXT:    shrq $54, %rax
    423 ; BDVER1-NEXT:    orq %rdi, %rax
    424 ; BDVER1-NEXT:    movq %rax, {{.*}}(%rip)
    425 ; BDVER1-NEXT:    retq
    426 entry:
    427   %a = load i64, i64* @x
    428   %shl = shl i64 %b, 10
    429   %shr = lshr i64 %a, 54
    430   %or = or i64 %shr, %shl
    431   store i64 %or, i64* @x
    432   ret void
    433 }
    434 
    435 define void @lshift_mem_b_optsize(i64 %b) nounwind readnone optsize {
    436 ; GENERIC-LABEL: lshift_mem_b_optsize:
    437 ; GENERIC:       # %bb.0: # %entry
    438 ; GENERIC-NEXT:    movq {{.*}}(%rip), %rax # sched: [5:0.50]
    439 ; GENERIC-NEXT:    shrdq $54, %rdi, %rax # sched: [2:0.67]
    440 ; GENERIC-NEXT:    movq %rax, {{.*}}(%rip) # sched: [1:1.00]
    441 ; GENERIC-NEXT:    retq # sched: [1:1.00]
    442 ;
    443 ; BTVER2-LABEL: lshift_mem_b_optsize:
    444 ; BTVER2:       # %bb.0: # %entry
    445 ; BTVER2-NEXT:    movq {{.*}}(%rip), %rax # sched: [5:1.00]
    446 ; BTVER2-NEXT:    shrdq $54, %rdi, %rax # sched: [3:3.00]
    447 ; BTVER2-NEXT:    movq %rax, {{.*}}(%rip) # sched: [1:1.00]
    448 ; BTVER2-NEXT:    retq # sched: [4:1.00]
    449 ;
    450 ; BDVER1-LABEL: lshift_mem_b_optsize:
    451 ; BDVER1:       # %bb.0: # %entry
    452 ; BDVER1-NEXT:    movq {{.*}}(%rip), %rax
    453 ; BDVER1-NEXT:    shrdq $54, %rdi, %rax
    454 ; BDVER1-NEXT:    movq %rax, {{.*}}(%rip)
    455 ; BDVER1-NEXT:    retq
    456 entry:
    457   %a = load i64, i64* @x
    458   %shl = shl i64 %b, 10
    459   %shr = lshr i64 %a, 54
    460   %or = or i64 %shr, %shl
    461   store i64 %or, i64* @x
    462   ret void
    463 }
    464 
    465