1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X32 3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64 4 5 define i16 @foo(i16 %x, i16 %y, i16 %z) nounwind { 6 ; X32-LABEL: foo: 7 ; X32: # %bb.0: 8 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl 9 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 10 ; X32-NEXT: rolw %cl, %ax 11 ; X32-NEXT: retl 12 ; 13 ; X64-LABEL: foo: 14 ; X64: # %bb.0: 15 ; X64-NEXT: movl %edx, %ecx 16 ; X64-NEXT: shldw %cl, %di, %di 17 ; X64-NEXT: movl %edi, %eax 18 ; X64-NEXT: retq 19 %t0 = shl i16 %x, %z 20 %t1 = sub i16 16, %z 21 %t2 = lshr i16 %x, %t1 22 %t3 = or i16 %t2, %t0 23 ret i16 %t3 24 } 25 26 define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind { 27 ; X32-LABEL: bar: 28 ; X32: # %bb.0: 29 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl 30 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx 31 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 32 ; X32-NEXT: shldw %cl, %dx, %ax 33 ; X32-NEXT: retl 34 ; 35 ; X64-LABEL: bar: 36 ; X64: # %bb.0: 37 ; X64-NEXT: movl %edx, %ecx 38 ; X64-NEXT: shldw %cl, %di, %si 39 ; X64-NEXT: movl %esi, %eax 40 ; X64-NEXT: retq 41 %t0 = shl i16 %y, %z 42 %t1 = sub i16 16, %z 43 %t2 = lshr i16 %x, %t1 44 %t3 = or i16 %t2, %t0 45 ret i16 %t3 46 } 47 48 define i16 @un(i16 %x, i16 %y, i16 %z) nounwind { 49 ; X32-LABEL: un: 50 ; X32: # %bb.0: 51 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl 52 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 53 ; X32-NEXT: rorw %cl, %ax 54 ; X32-NEXT: retl 55 ; 56 ; X64-LABEL: un: 57 ; X64: # %bb.0: 58 ; X64-NEXT: movl %edx, %ecx 59 ; X64-NEXT: shrdw %cl, %di, %di 60 ; X64-NEXT: movl %edi, %eax 61 ; X64-NEXT: retq 62 %t0 = lshr i16 %x, %z 63 %t1 = sub i16 16, %z 64 %t2 = shl i16 %x, %t1 65 %t3 = or i16 %t2, %t0 66 ret i16 %t3 67 } 68 69 define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind { 70 ; X32-LABEL: bu: 71 ; X32: # %bb.0: 72 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl 73 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx 74 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 75 ; X32-NEXT: shrdw %cl, %dx, %ax 76 ; X32-NEXT: retl 77 ; 78 ; X64-LABEL: bu: 79 ; X64: # %bb.0: 80 ; X64-NEXT: movl %edx, %ecx 81 ; X64-NEXT: shrdw %cl, %di, %si 82 ; X64-NEXT: movl %esi, %eax 83 ; X64-NEXT: retq 84 %t0 = lshr i16 %y, %z 85 %t1 = sub i16 16, %z 86 %t2 = shl i16 %x, %t1 87 %t3 = or i16 %t2, %t0 88 ret i16 %t3 89 } 90 91 define i16 @xfoo(i16 %x, i16 %y, i16 %z) nounwind { 92 ; X32-LABEL: xfoo: 93 ; X32: # %bb.0: 94 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 95 ; X32-NEXT: rolw $5, %ax 96 ; X32-NEXT: retl 97 ; 98 ; X64-LABEL: xfoo: 99 ; X64: # %bb.0: 100 ; X64-NEXT: rolw $5, %di 101 ; X64-NEXT: movl %edi, %eax 102 ; X64-NEXT: retq 103 %t0 = lshr i16 %x, 11 104 %t1 = shl i16 %x, 5 105 %t2 = or i16 %t0, %t1 106 ret i16 %t2 107 } 108 109 define i16 @xbar(i16 %x, i16 %y, i16 %z) nounwind { 110 ; X32-LABEL: xbar: 111 ; X32: # %bb.0: 112 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx 113 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 114 ; X32-NEXT: shldw $5, %cx, %ax 115 ; X32-NEXT: retl 116 ; 117 ; X64-LABEL: xbar: 118 ; X64: # %bb.0: 119 ; X64-NEXT: shldw $5, %di, %si 120 ; X64-NEXT: movl %esi, %eax 121 ; X64-NEXT: retq 122 %t0 = shl i16 %y, 5 123 %t1 = lshr i16 %x, 11 124 %t2 = or i16 %t0, %t1 125 ret i16 %t2 126 } 127 128 define i16 @xun(i16 %x, i16 %y, i16 %z) nounwind { 129 ; X32-LABEL: xun: 130 ; X32: # %bb.0: 131 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 132 ; X32-NEXT: rolw $11, %ax 133 ; X32-NEXT: retl 134 ; 135 ; X64-LABEL: xun: 136 ; X64: # %bb.0: 137 ; X64-NEXT: rolw $11, %di 138 ; X64-NEXT: movl %edi, %eax 139 ; X64-NEXT: retq 140 %t0 = lshr i16 %x, 5 141 %t1 = shl i16 %x, 11 142 %t2 = or i16 %t0, %t1 143 ret i16 %t2 144 } 145 146 define i16 @xbu(i16 %x, i16 %y, i16 %z) nounwind { 147 ; X32-LABEL: xbu: 148 ; X32: # %bb.0: 149 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx 150 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax 151 ; X32-NEXT: shldw $11, %cx, %ax 152 ; X32-NEXT: retl 153 ; 154 ; X64-LABEL: xbu: 155 ; X64: # %bb.0: 156 ; X64-NEXT: shldw $11, %si, %di 157 ; X64-NEXT: movl %edi, %eax 158 ; X64-NEXT: retq 159 %t0 = lshr i16 %y, 5 160 %t1 = shl i16 %x, 11 161 %t2 = or i16 %t0, %t1 162 ret i16 %t2 163 } 164