forked from ruyisdk/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [LLVM][RVV 0.7.1] intrinsics for some binary operations * [LLVM][RVV 0.7.1] `vsetvl` intrinsics * [LLVM][RVV 0.7.1] test `vsetvl` intrinsics * [LLVM][RVV 0.7.1] improve * [LLVM][RVV 0.7.1] use separate SEW and LMUL for intrinsic vsetvl * [LLVM][RVV 0.7.1] remove unnecessary comments * [LLVM][RVV 0.7.1] test `vsetvlmax` * [LLVM][RVV 0.7.1] simplify patch
- Loading branch information
Showing
7 changed files
with
388 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===- IntrinsicsRISCVXTHeadV.td - RVV 0.7.1 intrinsics ----*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file defines all of RISC-V Vector Extension version 0.7.1 intrinsics. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Vectors version 0.7.1 | ||
|
||
let TargetPrefix = "riscv" in { | ||
// 6. Configuration-Setting and Utility | ||
def int_riscv_xvsetvl : Intrinsic<[llvm_i64_ty], | ||
[/* AVL */ llvm_i64_ty, /* SEW */ llvm_i64_ty, /* LMUL */ llvm_i64_ty], | ||
[IntrNoMem]>; | ||
def int_riscv_xvsetvlmax : Intrinsic<[llvm_i64_ty], | ||
[/* SEW */ llvm_i64_ty, /* LMUL */ llvm_i64_ty], | ||
[IntrNoMem]>; | ||
} // TargetPrefix = "riscv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -888,4 +888,3 @@ def : InstAlias<"vmnot.m $vd, $vs", | |
|
||
} // Predicates = [HasVendorXTHeadV] | ||
} // AsmVariantName = "RVV0p71" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
; RUN: llc -mtriple=riscv64 -mattr=+xtheadv < %s | FileCheck -check-prefix=CHECK %s | ||
|
||
; https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/v0.7.1/rvv_intrinsic_funcs/01_configuration-setting_and_utility_functions.md | ||
|
||
; The spec allowed e128, but intrinsic only support e8, e16, e32, e64 | ||
; vtype = ((ediv & 0b11) << 5) | ((sew & 0b111) << 2) | ((lmul & 0b11) << 0) | ||
; ------------------------------------------- | ||
; | ASM name | e8 | e16 | e32 | e64 | e128 | | ||
; | SEW | 0 | 1 | 2 | 3 | 4 | | ||
; ------------------------------------------- | ||
; | ASM name | m1 | m2 | m4 | m8 | | ||
; | LMUL | 0 | 1 | 2 | 3 | | ||
; ----------------------------------- | ||
; In intrinsic, ediv is always 1 | ||
|
||
declare i64 @llvm.riscv.xvsetvl (i64 %avl, i64 %sew, i64 %lmul); | ||
declare i64 @llvm.riscv.xvsetvlmax( i64 %sew, i64 %lmul); | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e8m1(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e8m1 | ||
; CHECK: vsetvli a0, a0, e8, m1, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 0, i64 0) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e8m2(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e8m2 | ||
; CHECK: vsetvli a0, a0, e8, m2, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 0, i64 1) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e8m4(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e8m4 | ||
; CHECK: vsetvli a0, a0, e8, m4, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 0, i64 2) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e8m8(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e8m8 | ||
; CHECK: vsetvli a0, a0, e8, m8, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 0, i64 3) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e16m1(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e16m1 | ||
; CHECK: vsetvli a0, a0, e16, m1, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 1, i64 0) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e16m2(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e16m2 | ||
; CHECK: vsetvli a0, a0, e16, m2, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 1, i64 1) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e16m4(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e16m4 | ||
; CHECK: vsetvli a0, a0, e16, m4, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 1, i64 2) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e16m8(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e16m8 | ||
; CHECK: vsetvli a0, a0, e16, m8, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 1, i64 3) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e32m1(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e32m1 | ||
; CHECK: vsetvli a0, a0, e32, m1, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 2, i64 0) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e32m2(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e32m2 | ||
; CHECK: vsetvli a0, a0, e32, m2, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 2, i64 1) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e32m4(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e32m4 | ||
; CHECK: vsetvli a0, a0, e32, m4, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 2, i64 2) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e32m8(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e32m8 | ||
; CHECK: vsetvli a0, a0, e32, m8, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 2, i64 3) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e64m1(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e64m1 | ||
; CHECK: vsetvli a0, a0, e64, m1, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 3, i64 0) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e64m2(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e64m2 | ||
; CHECK: vsetvli a0, a0, e64, m2, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 3, i64 1) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e64m4(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e64m4 | ||
; CHECK: vsetvli a0, a0, e64, m4, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 3, i64 2) | ||
ret i64 %v | ||
} | ||
|
||
|
||
define i64 @intrinsic_xvsetvl_e64m8(i64 %avl) { | ||
; CHECK-LABEL: intrinsic_xvsetvl_e64m8 | ||
; CHECK: vsetvli a0, a0, e64, m8, d1 | ||
%v = call i64 @llvm.riscv.xvsetvl(i64 %avl, i64 3, i64 3) | ||
ret i64 %v | ||
} |
Oops, something went wrong.