1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-linux | FileCheck %s -check-prefix=X86-64 -check-prefix=X64
; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-linux-gnux32 | FileCheck %s -check-prefix=X86-64 -check-prefix=X32
; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
; RUN: llc < %s -mattr=-bmi -mtriple=i686-- | FileCheck %s -check-prefix=X86-32
; Use h registers. On x86-64, codegen doesn't support general allocation
; of h registers yet, due to x86 encoding complications.
define void @bar64(i64 inreg %x, ptr inreg %p) nounwind {
; X64-LABEL: bar64:
; X64: # %bb.0:
; X64-NEXT: shrl $8, %edi
; X64-NEXT: incb %dil
; X64-NEXT: movb %dil, (%rsi)
; X64-NEXT: retq
;
; X32-LABEL: bar64:
; X32: # %bb.0:
; X32-NEXT: shrl $8, %edi
; X32-NEXT: incb %dil
; X32-NEXT: movb %dil, (%esi)
; X32-NEXT: retq
;
; WIN64-LABEL: bar64:
; WIN64: # %bb.0:
; WIN64-NEXT: shrl $8, %ecx
; WIN64-NEXT: incb %cl
; WIN64-NEXT: movb %cl, (%rdx)
; WIN64-NEXT: retq
;
; X86-32-LABEL: bar64:
; X86-32: # %bb.0:
; X86-32-NEXT: incb %ah
; X86-32-NEXT: movb %ah, (%ecx)
; X86-32-NEXT: retl
; See FIXME: on regclass GR8.
; It could be optimally transformed like; incb %ch; movb %ch, (%rdx)
%t0 = lshr i64 %x, 8
%t1 = trunc i64 %t0 to i8
%t2 = add i8 %t1, 1
store i8 %t2, ptr %p
ret void
}
define void @bar32(i32 inreg %x, ptr inreg %p) nounwind {
; X64-LABEL: bar32:
; X64: # %bb.0:
; X64-NEXT: shrl $8, %edi
; X64-NEXT: incb %dil
; X64-NEXT: movb %dil, (%rsi)
; X64-NEXT: retq
;
; X32-LABEL: bar32:
; X32: # %bb.0:
; X32-NEXT: shrl $8, %edi
; X32-NEXT: incb %dil
; X32-NEXT: movb %dil, (%esi)
; X32-NEXT: retq
;
; WIN64-LABEL: bar32:
; WIN64: # %bb.0:
; WIN64-NEXT: shrl $8, %ecx
; WIN64-NEXT: incb %cl
; WIN64-NEXT: movb %cl, (%rdx)
; WIN64-NEXT: retq
;
; X86-32-LABEL: bar32:
; X86-32: # %bb.0:
; X86-32-NEXT: incb %ah
; X86-32-NEXT: movb %ah, (%edx)
; X86-32-NEXT: retl
%t0 = lshr i32 %x, 8
%t1 = trunc i32 %t0 to i8
%t2 = add i8 %t1, 1
store i8 %t2, ptr %p
ret void
}
define void @bar16(i16 inreg %x, ptr inreg %p) nounwind {
; X64-LABEL: bar16:
; X64: # %bb.0:
; X64-NEXT: shrl $8, %edi
; X64-NEXT: incb %dil
; X64-NEXT: movb %dil, (%rsi)
; X64-NEXT: retq
;
; X32-LABEL: bar16:
; X32: # %bb.0:
; X32-NEXT: shrl $8, %edi
; X32-NEXT: incb %dil
; X32-NEXT: movb %dil, (%esi)
; X32-NEXT: retq
;
; WIN64-LABEL: bar16:
; WIN64: # %bb.0:
; WIN64-NEXT: # kill: def $cx killed $cx def $ecx
; WIN64-NEXT: shrl $8, %ecx
; WIN64-NEXT: incb %cl
; WIN64-NEXT: movb %cl, (%rdx)
; WIN64-NEXT: retq
;
; X86-32-LABEL: bar16:
; X86-32: # %bb.0:
; X86-32-NEXT: incb %ah
; X86-32-NEXT: movb %ah, (%edx)
; X86-32-NEXT: retl
%t0 = lshr i16 %x, 8
%t1 = trunc i16 %t0 to i8
%t2 = add i8 %t1, 1
store i8 %t2, ptr %p
ret void
}
define i64 @qux64(i64 inreg %x) nounwind {
; X86-64-LABEL: qux64:
; X86-64: # %bb.0:
; X86-64-NEXT: movq %rdi, %rax
; X86-64-NEXT: movzbl %ah, %eax
; X86-64-NEXT: retq
;
; WIN64-LABEL: qux64:
; WIN64: # %bb.0:
; WIN64-NEXT: movzbl %ch, %eax
; WIN64-NEXT: retq
;
; X86-32-LABEL: qux64:
; X86-32: # %bb.0:
; X86-32-NEXT: movzbl %ah, %eax
; X86-32-NEXT: xorl %edx, %edx
; X86-32-NEXT: retl
%t0 = lshr i64 %x, 8
%t1 = and i64 %t0, 255
ret i64 %t1
}
define i32 @qux32(i32 inreg %x) nounwind {
; X86-64-LABEL: qux32:
; X86-64: # %bb.0:
; X86-64-NEXT: movl %edi, %eax
; X86-64-NEXT: movzbl %ah, %eax
; X86-64-NEXT: retq
;
; WIN64-LABEL: qux32:
; WIN64: # %bb.0:
; WIN64-NEXT: movzbl %ch, %eax
; WIN64-NEXT: retq
;
; X86-32-LABEL: qux32:
; X86-32: # %bb.0:
; X86-32-NEXT: movzbl %ah, %eax
; X86-32-NEXT: retl
%t0 = lshr i32 %x, 8
%t1 = and i32 %t0, 255
ret i32 %t1
}
define i16 @qux16(i16 inreg %x) nounwind {
; X86-64-LABEL: qux16:
; X86-64: # %bb.0:
; X86-64-NEXT: movl %edi, %eax
; X86-64-NEXT: movzbl %ah, %eax
; X86-64-NEXT: # kill: def $ax killed $ax killed $eax
; X86-64-NEXT: retq
;
; WIN64-LABEL: qux16:
; WIN64: # %bb.0:
; WIN64-NEXT: movzwl %cx, %eax
; WIN64-NEXT: shrl $8, %eax
; WIN64-NEXT: # kill: def $ax killed $ax killed $eax
; WIN64-NEXT: retq
;
; X86-32-LABEL: qux16:
; X86-32: # %bb.0:
; X86-32-NEXT: movzbl %ah, %eax
; X86-32-NEXT: # kill: def $ax killed $ax killed $eax
; X86-32-NEXT: retl
%t0 = lshr i16 %x, 8
ret i16 %t0
}
|