1 ; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-linux | FileCheck %s -check-prefix=X86-64
2 ; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-linux-gnux32 | FileCheck %s -check-prefix=X86-64
3 ; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
4 ; RUN: llc < %s -mattr=-bmi -mtriple=i686-- | FileCheck %s -check-prefix=X86-32
6 ; Use h registers. On x86-64, codegen doesn't support general allocation
7 ; of h registers yet, due to x86 encoding complications.
9 define void @bar64(i64 inreg %x, i8* inreg %p) nounwind {
10 ; X86-64-LABEL: bar64:
11 ; X86-64: shrq $8, %rdi
14 ; See FIXME: on regclass GR8.
15 ; It could be optimally transformed like; incb %ch; movb %ch, (%rdx)
17 ; WIN64: shrq $8, %rcx
20 ; X86-32-LABEL: bar64:
23 %t1 = trunc i64 %t0 to i8
29 define void @bar32(i32 inreg %x, i8* inreg %p) nounwind {
30 ; X86-64-LABEL: bar32:
31 ; X86-64: shrl $8, %edi
35 ; WIN64: shrl $8, %ecx
38 ; X86-32-LABEL: bar32:
41 %t1 = trunc i32 %t0 to i8
47 define void @bar16(i16 inreg %x, i8* inreg %p) nounwind {
48 ; X86-64-LABEL: bar16:
49 ; X86-64: shrl $8, %edi
53 ; WIN64: shrl $8, %ecx
56 ; X86-32-LABEL: bar16:
59 %t1 = trunc i16 %t0 to i8
65 define i64 @qux64(i64 inreg %x) nounwind {
66 ; X86-64-LABEL: qux64:
67 ; X86-64: movq %rdi, %rax
68 ; X86-64: movzbl %ah, %eax
71 ; WIN64: movzbl %ch, %eax
73 ; X86-32-LABEL: qux64:
74 ; X86-32: movzbl %ah, %eax
76 %t1 = and i64 %t0, 255
80 define i32 @qux32(i32 inreg %x) nounwind {
81 ; X86-64-LABEL: qux32:
82 ; X86-64: movl %edi, %eax
83 ; X86-64: movzbl %ah, %eax
86 ; WIN64: movzbl %ch, %eax
88 ; X86-32-LABEL: qux32:
89 ; X86-32: movzbl %ah, %eax
91 %t1 = and i32 %t0, 255
95 define i16 @qux16(i16 inreg %x) nounwind {
96 ; X86-64-LABEL: qux16:
97 ; X86-64: movl %edi, %eax
98 ; X86-64: movzbl %ah, %eax
100 ; WIN64-LABEL: qux16:
101 ; WIN64: movzwl %cx, %eax
102 ; WIN64: shrl $8, %eax
104 ; X86-32-LABEL: qux16:
105 ; X86-32: movzbl %ah, %eax