[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting...
[oota-llvm.git] / test / CodeGen / X86 / h-register-store.ll
1 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
2 ; X64:      mov
3 ; X64-NEXT: movb %ah, (%rsi)
4 ; X64:      mov
5 ; X64-NEXT: movb %ah, (%rsi)
6 ; X64:      mov
7 ; X64-NEXT: movb %ah, (%rsi)
8 ; X64-NOT:      mov
9
10 ; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s -check-prefix=X32
11 ; X32:      mov
12 ; X32-NEXT: movb %ah, (%esi)
13 ; X32:      mov
14 ; X32-NEXT: movb %ah, (%esi)
15 ; X32:      mov
16 ; X32-NEXT: movb %ah, (%esi)
17 ; X32-NOT:      mov
18
19 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64
20 ; W64-NOT:      mov
21 ; W64:      movb %ch, (%rdx)
22 ; W64-NOT:      mov
23 ; W64:      movb %ch, (%rdx)
24 ; W64-NOT:      mov
25 ; W64:      movb %ch, (%rdx)
26 ; W64-NOT:      mov
27
28 ; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X86
29 ; X86-NOT:      mov
30 ; X86:      movb %ah, (%e
31 ; X86-NOT:      mov
32 ; X86:      movb %ah, (%e
33 ; X86-NOT:      mov
34 ; X86:      movb %ah, (%e
35 ; X86-NOT:      mov
36
37 ; Use h-register extract and store.
38
39 define void @foo16(i16 inreg %p, i8* inreg %z) nounwind {
40   %q = lshr i16 %p, 8
41   %t = trunc i16 %q to i8
42   store i8 %t, i8* %z
43   ret void
44 }
45 define void @foo32(i32 inreg %p, i8* inreg %z) nounwind {
46   %q = lshr i32 %p, 8
47   %t = trunc i32 %q to i8
48   store i8 %t, i8* %z
49   ret void
50 }
51 define void @foo64(i64 inreg %p, i8* inreg %z) nounwind {
52   %q = lshr i64 %p, 8
53   %t = trunc i64 %q to i8
54   store i8 %t, i8* %z
55   ret void
56 }