193 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-linux | FileCheck %s -check-prefix=X86-64 -check-prefix=X643; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-linux-gnux32 | FileCheck %s -check-prefix=X86-64 -check-prefix=X324; RUN: llc < %s -mattr=-bmi -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN645; RUN: llc < %s -mattr=-bmi -mtriple=i686-- | FileCheck %s -check-prefix=X86-326 7; Use h registers. On x86-64, codegen doesn't support general allocation8; of h registers yet, due to x86 encoding complications.9 10define void @bar64(i64 inreg %x, ptr inreg %p) nounwind {11; X64-LABEL: bar64:12; X64: # %bb.0:13; X64-NEXT: shrl $8, %edi14; X64-NEXT: incb %dil15; X64-NEXT: movb %dil, (%rsi)16; X64-NEXT: retq17;18; X32-LABEL: bar64:19; X32: # %bb.0:20; X32-NEXT: shrl $8, %edi21; X32-NEXT: incb %dil22; X32-NEXT: movb %dil, (%esi)23; X32-NEXT: retq24;25; WIN64-LABEL: bar64:26; WIN64: # %bb.0:27; WIN64-NEXT: shrl $8, %ecx28; WIN64-NEXT: incb %cl29; WIN64-NEXT: movb %cl, (%rdx)30; WIN64-NEXT: retq31;32; X86-32-LABEL: bar64:33; X86-32: # %bb.0:34; X86-32-NEXT: incb %ah35; X86-32-NEXT: movb %ah, (%ecx)36; X86-32-NEXT: retl37 38; See FIXME: on regclass GR8.39; It could be optimally transformed like; incb %ch; movb %ch, (%rdx)40 41 %t0 = lshr i64 %x, 842 %t1 = trunc i64 %t0 to i843 %t2 = add i8 %t1, 144 store i8 %t2, ptr %p45 ret void46}47 48define void @bar32(i32 inreg %x, ptr inreg %p) nounwind {49; X64-LABEL: bar32:50; X64: # %bb.0:51; X64-NEXT: shrl $8, %edi52; X64-NEXT: incb %dil53; X64-NEXT: movb %dil, (%rsi)54; X64-NEXT: retq55;56; X32-LABEL: bar32:57; X32: # %bb.0:58; X32-NEXT: shrl $8, %edi59; X32-NEXT: incb %dil60; X32-NEXT: movb %dil, (%esi)61; X32-NEXT: retq62;63; WIN64-LABEL: bar32:64; WIN64: # %bb.0:65; WIN64-NEXT: shrl $8, %ecx66; WIN64-NEXT: incb %cl67; WIN64-NEXT: movb %cl, (%rdx)68; WIN64-NEXT: retq69;70; X86-32-LABEL: bar32:71; X86-32: # %bb.0:72; X86-32-NEXT: incb %ah73; X86-32-NEXT: movb %ah, (%edx)74; X86-32-NEXT: retl75 76 77 %t0 = lshr i32 %x, 878 %t1 = trunc i32 %t0 to i879 %t2 = add i8 %t1, 180 store i8 %t2, ptr %p81 ret void82}83 84define void @bar16(i16 inreg %x, ptr inreg %p) nounwind {85; X64-LABEL: bar16:86; X64: # %bb.0:87; X64-NEXT: shrl $8, %edi88; X64-NEXT: incb %dil89; X64-NEXT: movb %dil, (%rsi)90; X64-NEXT: retq91;92; X32-LABEL: bar16:93; X32: # %bb.0:94; X32-NEXT: shrl $8, %edi95; X32-NEXT: incb %dil96; X32-NEXT: movb %dil, (%esi)97; X32-NEXT: retq98;99; WIN64-LABEL: bar16:100; WIN64: # %bb.0:101; WIN64-NEXT: # kill: def $cx killed $cx def $ecx102; WIN64-NEXT: shrl $8, %ecx103; WIN64-NEXT: incb %cl104; WIN64-NEXT: movb %cl, (%rdx)105; WIN64-NEXT: retq106;107; X86-32-LABEL: bar16:108; X86-32: # %bb.0:109; X86-32-NEXT: incb %ah110; X86-32-NEXT: movb %ah, (%edx)111; X86-32-NEXT: retl112 113 114 %t0 = lshr i16 %x, 8115 %t1 = trunc i16 %t0 to i8116 %t2 = add i8 %t1, 1117 store i8 %t2, ptr %p118 ret void119}120 121define i64 @qux64(i64 inreg %x) nounwind {122; X86-64-LABEL: qux64:123; X86-64: # %bb.0:124; X86-64-NEXT: movq %rdi, %rax125; X86-64-NEXT: movzbl %ah, %eax126; X86-64-NEXT: retq127;128; WIN64-LABEL: qux64:129; WIN64: # %bb.0:130; WIN64-NEXT: movzbl %ch, %eax131; WIN64-NEXT: retq132;133; X86-32-LABEL: qux64:134; X86-32: # %bb.0:135; X86-32-NEXT: movzbl %ah, %eax136; X86-32-NEXT: xorl %edx, %edx137; X86-32-NEXT: retl138 139 140 %t0 = lshr i64 %x, 8141 %t1 = and i64 %t0, 255142 ret i64 %t1143}144 145define i32 @qux32(i32 inreg %x) nounwind {146; X86-64-LABEL: qux32:147; X86-64: # %bb.0:148; X86-64-NEXT: movl %edi, %eax149; X86-64-NEXT: movzbl %ah, %eax150; X86-64-NEXT: retq151;152; WIN64-LABEL: qux32:153; WIN64: # %bb.0:154; WIN64-NEXT: movzbl %ch, %eax155; WIN64-NEXT: retq156;157; X86-32-LABEL: qux32:158; X86-32: # %bb.0:159; X86-32-NEXT: movzbl %ah, %eax160; X86-32-NEXT: retl161 162 163 %t0 = lshr i32 %x, 8164 %t1 = and i32 %t0, 255165 ret i32 %t1166}167 168define i16 @qux16(i16 inreg %x) nounwind {169; X86-64-LABEL: qux16:170; X86-64: # %bb.0:171; X86-64-NEXT: movl %edi, %eax172; X86-64-NEXT: movzbl %ah, %eax173; X86-64-NEXT: # kill: def $ax killed $ax killed $eax174; X86-64-NEXT: retq175;176; WIN64-LABEL: qux16:177; WIN64: # %bb.0:178; WIN64-NEXT: movzwl %cx, %eax179; WIN64-NEXT: shrl $8, %eax180; WIN64-NEXT: # kill: def $ax killed $ax killed $eax181; WIN64-NEXT: retq182;183; X86-32-LABEL: qux16:184; X86-32: # %bb.0:185; X86-32-NEXT: movzbl %ah, %eax186; X86-32-NEXT: # kill: def $ax killed $ax killed $eax187; X86-32-NEXT: retl188 189 190 %t0 = lshr i16 %x, 8191 ret i16 %t0192}193