1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -fixup-byte-word-insts=1 -mtriple=x86_64-- < %s | FileCheck --check-prefix=X64 %s
3 ; RUN: llc -verify-machineinstrs -fixup-byte-word-insts=0 -mtriple=x86_64-- < %s | FileCheck --check-prefix=X64 %s
4 ; RUN: llc -verify-machineinstrs -fixup-byte-word-insts=1 -mtriple=i386-- < %s | FileCheck --check-prefixes=X86,X86-BWON %s
5 ; RUN: llc -verify-machineinstrs -fixup-byte-word-insts=0 -mtriple=i386-- < %s | FileCheck --check-prefixes=X86,X86-BWOFF %s
7 target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
9 define i8 @test_movb(i8 %a0) nounwind {
10 ; X64-LABEL: test_movb:
12 ; X64-NEXT: movl %edi, %eax
13 ; X64-NEXT: # kill: def $al killed $al killed $eax
16 ; X86-BWON-LABEL: test_movb:
18 ; X86-BWON-NEXT: movzbl {{[0-9]+}}(%esp), %eax
21 ; X86-BWOFF-LABEL: test_movb:
23 ; X86-BWOFF-NEXT: movb {{[0-9]+}}(%esp), %al
24 ; X86-BWOFF-NEXT: retl
28 define i8 @test_movb_Os(i8 %a0) nounwind optsize {
29 ; X64-LABEL: test_movb_Os:
31 ; X64-NEXT: movl %edi, %eax
32 ; X64-NEXT: # kill: def $al killed $al killed $eax
35 ; X86-LABEL: test_movb_Os:
37 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
42 define i8 @test_movb_Oz(i8 %a0) nounwind minsize {
43 ; X64-LABEL: test_movb_Oz:
45 ; X64-NEXT: movl %edi, %eax
46 ; X64-NEXT: # kill: def $al killed $al killed $eax
49 ; X86-LABEL: test_movb_Oz:
51 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
56 define i16 @test_movw(i16 %a0) {
57 ; X64-LABEL: test_movw:
59 ; X64-NEXT: movl %edi, %eax
60 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
63 ; X86-BWON-LABEL: test_movw:
65 ; X86-BWON-NEXT: movzwl {{[0-9]+}}(%esp), %eax
68 ; X86-BWOFF-LABEL: test_movw:
70 ; X86-BWOFF-NEXT: movw {{[0-9]+}}(%esp), %ax
71 ; X86-BWOFF-NEXT: retl
75 ; Verify we don't mess with H-reg copies (only generated in 32-bit mode).
76 define i8 @test_movb_hreg(i16 %a0) {
77 ; X64-LABEL: test_movb_hreg:
79 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
80 ; X64-NEXT: movl %edi, %eax
81 ; X64-NEXT: shrl $8, %eax
82 ; X64-NEXT: addl %edi, %eax
83 ; X64-NEXT: # kill: def $al killed $al killed $eax
86 ; X86-LABEL: test_movb_hreg:
88 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
89 ; X86-NEXT: addb %al, %ah
90 ; X86-NEXT: movb %ah, %al
92 %tmp0 = trunc i16 %a0 to i8
93 %tmp1 = lshr i16 %a0, 8
94 %tmp2 = trunc i16 %tmp1 to i8
95 %tmp3 = add i8 %tmp0, %tmp2