134 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s3 4; SHLD/SHRD manual shifts5 6define i64 @test1(i64 %hi, i64 %lo, i64 %bits) nounwind {7; CHECK-LABEL: test1:8; CHECK: # %bb.0:9; CHECK-NEXT: movq %rdx, %rcx10; CHECK-NEXT: movq %rdi, %rax11; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx12; CHECK-NEXT: shldq %cl, %rsi, %rax13; CHECK-NEXT: retq14 %and = and i64 %bits, 6315 %and64 = sub i64 64, %and16 %sh_lo = lshr i64 %lo, %and6417 %sh_hi = shl i64 %hi, %and18 %sh = or i64 %sh_lo, %sh_hi19 ret i64 %sh20}21 22define i64 @test2(i64 %hi, i64 %lo, i64 %bits) nounwind {23; CHECK-LABEL: test2:24; CHECK: # %bb.0:25; CHECK-NEXT: movq %rdx, %rcx26; CHECK-NEXT: movq %rsi, %rax27; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx28; CHECK-NEXT: shrdq %cl, %rdi, %rax29; CHECK-NEXT: retq30 %and = and i64 %bits, 6331 %and64 = sub i64 64, %and32 %sh_lo = shl i64 %hi, %and6433 %sh_hi = lshr i64 %lo, %and34 %sh = or i64 %sh_lo, %sh_hi35 ret i64 %sh36}37 38define i64 @test3(i64 %hi, i64 %lo, i64 %bits) nounwind {39; CHECK-LABEL: test3:40; CHECK: # %bb.0:41; CHECK-NEXT: movq %rdx, %rcx42; CHECK-NEXT: movq %rdi, %rax43; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx44; CHECK-NEXT: shldq %cl, %rsi, %rax45; CHECK-NEXT: retq46 %bits64 = sub i64 64, %bits47 %sh_lo = lshr i64 %lo, %bits6448 %sh_hi = shl i64 %hi, %bits49 %sh = or i64 %sh_lo, %sh_hi50 ret i64 %sh51}52 53define i64 @test4(i64 %hi, i64 %lo, i64 %bits) nounwind {54; CHECK-LABEL: test4:55; CHECK: # %bb.0:56; CHECK-NEXT: movq %rdx, %rcx57; CHECK-NEXT: movq %rsi, %rax58; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx59; CHECK-NEXT: shrdq %cl, %rdi, %rax60; CHECK-NEXT: retq61 %bits64 = sub i64 64, %bits62 %sh_lo = shl i64 %hi, %bits6463 %sh_hi = lshr i64 %lo, %bits64 %sh = or i64 %sh_lo, %sh_hi65 ret i64 %sh66}67 68define i64 @test5(i64 %hi, i64 %lo, i64 %bits) nounwind {69; CHECK-LABEL: test5:70; CHECK: # %bb.0:71; CHECK-NEXT: movq %rdx, %rcx72; CHECK-NEXT: movq %rdi, %rax73; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx74; CHECK-NEXT: shldq %cl, %rsi, %rax75; CHECK-NEXT: retq76 %bits64 = xor i64 %bits, 6377 %lo2 = lshr i64 %lo, 178 %sh_lo = lshr i64 %lo2, %bits6479 %sh_hi = shl i64 %hi, %bits80 %sh = or i64 %sh_lo, %sh_hi81 ret i64 %sh82}83 84define i64 @test6(i64 %hi, i64 %lo, i64 %bits) nounwind {85; CHECK-LABEL: test6:86; CHECK: # %bb.0:87; CHECK-NEXT: movq %rdx, %rcx88; CHECK-NEXT: movq %rdi, %rax89; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx90; CHECK-NEXT: shrdq %cl, %rsi, %rax91; CHECK-NEXT: retq92 %bits64 = xor i64 %bits, 6393 %lo2 = shl i64 %lo, 194 %sh_lo = shl i64 %lo2, %bits6495 %sh_hi = lshr i64 %hi, %bits96 %sh = or i64 %sh_lo, %sh_hi97 ret i64 %sh98}99 100define i64 @test7(i64 %hi, i64 %lo, i64 %bits) nounwind {101; CHECK-LABEL: test7:102; CHECK: # %bb.0:103; CHECK-NEXT: movq %rdx, %rcx104; CHECK-NEXT: movq %rdi, %rax105; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx106; CHECK-NEXT: shrdq %cl, %rsi, %rax107; CHECK-NEXT: retq108 %bits64 = xor i64 %bits, 63109 %lo2 = add i64 %lo, %lo110 %sh_lo = shl i64 %lo2, %bits64111 %sh_hi = lshr i64 %hi, %bits112 %sh = or i64 %sh_lo, %sh_hi113 ret i64 %sh114}115 116define i64 @test8(i64 %hi, i64 %lo, i64 %bits) nounwind {117; CHECK-LABEL: test8:118; CHECK: # %bb.0:119; CHECK-NEXT: movq %rdx, %rcx120; CHECK-NEXT: movq %rdi, %rax121; CHECK-NEXT: # kill: def $cl killed $cl killed $rcx122; CHECK-NEXT: shldq %cl, %rsi, %rax123; CHECK-NEXT: retq124 %tbits = trunc i64 %bits to i8125 %tand = and i8 %tbits, 63126 %tand64 = sub i8 64, %tand127 %and = zext i8 %tand to i64128 %and64 = zext i8 %tand64 to i64129 %sh_lo = lshr i64 %lo, %and64130 %sh_hi = shl i64 %hi, %and131 %sh = or i64 %sh_lo, %sh_hi132 ret i64 %sh133}134