1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi,+bmi2 | FileCheck %s --check-prefixes=CHECK 3 4define i64 @bzhi64(i64 %x, i64 %y) { 5; CHECK-LABEL: bzhi64: 6; CHECK: # %bb.0: 7; CHECK-NEXT: bzhiq %rsi, %rdi, %rax 8; CHECK-NEXT: retq 9 %tmp = tail call i64 @llvm.x86.bmi.bzhi.64(i64 %x, i64 %y) 10 ret i64 %tmp 11} 12 13define i64 @bzhi64_load(i64* %x, i64 %y) { 14; CHECK-LABEL: bzhi64_load: 15; CHECK: # %bb.0: 16; CHECK-NEXT: bzhiq %rsi, (%rdi), %rax 17; CHECK-NEXT: retq 18 %x1 = load i64, i64* %x 19 %tmp = tail call i64 @llvm.x86.bmi.bzhi.64(i64 %x1, i64 %y) 20 ret i64 %tmp 21} 22 23declare i64 @llvm.x86.bmi.bzhi.64(i64, i64) 24 25define i64 @pdep64(i64 %x, i64 %y) { 26; CHECK-LABEL: pdep64: 27; CHECK: # %bb.0: 28; CHECK-NEXT: pdepq %rsi, %rdi, %rax 29; CHECK-NEXT: retq 30 %tmp = tail call i64 @llvm.x86.bmi.pdep.64(i64 %x, i64 %y) 31 ret i64 %tmp 32} 33 34define i64 @pdep64_load(i64 %x, i64* %y) { 35; CHECK-LABEL: pdep64_load: 36; CHECK: # %bb.0: 37; CHECK-NEXT: pdepq (%rsi), %rdi, %rax 38; CHECK-NEXT: retq 39 %y1 = load i64, i64* %y 40 %tmp = tail call i64 @llvm.x86.bmi.pdep.64(i64 %x, i64 %y1) 41 ret i64 %tmp 42} 43 44declare i64 @llvm.x86.bmi.pdep.64(i64, i64) 45 46define i64 @pext64(i64 %x, i64 %y) { 47; CHECK-LABEL: pext64: 48; CHECK: # %bb.0: 49; CHECK-NEXT: pextq %rsi, %rdi, %rax 50; CHECK-NEXT: retq 51 %tmp = tail call i64 @llvm.x86.bmi.pext.64(i64 %x, i64 %y) 52 ret i64 %tmp 53} 54 55define i64 @pext64_load(i64 %x, i64* %y) { 56; CHECK-LABEL: pext64_load: 57; CHECK: # %bb.0: 58; CHECK-NEXT: pextq (%rsi), %rdi, %rax 59; CHECK-NEXT: retq 60 %y1 = load i64, i64* %y 61 %tmp = tail call i64 @llvm.x86.bmi.pext.64(i64 %x, i64 %y1) 62 ret i64 %tmp 63} 64 65declare i64 @llvm.x86.bmi.pext.64(i64, i64) 66 67define i64 @mulx64(i64 %x, i64 %y, i64* %p) { 68; CHECK-LABEL: mulx64: 69; CHECK: # %bb.0: 70; CHECK-NEXT: movq %rdx, %rcx 71; CHECK-NEXT: movq %rdi, %rdx 72; CHECK-NEXT: mulxq %rsi, %rax, %rdx 73; CHECK-NEXT: movq %rdx, (%rcx) 74; CHECK-NEXT: retq 75 %x1 = zext i64 %x to i128 76 %y1 = zext i64 %y to i128 77 %r1 = mul i128 %x1, %y1 78 %h1 = lshr i128 %r1, 64 79 %h = trunc i128 %h1 to i64 80 %l = trunc i128 %r1 to i64 81 store i64 %h, i64* %p 82 ret i64 %l 83} 84 85define i64 @mulx64_load(i64 %x, i64* %y, i64* %p) { 86; CHECK-LABEL: mulx64_load: 87; CHECK: # %bb.0: 88; CHECK-NEXT: movq %rdx, %rcx 89; CHECK-NEXT: movq %rdi, %rdx 90; CHECK-NEXT: mulxq (%rsi), %rax, %rdx 91; CHECK-NEXT: movq %rdx, (%rcx) 92; CHECK-NEXT: retq 93 %y1 = load i64, i64* %y 94 %x2 = zext i64 %x to i128 95 %y2 = zext i64 %y1 to i128 96 %r1 = mul i128 %x2, %y2 97 %h1 = lshr i128 %r1, 64 98 %h = trunc i128 %h1 to i64 99 %l = trunc i128 %r1 to i64 100 store i64 %h, i64* %p 101 ret i64 %l 102} 103