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
4 define i64 @bzhi64(i64 %x, i64 %y) {
7 ; CHECK-NEXT: bzhiq %rsi, %rdi, %rax
9 %tmp = tail call i64 @llvm.x86.bmi.bzhi.64(i64 %x, i64 %y)
13 define i64 @bzhi64_load(i64* %x, i64 %y) {
14 ; CHECK-LABEL: bzhi64_load:
16 ; CHECK-NEXT: bzhiq %rsi, (%rdi), %rax
18 %x1 = load i64, i64* %x
19 %tmp = tail call i64 @llvm.x86.bmi.bzhi.64(i64 %x1, i64 %y)
23 declare i64 @llvm.x86.bmi.bzhi.64(i64, i64)
25 define i64 @pdep64(i64 %x, i64 %y) {
26 ; CHECK-LABEL: pdep64:
28 ; CHECK-NEXT: pdepq %rsi, %rdi, %rax
30 %tmp = tail call i64 @llvm.x86.bmi.pdep.64(i64 %x, i64 %y)
34 define i64 @pdep64_load(i64 %x, i64* %y) {
35 ; CHECK-LABEL: pdep64_load:
37 ; CHECK-NEXT: pdepq (%rsi), %rdi, %rax
39 %y1 = load i64, i64* %y
40 %tmp = tail call i64 @llvm.x86.bmi.pdep.64(i64 %x, i64 %y1)
44 declare i64 @llvm.x86.bmi.pdep.64(i64, i64)
46 define i64 @pext64(i64 %x, i64 %y) {
47 ; CHECK-LABEL: pext64:
49 ; CHECK-NEXT: pextq %rsi, %rdi, %rax
51 %tmp = tail call i64 @llvm.x86.bmi.pext.64(i64 %x, i64 %y)
55 define i64 @pext64_load(i64 %x, i64* %y) {
56 ; CHECK-LABEL: pext64_load:
58 ; CHECK-NEXT: pextq (%rsi), %rdi, %rax
60 %y1 = load i64, i64* %y
61 %tmp = tail call i64 @llvm.x86.bmi.pext.64(i64 %x, i64 %y1)
65 declare i64 @llvm.x86.bmi.pext.64(i64, i64)
67 define i64 @mulx64(i64 %x, i64 %y, i64* %p) {
68 ; CHECK-LABEL: mulx64:
70 ; CHECK-NEXT: movq %rdx, %rcx
71 ; CHECK-NEXT: movq %rdi, %rax
72 ; CHECK-NEXT: mulq %rsi
73 ; CHECK-NEXT: movq %rdx, (%rcx)
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
85 define i64 @mulx64_load(i64 %x, i64* %y, i64* %p) {
86 ; CHECK-LABEL: mulx64_load:
88 ; CHECK-NEXT: movq %rdx, %rcx
89 ; CHECK-NEXT: movq %rdi, %rax
90 ; CHECK-NEXT: mulq (%rsi)
91 ; CHECK-NEXT: movq %rdx, (%rcx)
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