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-- -mcpu=corei7 | FileCheck %s --check-prefix=ALL --check-prefix=X64
      3 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=corei7-avx | FileCheck %s --check-prefix=ALL --check-prefix=SHLD
      4 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=core-avx2 | FileCheck %s --check-prefix=ALL --check-prefix=BMI2
      5 
      6 define i64 @foo(i64 %x, i64 %y, i64 %z) nounwind readnone {
      7 ; ALL-LABEL: foo:
      8 ; ALL:       # %bb.0: # %entry
      9 ; ALL-NEXT:    movl %edx, %ecx
     10 ; ALL-NEXT:    rolq %cl, %rdi
     11 ; ALL-NEXT:    movq %rdi, %rax
     12 ; ALL-NEXT:    retq
     13 entry:
     14 	%0 = shl i64 %x, %z
     15 	%1 = sub i64 64, %z
     16 	%2 = lshr i64 %x, %1
     17 	%3 = or i64 %2, %0
     18 	ret i64 %3
     19 }
     20 
     21 define i64 @bar(i64 %x, i64 %y, i64 %z) nounwind readnone {
     22 ; ALL-LABEL: bar:
     23 ; ALL:       # %bb.0: # %entry
     24 ; ALL-NEXT:    movl %edx, %ecx
     25 ; ALL-NEXT:    shldq %cl, %rdi, %rsi
     26 ; ALL-NEXT:    movq %rsi, %rax
     27 ; ALL-NEXT:    retq
     28 entry:
     29 	%0 = shl i64 %y, %z
     30 	%1 = sub i64 64, %z
     31 	%2 = lshr i64 %x, %1
     32 	%3 = or i64 %2, %0
     33 	ret i64 %3
     34 }
     35 
     36 define i64 @un(i64 %x, i64 %y, i64 %z) nounwind readnone {
     37 ; ALL-LABEL: un:
     38 ; ALL:       # %bb.0: # %entry
     39 ; ALL-NEXT:    movl %edx, %ecx
     40 ; ALL-NEXT:    rorq %cl, %rdi
     41 ; ALL-NEXT:    movq %rdi, %rax
     42 ; ALL-NEXT:    retq
     43 entry:
     44 	%0 = lshr i64 %x, %z
     45 	%1 = sub i64 64, %z
     46 	%2 = shl i64 %x, %1
     47 	%3 = or i64 %2, %0
     48 	ret i64 %3
     49 }
     50 
     51 define i64 @bu(i64 %x, i64 %y, i64 %z) nounwind readnone {
     52 ; ALL-LABEL: bu:
     53 ; ALL:       # %bb.0: # %entry
     54 ; ALL-NEXT:    movl %edx, %ecx
     55 ; ALL-NEXT:    shrdq %cl, %rdi, %rsi
     56 ; ALL-NEXT:    movq %rsi, %rax
     57 ; ALL-NEXT:    retq
     58 entry:
     59 	%0 = lshr i64 %y, %z
     60 	%1 = sub i64 64, %z
     61 	%2 = shl i64 %x, %1
     62 	%3 = or i64 %2, %0
     63 	ret i64 %3
     64 }
     65 
     66 define i64 @xfoo(i64 %x, i64 %y, i64 %z) nounwind readnone {
     67 ; X64-LABEL: xfoo:
     68 ; X64:       # %bb.0: # %entry
     69 ; X64-NEXT:    rolq $7, %rdi
     70 ; X64-NEXT:    movq %rdi, %rax
     71 ; X64-NEXT:    retq
     72 ;
     73 ; SHLD-LABEL: xfoo:
     74 ; SHLD:       # %bb.0: # %entry
     75 ; SHLD-NEXT:    shldq $7, %rdi, %rdi
     76 ; SHLD-NEXT:    movq %rdi, %rax
     77 ; SHLD-NEXT:    retq
     78 ;
     79 ; BMI2-LABEL: xfoo:
     80 ; BMI2:       # %bb.0: # %entry
     81 ; BMI2-NEXT:    rorxq $57, %rdi, %rax
     82 ; BMI2-NEXT:    retq
     83 entry:
     84 	%0 = lshr i64 %x, 57
     85 	%1 = shl i64 %x, 7
     86 	%2 = or i64 %0, %1
     87 	ret i64 %2
     88 }
     89 
     90 define i64 @xfoop(i64* %p) nounwind readnone {
     91 ; X64-LABEL: xfoop:
     92 ; X64:       # %bb.0: # %entry
     93 ; X64-NEXT:    movq (%rdi), %rax
     94 ; X64-NEXT:    rolq $7, %rax
     95 ; X64-NEXT:    retq
     96 ;
     97 ; SHLD-LABEL: xfoop:
     98 ; SHLD:       # %bb.0: # %entry
     99 ; SHLD-NEXT:    movq (%rdi), %rax
    100 ; SHLD-NEXT:    shldq $7, %rax, %rax
    101 ; SHLD-NEXT:    retq
    102 ;
    103 ; BMI2-LABEL: xfoop:
    104 ; BMI2:       # %bb.0: # %entry
    105 ; BMI2-NEXT:    rorxq $57, (%rdi), %rax
    106 ; BMI2-NEXT:    retq
    107 entry:
    108 	%x = load i64, i64* %p
    109 	%a = lshr i64 %x, 57
    110 	%b = shl i64 %x, 7
    111 	%c = or i64 %a, %b
    112 	ret i64 %c
    113 }
    114 
    115 define i64 @xbar(i64 %x, i64 %y, i64 %z) nounwind readnone {
    116 ; ALL-LABEL: xbar:
    117 ; ALL:       # %bb.0: # %entry
    118 ; ALL-NEXT:    shrdq $57, %rsi, %rdi
    119 ; ALL-NEXT:    movq %rdi, %rax
    120 ; ALL-NEXT:    retq
    121 entry:
    122 	%0 = shl i64 %y, 7
    123 	%1 = lshr i64 %x, 57
    124 	%2 = or i64 %0, %1
    125 	ret i64 %2
    126 }
    127 
    128 define i64 @xun(i64 %x, i64 %y, i64 %z) nounwind readnone {
    129 ; X64-LABEL: xun:
    130 ; X64:       # %bb.0: # %entry
    131 ; X64-NEXT:    rolq $57, %rdi
    132 ; X64-NEXT:    movq %rdi, %rax
    133 ; X64-NEXT:    retq
    134 ;
    135 ; SHLD-LABEL: xun:
    136 ; SHLD:       # %bb.0: # %entry
    137 ; SHLD-NEXT:    shldq $57, %rdi, %rdi
    138 ; SHLD-NEXT:    movq %rdi, %rax
    139 ; SHLD-NEXT:    retq
    140 ;
    141 ; BMI2-LABEL: xun:
    142 ; BMI2:       # %bb.0: # %entry
    143 ; BMI2-NEXT:    rorxq $7, %rdi, %rax
    144 ; BMI2-NEXT:    retq
    145 entry:
    146 	%0 = lshr i64 %x, 7
    147 	%1 = shl i64 %x, 57
    148 	%2 = or i64 %0, %1
    149 	ret i64 %2
    150 }
    151 
    152 define i64 @xunp(i64* %p) nounwind readnone {
    153 ; X64-LABEL: xunp:
    154 ; X64:       # %bb.0: # %entry
    155 ; X64-NEXT:    movq (%rdi), %rax
    156 ; X64-NEXT:    rolq $57, %rax
    157 ; X64-NEXT:    retq
    158 ;
    159 ; SHLD-LABEL: xunp:
    160 ; SHLD:       # %bb.0: # %entry
    161 ; SHLD-NEXT:    movq (%rdi), %rax
    162 ; SHLD-NEXT:    shldq $57, %rax, %rax
    163 ; SHLD-NEXT:    retq
    164 ;
    165 ; BMI2-LABEL: xunp:
    166 ; BMI2:       # %bb.0: # %entry
    167 ; BMI2-NEXT:    rorxq $7, (%rdi), %rax
    168 ; BMI2-NEXT:    retq
    169 entry:
    170 	%x = load i64, i64* %p
    171 	%a = lshr i64 %x, 7
    172 	%b = shl i64 %x, 57
    173 	%c = or i64 %a, %b
    174 	ret i64 %c
    175 }
    176 
    177 define i64 @xbu(i64 %x, i64 %y, i64 %z) nounwind readnone {
    178 ; ALL-LABEL: xbu:
    179 ; ALL:       # %bb.0: # %entry
    180 ; ALL-NEXT:    shldq $57, %rsi, %rdi
    181 ; ALL-NEXT:    movq %rdi, %rax
    182 ; ALL-NEXT:    retq
    183 entry:
    184 	%0 = lshr i64 %y, 7
    185 	%1 = shl i64 %x, 57
    186 	%2 = or i64 %0, %1
    187 	ret i64 %2
    188 }
    189