-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VP] IR support for vector-predicated integer operations
This patch is part of the integer patch set of the Vector Predication extension (D57504). VP / integer slice / patch #1
- Loading branch information
Showing
11 changed files
with
1,187 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//===-- IR/VPIntrinsics.def - Describes llvm.vp.* Intrinsics -*- C++ -*-===// | ||
// | ||
// 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 contains descriptions of the various Vector Predication intrinsics. | ||
// This is used as a central place for enumerating the different instructions | ||
// and should eventually be the place to put comments about the instructions. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// NOTE: NO INCLUDE GUARD DESIRED! | ||
|
||
// Provide definitions of macros so that users of this file do not have to | ||
// define everything to use it... | ||
// | ||
#ifndef REGISTER_VP_INTRINSIC | ||
#define REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) | ||
#endif | ||
|
||
// Map this VP intrinsic to its functional Opcode | ||
#ifndef HANDLE_VP_TO_OC | ||
#define HANDLE_VP_TO_OC(VPID, OC) | ||
#endif | ||
|
||
///// Integer Arithmetic ///// | ||
|
||
// llvm.vp.add(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_add, 2, 3) | ||
HANDLE_VP_TO_OC(vp_add, Add) | ||
|
||
// llvm.vp.and(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_and, 2, 3) | ||
HANDLE_VP_TO_OC(vp_and, And) | ||
|
||
// llvm.vp.ashr(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_ashr, 2, 3) | ||
HANDLE_VP_TO_OC(vp_ashr, AShr) | ||
|
||
// llvm.vp.lshr(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_lshr, 2, 3) | ||
HANDLE_VP_TO_OC(vp_lshr, LShr) | ||
|
||
// llvm.vp.mul(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_mul, 2, 3) | ||
HANDLE_VP_TO_OC(vp_mul, Mul) | ||
|
||
// llvm.vp.or(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_or, 2, 3) | ||
HANDLE_VP_TO_OC(vp_or, Or) | ||
|
||
// llvm.vp.sdiv(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_sdiv, 2, 3) | ||
HANDLE_VP_TO_OC(vp_sdiv, SDiv) | ||
|
||
// llvm.vp.shl(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_shl, 2, 3) | ||
HANDLE_VP_TO_OC(vp_shl, Shl) | ||
|
||
// llvm.vp.srem(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_srem, 2, 3) | ||
HANDLE_VP_TO_OC(vp_srem, SRem) | ||
|
||
// llvm.vp.sub(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_sub, 2, 3) | ||
HANDLE_VP_TO_OC(vp_sub, Sub) | ||
|
||
// llvm.vp.udiv(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_udiv, 2, 3) | ||
HANDLE_VP_TO_OC(vp_udiv, UDiv) | ||
|
||
// llvm.vp.urem(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_urem, 2, 3) | ||
HANDLE_VP_TO_OC(vp_urem, URem) | ||
|
||
// llvm.vp.xor(x,y,mask,vlen) | ||
REGISTER_VP_INTRINSIC(vp_xor, 2, 3) | ||
HANDLE_VP_TO_OC(vp_xor, Xor) | ||
|
||
#undef REGISTER_VP_INTRINSIC | ||
#undef HANDLE_VP_TO_OC |
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,34 @@ | ||
; RUN: opt --verify %s | ||
|
||
define void @test_vp_int(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) { | ||
%r0 = call <8 x i32> @llvm.vp.add.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r1 = call <8 x i32> @llvm.vp.sub.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r2 = call <8 x i32> @llvm.vp.mul.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r3 = call <8 x i32> @llvm.vp.sdiv.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r4 = call <8 x i32> @llvm.vp.srem.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r5 = call <8 x i32> @llvm.vp.udiv.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r6 = call <8 x i32> @llvm.vp.urem.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r7 = call <8 x i32> @llvm.vp.and.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r8 = call <8 x i32> @llvm.vp.or.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%r9 = call <8 x i32> @llvm.vp.xor.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%rA = call <8 x i32> @llvm.vp.ashr.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%rB = call <8 x i32> @llvm.vp.lshr.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
%rC = call <8 x i32> @llvm.vp.shl.v8i32(<8 x i32> %i0, <8 x i32> %i1, <8 x i1> %m, i32 %n) | ||
ret void | ||
} | ||
|
||
; integer arith | ||
declare <8 x i32> @llvm.vp.add.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.sub.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.mul.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.sdiv.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.srem.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.udiv.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.urem.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
; bit arith | ||
declare <8 x i32> @llvm.vp.and.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.or.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.xor.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.ashr.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.lshr.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) | ||
declare <8 x i32> @llvm.vp.shl.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32) |
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
Oops, something went wrong.