175 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X643 4define i64 @test_lshr_i64(i64 %arg1, i64 %arg2) {5; X64-LABEL: test_lshr_i64:6; X64: # %bb.0:7; X64-NEXT: movq %rdi, %rax8; X64-NEXT: movq %rsi, %rcx9; X64-NEXT: # kill: def $cl killed $cl killed $rcx10; X64-NEXT: shrq %cl, %rax11; X64-NEXT: retq12 %res = lshr i64 %arg1, %arg213 ret i64 %res14}15 16define i64 @test_lshr_i64_imm(i64 %arg1) {17; X64-LABEL: test_lshr_i64_imm:18; X64: # %bb.0:19; X64-NEXT: movq %rdi, %rax20; X64-NEXT: shrq $5, %rax21; X64-NEXT: retq22 %res = lshr i64 %arg1, 523 ret i64 %res24}25 26define i64 @test_lshr_i64_imm1(i64 %arg1) {27; X64-LABEL: test_lshr_i64_imm1:28; X64: # %bb.0:29; X64-NEXT: movq %rdi, %rax30; X64-NEXT: shrq %rax31; X64-NEXT: retq32 %res = lshr i64 %arg1, 133 ret i64 %res34}35 36define i32 @test_lshr_i32(i32 %arg1, i32 %arg2) {37; X64-LABEL: test_lshr_i32:38; X64: # %bb.0:39; X64-NEXT: movl %edi, %eax40; X64-NEXT: movl %esi, %ecx41; X64-NEXT: # kill: def $cl killed $cl killed $ecx42; X64-NEXT: shrl %cl, %eax43; X64-NEXT: retq44 %res = lshr i32 %arg1, %arg245 ret i32 %res46}47 48define i32 @test_lshr_i32_imm(i32 %arg1) {49; X64-LABEL: test_lshr_i32_imm:50; X64: # %bb.0:51; X64-NEXT: movl %edi, %eax52; X64-NEXT: shrl $5, %eax53; X64-NEXT: retq54 %res = lshr i32 %arg1, 555 ret i32 %res56}57 58define i32 @test_lshr_i32_imm1(i32 %arg1) {59; X64-LABEL: test_lshr_i32_imm1:60; X64: # %bb.0:61; X64-NEXT: movl %edi, %eax62; X64-NEXT: shrl %eax63; X64-NEXT: retq64 %res = lshr i32 %arg1, 165 ret i32 %res66}67 68define i16 @test_lshr_i16(i32 %arg1, i32 %arg2) {69; X64-LABEL: test_lshr_i16:70; X64: # %bb.0:71; X64-NEXT: movl %edi, %eax72; X64-NEXT: movl %esi, %ecx73; X64-NEXT: # kill: def $cl killed $cl killed $ecx74; X64-NEXT: shrw %cl, %ax75; X64-NEXT: # kill: def $ax killed $ax killed $eax76; X64-NEXT: retq77 %a = trunc i32 %arg1 to i1678 %a2 = trunc i32 %arg2 to i1679 %res = lshr i16 %a, %a280 ret i16 %res81}82 83define i16 @test_lshr_i16_imm(i32 %arg1) {84; X64-LABEL: test_lshr_i16_imm:85; X64: # %bb.0:86; X64-NEXT: movl %edi, %eax87; X64-NEXT: shrw $5, %ax88; X64-NEXT: # kill: def $ax killed $ax killed $eax89; X64-NEXT: retq90 %a = trunc i32 %arg1 to i1691 %res = lshr i16 %a, 592 ret i16 %res93}94 95define i16 @test_lshr_i16_imm1(i32 %arg1) {96; X64-LABEL: test_lshr_i16_imm1:97; X64: # %bb.0:98; X64-NEXT: movl %edi, %eax99; X64-NEXT: shrw %ax100; X64-NEXT: # kill: def $ax killed $ax killed $eax101; X64-NEXT: retq102 %a = trunc i32 %arg1 to i16103 %res = lshr i16 %a, 1104 ret i16 %res105}106 107define i8 @test_lshr_i8(i32 %arg1, i32 %arg2) {108; X64-LABEL: test_lshr_i8:109; X64: # %bb.0:110; X64-NEXT: movl %edi, %eax111; X64-NEXT: movl %esi, %ecx112; X64-NEXT: # kill: def $cl killed $cl killed $ecx113; X64-NEXT: shrb %cl, %al114; X64-NEXT: # kill: def $al killed $al killed $eax115; X64-NEXT: retq116 %a = trunc i32 %arg1 to i8117 %a2 = trunc i32 %arg2 to i8118 %res = lshr i8 %a, %a2119 ret i8 %res120}121 122define i8 @test_lshr_i8_imm(i32 %arg1) {123; X64-LABEL: test_lshr_i8_imm:124; X64: # %bb.0:125; X64-NEXT: movl %edi, %eax126; X64-NEXT: shrb $5, %al127; X64-NEXT: # kill: def $al killed $al killed $eax128; X64-NEXT: retq129 %a = trunc i32 %arg1 to i8130 %res = lshr i8 %a, 5131 ret i8 %res132}133 134define i8 @test_lshr_i8_imm1(i32 %arg1) {135; X64-LABEL: test_lshr_i8_imm1:136; X64: # %bb.0:137; X64-NEXT: movl %edi, %eax138; X64-NEXT: shrb %al139; X64-NEXT: # kill: def $al killed $al killed $eax140; X64-NEXT: retq141 %a = trunc i32 %arg1 to i8142 %res = lshr i8 %a, 1143 ret i8 %res144}145 146define i1 @test_lshr_i1(i32 %arg1, i32 %arg2) {147; X64-LABEL: test_lshr_i1:148; X64: # %bb.0:149; X64-NEXT: movl %edi, %eax150; X64-NEXT: movl %esi, %ecx151; X64-NEXT: andb $1, %al152; X64-NEXT: andb $1, %cl153; X64-NEXT: # kill: def $cl killed $cl killed $ecx154; X64-NEXT: shrb %cl, %al155; X64-NEXT: # kill: def $al killed $al killed $eax156; X64-NEXT: retq157 %a = trunc i32 %arg1 to i1158 %a2 = trunc i32 %arg2 to i1159 %res = lshr i1 %a, %a2160 ret i1 %res161}162 163define i1 @test_lshr_i1_imm1(i32 %arg1) {164; X64-LABEL: test_lshr_i1_imm1:165; X64: # %bb.0:166; X64-NEXT: movl %edi, %eax167; X64-NEXT: andb $1, %al168; X64-NEXT: shrb %al169; X64-NEXT: # kill: def $al killed $al killed $eax170; X64-NEXT: retq171 %a = trunc i32 %arg1 to i1172 %res = lshr i1 %a, 1173 ret i1 %res174}175