2006-03-03 03:33:15 +01:00
|
|
|
//===- Intrinsics.td - Defines all LLVM intrinsics ---------*- tablegen -*-===//
|
2009-08-14 22:27:12 +02:00
|
|
|
//
|
2006-03-03 03:33:15 +01:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 23:59:10 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2009-08-14 22:27:12 +02:00
|
|
|
//
|
2006-03-03 03:33:15 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines properties of all LLVM intrinsics.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-03-24 19:51:56 +01:00
|
|
|
include "llvm/CodeGen/ValueTypes.td"
|
|
|
|
|
2006-03-03 03:33:15 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Properties we keep track of for intrinsics.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class IntrinsicProperty;
|
|
|
|
|
2010-08-06 01:36:21 +02:00
|
|
|
// Intr*Mem - Memory properties. An intrinsic is allowed to have at most one of
|
2006-03-03 03:33:15 +01:00
|
|
|
// these properties set. They are listed from the most aggressive (best to use
|
2009-08-14 22:27:12 +02:00
|
|
|
// if correct) to the least aggressive. If no property is set, the worst case
|
2010-08-06 01:36:21 +02:00
|
|
|
// is assumed (it may read and write any memory it can get access to and it may
|
|
|
|
// have other side effects).
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2006-04-11 00:02:59 +02:00
|
|
|
// IntrNoMem - The intrinsic does not access memory or have any other side
|
2006-03-03 03:33:15 +01:00
|
|
|
// effects. It may be CSE'd deleted if dead, etc.
|
2006-04-11 00:02:59 +02:00
|
|
|
def IntrNoMem : IntrinsicProperty;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2006-04-11 00:02:59 +02:00
|
|
|
// IntrReadArgMem - This intrinsic reads only from memory that one of its
|
2011-04-27 20:39:03 +02:00
|
|
|
// pointer-typed arguments points to, but may read an unspecified amount.
|
2006-04-11 00:02:59 +02:00
|
|
|
def IntrReadArgMem : IntrinsicProperty;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
|
|
|
// IntrReadMem - This intrinsic reads from unspecified memory, so it cannot be
|
|
|
|
// moved across stores. However, it can be reordered otherwise and can be
|
|
|
|
// deleted if dead.
|
|
|
|
def IntrReadMem : IntrinsicProperty;
|
|
|
|
|
2010-08-06 01:36:21 +02:00
|
|
|
// IntrReadWriteArgMem - This intrinsic reads and writes only from memory that
|
|
|
|
// one of its arguments points to, but may access an unspecified amount. The
|
|
|
|
// reads and writes may be volatile, but except for this it has no other side
|
|
|
|
// effects.
|
|
|
|
def IntrReadWriteArgMem : IntrinsicProperty;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2008-06-16 22:29:38 +02:00
|
|
|
// Commutative - This intrinsic is commutative: X op Y == Y op X.
|
|
|
|
def Commutative : IntrinsicProperty;
|
|
|
|
|
2011-05-28 08:31:34 +02:00
|
|
|
// Throws - This intrinsic can throw.
|
|
|
|
def Throws : IntrinsicProperty;
|
|
|
|
|
2009-01-12 02:12:03 +01:00
|
|
|
// NoCapture - The specified argument pointer is not captured by the intrinsic.
|
|
|
|
class NoCapture<int argNo> : IntrinsicProperty {
|
|
|
|
int ArgNo = argNo;
|
|
|
|
}
|
|
|
|
|
2013-07-06 02:29:58 +02:00
|
|
|
// ReadOnly - The specified argument pointer is not written to through the
|
|
|
|
// pointer by the intrinsic.
|
|
|
|
class ReadOnly<int argNo> : IntrinsicProperty {
|
|
|
|
int ArgNo = argNo;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ReadNone - The specified argument pointer is not dereferenced by the
|
|
|
|
// intrinsic.
|
|
|
|
class ReadNone<int argNo> : IntrinsicProperty {
|
|
|
|
int ArgNo = argNo;
|
|
|
|
}
|
|
|
|
|
2012-05-28 01:20:41 +02:00
|
|
|
def IntrNoReturn : IntrinsicProperty;
|
|
|
|
|
2014-03-19 00:51:07 +01:00
|
|
|
// IntrNoduplicate - Calls to this intrinsic cannot be duplicated.
|
|
|
|
// Parallels the noduplicate attribute on LLVM IR functions.
|
|
|
|
def IntrNoDuplicate : IntrinsicProperty;
|
|
|
|
|
2015-10-09 20:06:13 +02:00
|
|
|
// IntrConvergent - Calls to this intrinsic are convergent and may not be made
|
|
|
|
// control-dependent on any additional values.
|
2015-05-27 01:48:40 +02:00
|
|
|
// Parallels the convergent attribute on LLVM IR functions.
|
|
|
|
def IntrConvergent : IntrinsicProperty;
|
|
|
|
|
2006-03-03 03:33:15 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Types used by intrinsics.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-08-04 03:51:18 +02:00
|
|
|
class LLVMType<ValueType vt> {
|
2006-03-24 20:41:10 +01:00
|
|
|
ValueType VT = vt;
|
2006-03-03 03:33:15 +01:00
|
|
|
}
|
|
|
|
|
2012-05-22 01:21:28 +02:00
|
|
|
class LLVMQualPointerType<LLVMType elty, int addrspace>
|
2007-08-04 03:51:18 +02:00
|
|
|
: LLVMType<iPTR>{
|
2007-02-07 21:38:26 +01:00
|
|
|
LLVMType ElTy = elty;
|
2012-05-22 01:21:28 +02:00
|
|
|
int AddrSpace = addrspace;
|
2009-08-14 22:27:12 +02:00
|
|
|
}
|
2007-02-07 21:38:26 +01:00
|
|
|
|
2012-05-22 01:21:28 +02:00
|
|
|
class LLVMPointerType<LLVMType elty>
|
|
|
|
: LLVMQualPointerType<elty, 0>;
|
|
|
|
|
2008-07-30 06:36:53 +02:00
|
|
|
class LLVMAnyPointerType<LLVMType elty>
|
|
|
|
: LLVMType<iPTRAny>{
|
|
|
|
LLVMType ElTy = elty;
|
2009-08-14 22:27:12 +02:00
|
|
|
}
|
2008-07-30 06:36:53 +02:00
|
|
|
|
2009-04-16 23:46:42 +02:00
|
|
|
// Match the type of another intrinsic parameter. Number is an index into the
|
|
|
|
// list of overloaded types for the intrinsic, excluding all the fixed types.
|
|
|
|
// The Number value must refer to a previously listed type. For example:
|
|
|
|
// Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_anyfloat_ty, LLVMMatchType<0>]>
|
|
|
|
// has two overloaded types, the 2nd and 3rd arguments. LLVMMatchType<0>
|
|
|
|
// refers to the first overloaded type, which is the 2nd argument.
|
2007-08-04 03:51:18 +02:00
|
|
|
class LLVMMatchType<int num>
|
|
|
|
: LLVMType<OtherVT>{
|
|
|
|
int Number = num;
|
2008-02-21 07:45:13 +01:00
|
|
|
}
|
2007-02-07 21:38:26 +01:00
|
|
|
|
2014-03-28 13:31:39 +01:00
|
|
|
// Match the type of another intrinsic parameter that is expected to be based on
|
|
|
|
// an integral type (i.e. either iN or <N x iM>), but change the scalar size to
|
|
|
|
// be twice as wide or half as wide as the other type. This is only useful when
|
|
|
|
// the intrinsic is overloaded, so the matched type should be declared as iAny.
|
|
|
|
class LLVMExtendedType<int num> : LLVMMatchType<num>;
|
|
|
|
class LLVMTruncatedType<int num> : LLVMMatchType<num>;
|
2014-12-04 10:40:44 +01:00
|
|
|
class LLVMVectorSameWidth<int num, LLVMType elty>
|
|
|
|
: LLVMMatchType<num> {
|
|
|
|
ValueType ElTy = elty.VT;
|
|
|
|
}
|
2014-12-25 08:49:20 +01:00
|
|
|
class LLVMPointerTo<int num> : LLVMMatchType<num>;
|
Masked Gather and Scatter Intrinsics.
Gather and Scatter are new introduced intrinsics, comming after recently implemented masked load and store.
This is the first patch for Gather and Scatter intrinsics. It includes only the syntax, parsing and verification.
Gather and Scatter intrinsics allow to perform multiple memory accesses (read/write) in one vector instruction.
The intrinsics are not target specific and will have the following syntax:
Gather:
declare <16 x i32> @llvm.masked.gather.v16i32(<16 x i32*> <vector of ptrs>, i32 <alignment>, <16 x i1> <mask>, <16 x i32> <passthru>)
declare <8 x float> @llvm.masked.gather.v8f32(<8 x float*><vector of ptrs>, i32 <alignment>, <8 x i1> <mask>, <8 x float><passthru>)
Scatter:
declare void @llvm.masked.scatter.v8i32(<8 x i32><vector value to be stored> , <8 x i32*><vector of ptrs> , i32 <alignment>, <8 x i1> <mask>)
declare void @llvm.masked.scatter.v16i32(<16 x i32> <vector value to be stored> , <16 x i32*> <vector of ptrs>, i32 <alignment>, <16 x i1><mask> )
Vector of ptrs - a set of source/destination addresses, to load/store the value.
Mask - switches on/off vector lanes to prevent memory access for switched-off lanes
vector of ptrs, value and mask should have the same vector width.
These are code examples where gather / scatter should be used and will allow function vectorization
;void foo1(int * restrict A, int * restrict B, int * restrict C) {
; for (int i=0; i<SIZE; i++) {
; A[i] = B[C[i]];
; }
;}
;void foo3(int * restrict A, int * restrict B) {
; for (int i=0; i<SIZE; i++) {
; A[B[i]] = i+5;
; }
;}
Tests will come in the following patches, with CodeGen and Vectorizer.
http://reviews.llvm.org/D7433
llvm-svn: 228521
2015-02-08 09:27:19 +01:00
|
|
|
class LLVMVectorOfPointersToElt<int num> : LLVMMatchType<num>;
|
2009-01-07 01:09:01 +01:00
|
|
|
|
2014-03-29 08:04:54 +01:00
|
|
|
// Match the type of another intrinsic parameter that is expected to be a
|
|
|
|
// vector type, but change the element count to be half as many
|
|
|
|
class LLVMHalfElementsVectorType<int num> : LLVMMatchType<num>;
|
|
|
|
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_void_ty : LLVMType<isVoid>;
|
2015-01-22 21:14:38 +01:00
|
|
|
def llvm_any_ty : LLVMType<Any>;
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_anyint_ty : LLVMType<iAny>;
|
2007-08-16 23:57:19 +02:00
|
|
|
def llvm_anyfloat_ty : LLVMType<fAny>;
|
2009-08-11 03:14:02 +02:00
|
|
|
def llvm_anyvector_ty : LLVMType<vAny>;
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_i1_ty : LLVMType<i1>;
|
|
|
|
def llvm_i8_ty : LLVMType<i8>;
|
|
|
|
def llvm_i16_ty : LLVMType<i16>;
|
|
|
|
def llvm_i32_ty : LLVMType<i32>;
|
|
|
|
def llvm_i64_ty : LLVMType<i64>;
|
2013-01-11 02:45:05 +01:00
|
|
|
def llvm_half_ty : LLVMType<f16>;
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_float_ty : LLVMType<f32>;
|
|
|
|
def llvm_double_ty : LLVMType<f64>;
|
2007-09-28 03:08:20 +02:00
|
|
|
def llvm_f80_ty : LLVMType<f80>;
|
|
|
|
def llvm_f128_ty : LLVMType<f128>;
|
|
|
|
def llvm_ppcf128_ty : LLVMType<ppcf128>;
|
2007-02-07 21:38:26 +01:00
|
|
|
def llvm_ptr_ty : LLVMPointerType<llvm_i8_ty>; // i8*
|
|
|
|
def llvm_ptrptr_ty : LLVMPointerType<llvm_ptr_ty>; // i8**
|
2008-10-10 03:41:18 +02:00
|
|
|
def llvm_anyptr_ty : LLVMAnyPointerType<llvm_i8_ty>; // (space)i8*
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_empty_ty : LLVMType<OtherVT>; // { }
|
2007-02-07 21:38:26 +01:00
|
|
|
def llvm_descriptor_ty : LLVMPointerType<llvm_empty_ty>; // { }*
|
2009-08-29 01:24:31 +02:00
|
|
|
def llvm_metadata_ty : LLVMType<MetadataVT>; // !{...}
|
2015-09-02 15:36:25 +02:00
|
|
|
def llvm_token_ty : LLVMType<token>; // token
|
2006-03-24 20:41:10 +01:00
|
|
|
|
2010-09-07 22:03:56 +02:00
|
|
|
def llvm_x86mmx_ty : LLVMType<x86mmx>;
|
2010-09-17 02:33:03 +02:00
|
|
|
def llvm_ptrx86mmx_ty : LLVMPointerType<llvm_x86mmx_ty>; // <1 x i64>*
|
2010-09-07 22:03:56 +02:00
|
|
|
|
2012-09-20 00:47:07 +02:00
|
|
|
def llvm_v2i1_ty : LLVMType<v2i1>; // 2 x i1
|
|
|
|
def llvm_v4i1_ty : LLVMType<v4i1>; // 4 x i1
|
|
|
|
def llvm_v8i1_ty : LLVMType<v8i1>; // 8 x i1
|
|
|
|
def llvm_v16i1_ty : LLVMType<v16i1>; // 16 x i1
|
2012-12-24 11:03:57 +01:00
|
|
|
def llvm_v32i1_ty : LLVMType<v32i1>; // 32 x i1
|
|
|
|
def llvm_v64i1_ty : LLVMType<v64i1>; // 64 x i1
|
2013-09-24 04:47:27 +02:00
|
|
|
def llvm_v1i8_ty : LLVMType<v1i8>; // 1 x i8
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v2i8_ty : LLVMType<v2i8>; // 2 x i8
|
|
|
|
def llvm_v4i8_ty : LLVMType<v4i8>; // 4 x i8
|
|
|
|
def llvm_v8i8_ty : LLVMType<v8i8>; // 8 x i8
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_v16i8_ty : LLVMType<v16i8>; // 16 x i8
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v32i8_ty : LLVMType<v32i8>; // 32 x i8
|
2012-12-24 11:03:57 +01:00
|
|
|
def llvm_v64i8_ty : LLVMType<v64i8>; // 64 x i8
|
|
|
|
|
2012-09-20 00:47:07 +02:00
|
|
|
def llvm_v1i16_ty : LLVMType<v1i16>; // 1 x i16
|
2010-08-31 23:53:15 +02:00
|
|
|
def llvm_v2i16_ty : LLVMType<v2i16>; // 2 x i16
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v4i16_ty : LLVMType<v4i16>; // 4 x i16
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_v8i16_ty : LLVMType<v8i16>; // 8 x i16
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v16i16_ty : LLVMType<v16i16>; // 16 x i16
|
2012-12-24 11:03:57 +01:00
|
|
|
def llvm_v32i16_ty : LLVMType<v32i16>; // 32 x i16
|
|
|
|
|
2012-09-20 00:47:07 +02:00
|
|
|
def llvm_v1i32_ty : LLVMType<v1i32>; // 1 x i32
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_v2i32_ty : LLVMType<v2i32>; // 2 x i32
|
|
|
|
def llvm_v4i32_ty : LLVMType<v4i32>; // 4 x i32
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v8i32_ty : LLVMType<v8i32>; // 8 x i32
|
2012-07-26 23:22:00 +02:00
|
|
|
def llvm_v16i32_ty : LLVMType<v16i32>; // 16 x i32
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v1i64_ty : LLVMType<v1i64>; // 1 x i64
|
|
|
|
def llvm_v2i64_ty : LLVMType<v2i64>; // 2 x i64
|
|
|
|
def llvm_v4i64_ty : LLVMType<v4i64>; // 4 x i64
|
2012-07-26 23:22:00 +02:00
|
|
|
def llvm_v8i64_ty : LLVMType<v8i64>; // 8 x i64
|
|
|
|
def llvm_v16i64_ty : LLVMType<v16i64>; // 16 x i64
|
2009-06-29 18:47:10 +02:00
|
|
|
|
2015-05-25 17:49:26 +02:00
|
|
|
def llvm_v1i128_ty : LLVMType<v1i128>; // 1 x i128
|
|
|
|
|
2013-10-03 05:29:21 +02:00
|
|
|
def llvm_v2f16_ty : LLVMType<v2f16>; // 2 x half (__fp16)
|
|
|
|
def llvm_v4f16_ty : LLVMType<v4f16>; // 4 x half (__fp16)
|
[Mips][msa] Added the simple builtins (fadd to ftq)
Includes:
fadd, fceq, fcg[et], fclass, fcl[et], fcne, fcun, fdiv, fexdo, fexp2,
fexup[lr], ffint_[su], ffql, ffqr, fill, flog2, fmadd, fmax, fmax_a, fmin,
fmin_a, fmsub, fmul, frint, frcp, frsqrt, fseq, fsge, fsgt, fsle, fslt,
fsne, fsqr, fsub, ftint_s, ftq
Patch by Daniel Sanders
llvm-svn: 188458
2013-08-15 15:45:36 +02:00
|
|
|
def llvm_v8f16_ty : LLVMType<v8f16>; // 8 x half (__fp16)
|
2013-09-24 04:47:27 +02:00
|
|
|
def llvm_v1f32_ty : LLVMType<v1f32>; // 1 x float
|
2009-06-23 01:27:02 +02:00
|
|
|
def llvm_v2f32_ty : LLVMType<v2f32>; // 2 x float
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_v4f32_ty : LLVMType<v4f32>; // 4 x float
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v8f32_ty : LLVMType<v8f32>; // 8 x float
|
2012-12-24 11:03:57 +01:00
|
|
|
def llvm_v16f32_ty : LLVMType<v16f32>; // 16 x float
|
2013-09-24 04:47:27 +02:00
|
|
|
def llvm_v1f64_ty : LLVMType<v1f64>; // 1 x double
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_v2f64_ty : LLVMType<v2f64>; // 2 x double
|
2009-06-29 18:47:10 +02:00
|
|
|
def llvm_v4f64_ty : LLVMType<v4f64>; // 4 x double
|
2012-12-24 11:03:57 +01:00
|
|
|
def llvm_v8f64_ty : LLVMType<v8f64>; // 8 x double
|
2007-03-08 23:09:11 +01:00
|
|
|
|
2007-08-04 03:51:18 +02:00
|
|
|
def llvm_vararg_ty : LLVMType<isVoid>; // this means vararg here
|
2007-02-06 19:02:54 +01:00
|
|
|
|
2009-06-29 18:47:10 +02:00
|
|
|
|
2006-03-03 03:33:15 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Intrinsic Definitions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Intrinsic class - This is used to define one LLVM intrinsic. The name of the
|
|
|
|
// intrinsic definition should start with "int_", then match the LLVM intrinsic
|
|
|
|
// name with the "llvm." prefix removed, and all "."s turned into "_"s. For
|
|
|
|
// example, llvm.bswap.i16 -> int_bswap_i16.
|
|
|
|
//
|
2008-11-13 10:08:33 +01:00
|
|
|
// * RetTypes is a list containing the return types expected for the
|
|
|
|
// intrinsic.
|
|
|
|
// * ParamTypes is a list containing the parameter types expected for the
|
|
|
|
// intrinsic.
|
2006-03-03 03:33:15 +01:00
|
|
|
// * Properties can be set to describe the behavior of the intrinsic.
|
|
|
|
//
|
2012-07-10 02:51:11 +02:00
|
|
|
class SDPatternOperator;
|
2008-11-13 10:08:33 +01:00
|
|
|
class Intrinsic<list<LLVMType> ret_types,
|
|
|
|
list<LLVMType> param_types = [],
|
2006-03-03 03:33:15 +01:00
|
|
|
list<IntrinsicProperty> properties = [],
|
2012-07-10 02:51:11 +02:00
|
|
|
string name = ""> : SDPatternOperator {
|
2006-03-03 03:33:15 +01:00
|
|
|
string LLVMName = name;
|
2006-03-15 02:32:36 +01:00
|
|
|
string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
|
2008-11-13 10:08:33 +01:00
|
|
|
list<LLVMType> RetTypes = ret_types;
|
|
|
|
list<LLVMType> ParamTypes = param_types;
|
2006-03-03 03:33:15 +01:00
|
|
|
list<IntrinsicProperty> Properties = properties;
|
2009-02-05 02:49:45 +01:00
|
|
|
|
|
|
|
bit isTarget = 0;
|
2006-03-03 03:33:15 +01:00
|
|
|
}
|
|
|
|
|
2006-03-13 23:38:32 +01:00
|
|
|
/// GCCBuiltin - If this intrinsic exactly corresponds to a GCC builtin, this
|
|
|
|
/// specifies the name of the builtin. This provides automatic CBE and CFE
|
|
|
|
/// support.
|
|
|
|
class GCCBuiltin<string name> {
|
|
|
|
string GCCBuiltinName = name;
|
|
|
|
}
|
|
|
|
|
2014-07-04 20:42:25 +02:00
|
|
|
class MSBuiltin<string name> {
|
|
|
|
string MSBuiltinName = name;
|
|
|
|
}
|
|
|
|
|
2006-03-03 03:33:15 +01:00
|
|
|
|
|
|
|
//===--------------- Variable Argument Handling Intrinsics ----------------===//
|
2009-08-14 22:27:12 +02:00
|
|
|
//
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_vastart : Intrinsic<[], [llvm_ptr_ty], [], "llvm.va_start">;
|
|
|
|
def int_vacopy : Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty], [],
|
2006-03-03 03:33:15 +01:00
|
|
|
"llvm.va_copy">;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_vaend : Intrinsic<[], [llvm_ptr_ty], [], "llvm.va_end">;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
|
|
|
//===------------------- Garbage Collection Intrinsics --------------------===//
|
2009-08-14 22:27:12 +02:00
|
|
|
//
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_gcroot : Intrinsic<[],
|
2008-11-20 08:23:34 +01:00
|
|
|
[llvm_ptrptr_ty, llvm_ptr_ty]>;
|
|
|
|
def int_gcread : Intrinsic<[llvm_ptr_ty],
|
|
|
|
[llvm_ptr_ty, llvm_ptrptr_ty],
|
2006-04-11 00:02:59 +02:00
|
|
|
[IntrReadArgMem]>;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_gcwrite : Intrinsic<[],
|
2008-11-20 08:23:34 +01:00
|
|
|
[llvm_ptr_ty, llvm_ptr_ty, llvm_ptrptr_ty],
|
2010-08-06 01:36:21 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<1>, NoCapture<2>]>;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
|
|
|
//===--------------------- Code Generator Intrinsics ----------------------===//
|
2009-08-14 22:27:12 +02:00
|
|
|
//
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_returnaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem]>;
|
|
|
|
def int_frameaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem]>;
|
2014-05-06 18:51:25 +02:00
|
|
|
def int_read_register : Intrinsic<[llvm_anyint_ty], [llvm_metadata_ty],
|
2015-05-18 18:42:10 +02:00
|
|
|
[IntrReadMem], "llvm.read_register">;
|
2014-05-06 18:51:25 +02:00
|
|
|
def int_write_register : Intrinsic<[], [llvm_metadata_ty, llvm_anyint_ty],
|
2014-05-20 19:40:03 +02:00
|
|
|
[], "llvm.write_register">;
|
2007-10-29 06:47:52 +01:00
|
|
|
|
2015-07-08 01:23:03 +02:00
|
|
|
// Gets the address of the local variable area. This is typically a copy of the
|
|
|
|
// stack, frame, or base pointer depending on the type of prologue.
|
|
|
|
def int_localaddress : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
|
|
|
|
|
|
|
|
// Escapes local variables to allow access from other functions.
|
|
|
|
def int_localescape : Intrinsic<[], [llvm_vararg_ty]>;
|
|
|
|
|
|
|
|
// Given a function and the localaddress of a parent frame, returns a pointer
|
|
|
|
// to an escaped allocation indicated by the index.
|
|
|
|
def int_localrecover : Intrinsic<[llvm_ptr_ty],
|
|
|
|
[llvm_ptr_ty, llvm_ptr_ty, llvm_i32_ty],
|
|
|
|
[IntrNoMem]>;
|
2010-05-28 01:11:57 +02:00
|
|
|
// Note: we treat stacksave/stackrestore as writemem because we don't otherwise
|
|
|
|
// model their dependencies on allocas.
|
2007-10-29 06:47:52 +01:00
|
|
|
def int_stacksave : Intrinsic<[llvm_ptr_ty]>,
|
2007-01-18 00:33:20 +01:00
|
|
|
GCCBuiltin<"__builtin_stack_save">;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_stackrestore : Intrinsic<[], [llvm_ptr_ty]>,
|
2007-01-18 00:33:20 +01:00
|
|
|
GCCBuiltin<"__builtin_stack_restore">;
|
2008-11-06 03:29:10 +01:00
|
|
|
|
2010-08-06 01:36:21 +02:00
|
|
|
// IntrReadWriteArgMem is more pessimistic than strictly necessary for prefetch,
|
2007-10-08 23:15:07 +02:00
|
|
|
// however it does conveniently prevent the prefetch from being reordered
|
|
|
|
// with respect to nearby accesses to the same memory.
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_prefetch : Intrinsic<[],
|
2011-06-14 06:58:37 +02:00
|
|
|
[llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty,
|
|
|
|
llvm_i32_ty],
|
2010-08-06 01:36:21 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<0>]>;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_pcmarker : Intrinsic<[], [llvm_i32_ty]>;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2006-12-31 23:24:55 +01:00
|
|
|
def int_readcyclecounter : Intrinsic<[llvm_i64_ty]>;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2014-07-25 23:13:35 +02:00
|
|
|
// The assume intrinsic is marked as arbitrarily writing so that proper
|
|
|
|
// control dependencies will be maintained.
|
|
|
|
def int_assume : Intrinsic<[], [llvm_i1_ty], []>;
|
|
|
|
|
2008-11-18 12:01:33 +01:00
|
|
|
// Stack Protector Intrinsic - The stackprotector intrinsic writes the stack
|
|
|
|
// guard to the correct place on the stack frame.
|
2010-08-06 01:36:21 +02:00
|
|
|
def int_stackprotector : Intrinsic<[], [llvm_ptr_ty, llvm_ptrptr_ty], []>;
|
2013-08-12 20:35:32 +02:00
|
|
|
def int_stackprotectorcheck : Intrinsic<[], [llvm_ptrptr_ty],
|
|
|
|
[IntrReadWriteArgMem]>;
|
2008-11-06 03:29:10 +01:00
|
|
|
|
2014-12-08 19:02:35 +01:00
|
|
|
// A counter increment for instrumentation based profiling.
|
|
|
|
def int_instrprof_increment : Intrinsic<[],
|
|
|
|
[llvm_ptr_ty, llvm_i64_ty,
|
|
|
|
llvm_i32_ty, llvm_i32_ty],
|
|
|
|
[]>;
|
2015-11-18 19:14:55 +01:00
|
|
|
|
|
|
|
// A call to profile runtime for value profiling of target expressions
|
|
|
|
// through instrumentation based profiling.
|
|
|
|
def int_instrprof_value_profile : Intrinsic<[],
|
|
|
|
[llvm_ptr_ty, llvm_i64_ty,
|
|
|
|
llvm_i64_ty, llvm_i32_ty,
|
|
|
|
llvm_i32_ty],
|
|
|
|
[]>;
|
|
|
|
|
2006-03-03 03:33:15 +01:00
|
|
|
//===------------------- Standard C Library Intrinsics --------------------===//
|
|
|
|
//
|
|
|
|
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_memcpy : Intrinsic<[],
|
Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
llvm-svn: 100304
2010-04-04 05:10:48 +02:00
|
|
|
[llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
|
2015-11-19 06:56:52 +01:00
|
|
|
llvm_i32_ty, llvm_i1_ty],
|
2013-07-06 02:29:58 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<0>, NoCapture<1>,
|
|
|
|
ReadOnly<1>]>;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_memmove : Intrinsic<[],
|
Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
llvm-svn: 100304
2010-04-04 05:10:48 +02:00
|
|
|
[llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
|
2015-11-19 06:56:52 +01:00
|
|
|
llvm_i32_ty, llvm_i1_ty],
|
2013-07-06 02:29:58 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<0>, NoCapture<1>,
|
|
|
|
ReadOnly<1>]>;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_memset : Intrinsic<[],
|
Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
llvm-svn: 100304
2010-04-04 05:10:48 +02:00
|
|
|
[llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty,
|
2015-11-19 06:56:52 +01:00
|
|
|
llvm_i32_ty, llvm_i1_ty],
|
2010-08-06 01:36:21 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<0>]>;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2014-03-06 01:18:15 +01:00
|
|
|
let Properties = [IntrNoMem] in {
|
|
|
|
def int_fma : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>,
|
|
|
|
LLVMMatchType<0>]>;
|
|
|
|
def int_fmuladd : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>,
|
|
|
|
LLVMMatchType<0>]>;
|
|
|
|
|
|
|
|
// These functions do not read memory, but are sensitive to the
|
|
|
|
// rounding mode. LLVM purposely does not model changes to the FP
|
|
|
|
// environment so they can be treated as readnone.
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_sqrt : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_powi : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_i32_ty]>;
|
|
|
|
def int_sin : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2009-08-14 22:27:12 +02:00
|
|
|
def int_cos : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_pow : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>]>;
|
|
|
|
def int_log : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_log10: Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_log2 : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_exp : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_exp2 : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2012-05-28 23:48:37 +02:00
|
|
|
def int_fabs : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2014-10-22 01:00:20 +02:00
|
|
|
def int_minnum : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>;
|
|
|
|
def int_maxnum : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>]>;
|
Add a llvm.copysign intrinsic
This adds a llvm.copysign intrinsic; We already have Libfunc recognition for
copysign (which is turned into the FCOPYSIGN SDAG node). In order to
autovectorize calls to copysign in the loop vectorizer, we need a corresponding
intrinsic as well.
In addition to the expected changes to the language reference, the loop
vectorizer, BasicTTI, and the SDAG builder (the intrinsic is transformed into
an FCOPYSIGN node, just like the function call), this also adds FCOPYSIGN to a
few lists in LegalizeVector{Ops,Types} so that vector copysigns can be
expanded.
In TargetLoweringBase::initActions, I've made the default action for FCOPYSIGN
be Expand for vector types. This seems correct for all in-tree targets, and I
think is the right thing to do because, previously, there was no way to generate
vector-values FCOPYSIGN nodes (and most targets don't specify an action for
vector-typed FCOPYSIGN).
llvm-svn: 188728
2013-08-20 01:35:46 +02:00
|
|
|
def int_copysign : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>]>;
|
2012-07-26 19:43:27 +02:00
|
|
|
def int_floor : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2012-11-15 07:51:10 +01:00
|
|
|
def int_ceil : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_trunc : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_rint : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_nearbyint : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2013-08-08 00:49:12 +02:00
|
|
|
def int_round : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
2015-07-11 09:01:27 +02:00
|
|
|
def int_canonicalize : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2006-03-03 03:33:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: these are internal interfaces.
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_setjmp : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty]>;
|
2012-10-19 22:43:54 +02:00
|
|
|
def int_longjmp : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrNoReturn]>;
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_sigsetjmp : Intrinsic<[llvm_i32_ty] , [llvm_ptr_ty, llvm_i32_ty]>;
|
2012-10-19 22:43:54 +02:00
|
|
|
def int_siglongjmp : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrNoReturn]>;
|
2006-03-03 03:33:15 +01:00
|
|
|
|
2009-10-27 01:52:25 +01:00
|
|
|
// Internal interface for object size checking
|
2013-10-07 20:06:48 +02:00
|
|
|
def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_anyptr_ty, llvm_i1_ty],
|
2011-02-18 17:11:40 +01:00
|
|
|
[IntrNoMem]>,
|
2009-10-27 01:52:25 +01:00
|
|
|
GCCBuiltin<"__builtin_object_size">;
|
|
|
|
|
2011-07-06 20:22:43 +02:00
|
|
|
//===------------------------- Expect Intrinsics --------------------------===//
|
|
|
|
//
|
|
|
|
def int_expect : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>,
|
|
|
|
LLVMMatchType<0>], [IntrNoMem]>;
|
|
|
|
|
2006-03-03 03:33:15 +01:00
|
|
|
//===-------------------- Bit Manipulation Intrinsics ---------------------===//
|
|
|
|
//
|
|
|
|
|
|
|
|
// None of these intrinsics accesses memory at all.
|
2006-04-11 00:02:59 +02:00
|
|
|
let Properties = [IntrNoMem] in {
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_bswap: Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
|
|
|
|
def int_ctpop: Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
|
2011-12-12 05:26:04 +01:00
|
|
|
def int_ctlz : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, llvm_i1_ty]>;
|
|
|
|
def int_cttz : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, llvm_i1_ty]>;
|
2015-11-12 13:29:09 +01:00
|
|
|
def int_bitreverse : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
|
2007-04-05 01:48:25 +02:00
|
|
|
}
|
2006-03-03 03:33:15 +01:00
|
|
|
|
|
|
|
//===------------------------ Debugger Intrinsics -------------------------===//
|
|
|
|
//
|
|
|
|
|
2009-03-04 22:53:29 +01:00
|
|
|
// None of these intrinsics accesses memory at all...but that doesn't mean the
|
|
|
|
// optimizers can change them aggressively. Special handling needed in a few
|
|
|
|
// places.
|
2009-03-04 22:24:04 +01:00
|
|
|
let Properties = [IntrNoMem] in {
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_dbg_declare : Intrinsic<[],
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-01 20:55:02 +02:00
|
|
|
[llvm_metadata_ty,
|
|
|
|
llvm_metadata_ty,
|
|
|
|
llvm_metadata_ty]>;
|
2012-07-19 02:01:00 +02:00
|
|
|
def int_dbg_value : Intrinsic<[],
|
2009-12-07 20:36:34 +01:00
|
|
|
[llvm_metadata_ty, llvm_i64_ty,
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-01 20:55:02 +02:00
|
|
|
llvm_metadata_ty,
|
2009-12-07 20:36:34 +01:00
|
|
|
llvm_metadata_ty]>;
|
2009-03-04 22:24:04 +01:00
|
|
|
}
|
2006-03-13 23:38:32 +01:00
|
|
|
|
2007-02-06 19:02:54 +01:00
|
|
|
//===------------------ Exception Handling Intrinsics----------------------===//
|
|
|
|
//
|
2009-10-14 18:11:37 +02:00
|
|
|
|
2011-09-09 09:50:37 +02:00
|
|
|
// The result of eh.typeid.for depends on the enclosing function, but inside a
|
|
|
|
// given function it is 'const' and may be CSE'd etc.
|
|
|
|
def int_eh_typeid_for : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty], [IntrNoMem]>;
|
2007-02-06 19:02:54 +01:00
|
|
|
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_eh_return_i32 : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty]>;
|
|
|
|
def int_eh_return_i64 : Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty]>;
|
2007-07-14 16:06:15 +02:00
|
|
|
|
2015-09-03 11:15:32 +02:00
|
|
|
// eh.exceptionpointer returns the pointer to the exception caught by
|
|
|
|
// the given `catchpad`.
|
|
|
|
def int_eh_exceptionpointer : Intrinsic<[llvm_anyptr_ty], [llvm_token_ty],
|
|
|
|
[IntrNoMem]>;
|
|
|
|
|
2015-10-07 02:27:33 +02:00
|
|
|
// Gets the exception code from a catchpad token. Only used on some platforms.
|
|
|
|
def int_eh_exceptioncode : Intrinsic<[llvm_i32_ty], [llvm_token_ty], [IntrNoMem]>;
|
|
|
|
|
2013-06-14 18:15:29 +02:00
|
|
|
// __builtin_unwind_init is an undocumented GCC intrinsic that causes all
|
|
|
|
// callee-saved registers to be saved and restored (regardless of whether they
|
|
|
|
// are used) in the calling function. It is used by libgcc_eh.
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_eh_unwind_init: Intrinsic<[]>,
|
2007-07-14 16:06:15 +02:00
|
|
|
GCCBuiltin<"__builtin_unwind_init">;
|
|
|
|
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_eh_dwarf_cfa : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty]>;
|
2007-07-14 16:06:15 +02:00
|
|
|
|
2009-05-13 01:59:14 +02:00
|
|
|
let Properties = [IntrNoMem] in {
|
2011-09-28 05:36:43 +02:00
|
|
|
def int_eh_sjlj_lsda : Intrinsic<[llvm_ptr_ty]>;
|
|
|
|
def int_eh_sjlj_callsite : Intrinsic<[], [llvm_i32_ty]>;
|
2009-08-13 01:03:43 +02:00
|
|
|
}
|
2011-10-10 19:08:47 +02:00
|
|
|
def int_eh_sjlj_functioncontext : Intrinsic<[], [llvm_ptr_ty]>;
|
|
|
|
def int_eh_sjlj_setjmp : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty]>;
|
2012-10-19 22:43:54 +02:00
|
|
|
def int_eh_sjlj_longjmp : Intrinsic<[], [llvm_ptr_ty], [IntrNoReturn]>;
|
2015-07-17 00:34:16 +02:00
|
|
|
def int_eh_sjlj_setup_dispatch : Intrinsic<[], []>;
|
2009-05-13 01:59:14 +02:00
|
|
|
|
2007-06-15 22:50:54 +02:00
|
|
|
//===---------------- Generic Variable Attribute Intrinsics----------------===//
|
|
|
|
//
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_var_annotation : Intrinsic<[],
|
2008-11-13 10:08:33 +01:00
|
|
|
[llvm_ptr_ty, llvm_ptr_ty,
|
2009-08-14 22:27:12 +02:00
|
|
|
llvm_ptr_ty, llvm_i32_ty],
|
2008-11-20 08:23:34 +01:00
|
|
|
[], "llvm.var.annotation">;
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_ptr_annotation : Intrinsic<[LLVMAnyPointerType<llvm_anyint_ty>],
|
|
|
|
[LLVMMatchType<0>, llvm_ptr_ty, llvm_ptr_ty,
|
2009-08-14 22:27:12 +02:00
|
|
|
llvm_i32_ty],
|
2008-11-13 10:08:33 +01:00
|
|
|
[], "llvm.ptr.annotation">;
|
|
|
|
def int_annotation : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[LLVMMatchType<0>, llvm_ptr_ty,
|
|
|
|
llvm_ptr_ty, llvm_i32_ty],
|
|
|
|
[], "llvm.annotation">;
|
2007-06-15 22:50:54 +02:00
|
|
|
|
2007-07-27 14:58:54 +02:00
|
|
|
//===------------------------ Trampoline Intrinsics -----------------------===//
|
|
|
|
//
|
2011-09-06 15:37:06 +02:00
|
|
|
def int_init_trampoline : Intrinsic<[],
|
2008-11-13 10:08:33 +01:00
|
|
|
[llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
|
2011-09-06 15:37:06 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<0>]>,
|
|
|
|
GCCBuiltin<"__builtin_init_trampoline">;
|
|
|
|
|
|
|
|
def int_adjust_trampoline : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty],
|
|
|
|
[IntrReadArgMem]>,
|
|
|
|
GCCBuiltin<"__builtin_adjust_trampoline">;
|
2007-07-27 14:58:54 +02:00
|
|
|
|
2008-11-21 01:05:31 +01:00
|
|
|
//===------------------------ Overflow Intrinsics -------------------------===//
|
|
|
|
//
|
|
|
|
|
|
|
|
// Expose the carry flag from add operations on two integrals.
|
|
|
|
def int_sadd_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
|
2009-11-29 03:44:33 +01:00
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2008-11-21 01:05:31 +01:00
|
|
|
def int_uadd_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
|
2009-11-29 03:44:33 +01:00
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2008-11-21 01:05:31 +01:00
|
|
|
|
2008-12-09 23:08:41 +01:00
|
|
|
def int_ssub_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
|
2009-11-29 03:44:33 +01:00
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2008-12-09 23:08:41 +01:00
|
|
|
def int_usub_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
|
2009-11-29 03:44:33 +01:00
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2008-12-09 23:08:41 +01:00
|
|
|
|
|
|
|
def int_smul_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
|
2009-11-29 03:44:33 +01:00
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2008-12-09 23:08:41 +01:00
|
|
|
def int_umul_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
|
2009-11-29 03:44:33 +01:00
|
|
|
[LLVMMatchType<0>, LLVMMatchType<0>],
|
|
|
|
[IntrNoMem]>;
|
2008-12-09 23:08:41 +01:00
|
|
|
|
2009-10-13 09:03:23 +02:00
|
|
|
//===------------------------- Memory Use Markers -------------------------===//
|
|
|
|
//
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_lifetime_start : Intrinsic<[],
|
2009-10-13 09:03:23 +02:00
|
|
|
[llvm_i64_ty, llvm_ptr_ty],
|
2010-08-06 01:36:21 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<1>]>;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_lifetime_end : Intrinsic<[],
|
2009-10-13 09:03:23 +02:00
|
|
|
[llvm_i64_ty, llvm_ptr_ty],
|
2010-08-06 01:36:21 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<1>]>;
|
2009-10-13 09:03:23 +02:00
|
|
|
def int_invariant_start : Intrinsic<[llvm_descriptor_ty],
|
|
|
|
[llvm_i64_ty, llvm_ptr_ty],
|
2010-11-30 05:13:41 +01:00
|
|
|
[IntrReadWriteArgMem, NoCapture<1>]>;
|
2010-03-24 00:46:07 +01:00
|
|
|
def int_invariant_end : Intrinsic<[],
|
2009-10-13 09:03:23 +02:00
|
|
|
[llvm_descriptor_ty, llvm_i64_ty,
|
|
|
|
llvm_ptr_ty],
|
2010-08-06 01:36:21 +02:00
|
|
|
[IntrReadWriteArgMem, NoCapture<2>]>;
|
2009-10-13 09:03:23 +02:00
|
|
|
|
2015-09-15 20:32:14 +02:00
|
|
|
def int_invariant_group_barrier : Intrinsic<[llvm_ptr_ty],
|
|
|
|
[llvm_ptr_ty],
|
|
|
|
[IntrNoMem]>;
|
|
|
|
|
2013-10-31 18:18:14 +01:00
|
|
|
//===------------------------ Stackmap Intrinsics -------------------------===//
|
|
|
|
//
|
|
|
|
def int_experimental_stackmap : Intrinsic<[],
|
2014-02-21 00:57:31 +01:00
|
|
|
[llvm_i64_ty, llvm_i32_ty, llvm_vararg_ty],
|
|
|
|
[Throws]>;
|
2013-10-31 18:18:14 +01:00
|
|
|
def int_experimental_patchpoint_void : Intrinsic<[],
|
2013-12-13 19:37:10 +01:00
|
|
|
[llvm_i64_ty, llvm_i32_ty,
|
2013-10-31 18:18:14 +01:00
|
|
|
llvm_ptr_ty, llvm_i32_ty,
|
2014-10-17 19:39:00 +02:00
|
|
|
llvm_vararg_ty],
|
|
|
|
[Throws]>;
|
2013-10-31 18:18:14 +01:00
|
|
|
def int_experimental_patchpoint_i64 : Intrinsic<[llvm_i64_ty],
|
2013-12-13 19:37:10 +01:00
|
|
|
[llvm_i64_ty, llvm_i32_ty,
|
2013-10-31 18:18:14 +01:00
|
|
|
llvm_ptr_ty, llvm_i32_ty,
|
2014-10-17 19:39:00 +02:00
|
|
|
llvm_vararg_ty],
|
|
|
|
[Throws]>;
|
2013-10-31 18:18:14 +01:00
|
|
|
|
2014-12-01 22:18:12 +01:00
|
|
|
|
|
|
|
//===------------------------ Garbage Collection Intrinsics ---------------===//
|
|
|
|
// These are documented in docs/Statepoint.rst
|
|
|
|
|
|
|
|
def int_experimental_gc_statepoint : Intrinsic<[llvm_i32_ty],
|
2015-05-13 01:52:24 +02:00
|
|
|
[llvm_i64_ty, llvm_i32_ty,
|
|
|
|
llvm_anyptr_ty, llvm_i32_ty,
|
2015-06-03 18:18:58 +02:00
|
|
|
llvm_i32_ty, llvm_vararg_ty],
|
|
|
|
[Throws]>;
|
2014-12-01 22:18:12 +01:00
|
|
|
|
2015-11-06 02:15:58 +01:00
|
|
|
def int_experimental_gc_result : Intrinsic<[llvm_any_ty], [llvm_i32_ty],
|
|
|
|
[IntrReadMem]>;
|
2015-01-22 21:14:38 +01:00
|
|
|
def int_experimental_gc_relocate : Intrinsic<[llvm_anyptr_ty],
|
2015-11-06 02:15:58 +01:00
|
|
|
[llvm_i32_ty, llvm_i32_ty, llvm_i32_ty],
|
|
|
|
[IntrReadMem]>;
|
2015-01-22 21:14:38 +01:00
|
|
|
|
|
|
|
// Deprecated: will be removed in a couple of weeks
|
2014-12-01 22:18:12 +01:00
|
|
|
def int_experimental_gc_result_int : Intrinsic<[llvm_anyint_ty], [llvm_i32_ty]>;
|
2015-01-22 21:14:38 +01:00
|
|
|
def int_experimental_gc_result_float : Intrinsic<[llvm_anyfloat_ty],
|
2014-12-01 22:18:12 +01:00
|
|
|
[llvm_i32_ty]>;
|
|
|
|
def int_experimental_gc_result_ptr : Intrinsic<[llvm_anyptr_ty], [llvm_i32_ty]>;
|
|
|
|
|
2007-11-16 00:25:33 +01:00
|
|
|
//===-------------------------- Other Intrinsics --------------------------===//
|
|
|
|
//
|
|
|
|
def int_flt_rounds : Intrinsic<[llvm_i32_ty]>,
|
|
|
|
GCCBuiltin<"__builtin_flt_rounds">;
|
2012-05-28 01:20:41 +02:00
|
|
|
def int_trap : Intrinsic<[], [], [IntrNoReturn]>,
|
2008-01-15 08:02:33 +01:00
|
|
|
GCCBuiltin<"__builtin_trap">;
|
2012-10-20 01:00:20 +02:00
|
|
|
def int_debugtrap : Intrinsic<[]>,
|
2012-05-14 20:58:10 +02:00
|
|
|
GCCBuiltin<"__builtin_debugtrap">;
|
2007-11-16 00:25:33 +01:00
|
|
|
|
2012-06-29 00:30:12 +02:00
|
|
|
// NOP: calls/invokes to this intrinsic are removed by codegen
|
|
|
|
def int_donothing : Intrinsic<[], [], [IntrNoMem]>;
|
|
|
|
|
2010-03-14 19:41:50 +01:00
|
|
|
// Intrisics to support half precision floating point format
|
2010-03-14 19:42:08 +01:00
|
|
|
let Properties = [IntrNoMem] in {
|
2014-07-17 12:51:23 +02:00
|
|
|
def int_convert_to_fp16 : Intrinsic<[llvm_i16_ty], [llvm_anyfloat_ty]>;
|
|
|
|
def int_convert_from_fp16 : Intrinsic<[llvm_anyfloat_ty], [llvm_i16_ty]>;
|
2010-03-14 19:42:08 +01:00
|
|
|
}
|
2010-03-14 19:41:50 +01:00
|
|
|
|
2008-11-10 21:54:11 +01:00
|
|
|
// These convert intrinsics are to support various conversions between
|
|
|
|
// various types with rounding and saturation. NOTE: avoid using these
|
|
|
|
// intrinsics as they might be removed sometime in the future and
|
|
|
|
// most targets don't support them.
|
2008-11-13 10:08:33 +01:00
|
|
|
def int_convertff : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[llvm_anyfloat_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertfsi : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertfui : Intrinsic<[llvm_anyfloat_ty],
|
|
|
|
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertsif : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[llvm_anyfloat_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertuif : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[llvm_anyfloat_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertss : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertsu : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertus : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
|
|
|
|
def int_convertuu : Intrinsic<[llvm_anyint_ty],
|
|
|
|
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
|
2008-11-10 21:54:11 +01:00
|
|
|
|
2014-03-26 13:52:28 +01:00
|
|
|
// Clear cache intrinsic, default to ignore (ie. emit nothing)
|
|
|
|
// maps to void __clear_cache() on supporting platforms
|
|
|
|
def int_clear_cache : Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty],
|
|
|
|
[], "llvm.clear_cache">;
|
|
|
|
|
2015-07-16 17:22:46 +02:00
|
|
|
// Calculate the Absolute Differences of the two input vectors.
|
|
|
|
def int_sabsdiff : Intrinsic<[llvm_anyvector_ty],
|
|
|
|
[ LLVMMatchType<0>, LLVMMatchType<0> ], [IntrNoMem]>;
|
|
|
|
def int_uabsdiff : Intrinsic<[llvm_anyvector_ty],
|
|
|
|
[ LLVMMatchType<0>, LLVMMatchType<0> ], [IntrNoMem]>;
|
|
|
|
|
2014-12-04 10:40:44 +01:00
|
|
|
//===-------------------------- Masked Intrinsics -------------------------===//
|
|
|
|
//
|
2014-12-25 08:49:20 +01:00
|
|
|
def int_masked_store : Intrinsic<[], [llvm_anyvector_ty, LLVMPointerTo<0>,
|
2014-12-04 10:40:44 +01:00
|
|
|
llvm_i32_ty,
|
|
|
|
LLVMVectorSameWidth<0, llvm_i1_ty>],
|
|
|
|
[IntrReadWriteArgMem]>;
|
|
|
|
|
|
|
|
def int_masked_load : Intrinsic<[llvm_anyvector_ty],
|
2014-12-25 08:49:20 +01:00
|
|
|
[LLVMPointerTo<0>, llvm_i32_ty,
|
|
|
|
LLVMVectorSameWidth<0, llvm_i1_ty>, LLVMMatchType<0>],
|
2014-12-04 10:40:44 +01:00
|
|
|
[IntrReadArgMem]>;
|
Masked Gather and Scatter Intrinsics.
Gather and Scatter are new introduced intrinsics, comming after recently implemented masked load and store.
This is the first patch for Gather and Scatter intrinsics. It includes only the syntax, parsing and verification.
Gather and Scatter intrinsics allow to perform multiple memory accesses (read/write) in one vector instruction.
The intrinsics are not target specific and will have the following syntax:
Gather:
declare <16 x i32> @llvm.masked.gather.v16i32(<16 x i32*> <vector of ptrs>, i32 <alignment>, <16 x i1> <mask>, <16 x i32> <passthru>)
declare <8 x float> @llvm.masked.gather.v8f32(<8 x float*><vector of ptrs>, i32 <alignment>, <8 x i1> <mask>, <8 x float><passthru>)
Scatter:
declare void @llvm.masked.scatter.v8i32(<8 x i32><vector value to be stored> , <8 x i32*><vector of ptrs> , i32 <alignment>, <8 x i1> <mask>)
declare void @llvm.masked.scatter.v16i32(<16 x i32> <vector value to be stored> , <16 x i32*> <vector of ptrs>, i32 <alignment>, <16 x i1><mask> )
Vector of ptrs - a set of source/destination addresses, to load/store the value.
Mask - switches on/off vector lanes to prevent memory access for switched-off lanes
vector of ptrs, value and mask should have the same vector width.
These are code examples where gather / scatter should be used and will allow function vectorization
;void foo1(int * restrict A, int * restrict B, int * restrict C) {
; for (int i=0; i<SIZE; i++) {
; A[i] = B[C[i]];
; }
;}
;void foo3(int * restrict A, int * restrict B) {
; for (int i=0; i<SIZE; i++) {
; A[B[i]] = i+5;
; }
;}
Tests will come in the following patches, with CodeGen and Vectorizer.
http://reviews.llvm.org/D7433
llvm-svn: 228521
2015-02-08 09:27:19 +01:00
|
|
|
|
|
|
|
def int_masked_gather: Intrinsic<[llvm_anyvector_ty],
|
|
|
|
[LLVMVectorOfPointersToElt<0>, llvm_i32_ty,
|
|
|
|
LLVMVectorSameWidth<0, llvm_i1_ty>,
|
|
|
|
LLVMMatchType<0>],
|
|
|
|
[IntrReadArgMem]>;
|
|
|
|
|
|
|
|
def int_masked_scatter: Intrinsic<[],
|
|
|
|
[llvm_anyvector_ty,
|
|
|
|
LLVMVectorOfPointersToElt<0>, llvm_i32_ty,
|
|
|
|
LLVMVectorSameWidth<0, llvm_i1_ty>],
|
|
|
|
[IntrReadWriteArgMem]>;
|
|
|
|
|
2015-02-20 21:30:47 +01:00
|
|
|
// Intrinsics to support bit sets.
|
|
|
|
def int_bitset_test : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_metadata_ty],
|
|
|
|
[IntrNoMem]>;
|
|
|
|
|
2006-03-13 23:38:32 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target-specific intrinsics
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-02 12:36:10 +01:00
|
|
|
include "llvm/IR/IntrinsicsPowerPC.td"
|
|
|
|
include "llvm/IR/IntrinsicsX86.td"
|
|
|
|
include "llvm/IR/IntrinsicsARM.td"
|
2014-05-24 14:50:23 +02:00
|
|
|
include "llvm/IR/IntrinsicsAArch64.td"
|
2013-01-02 12:36:10 +01:00
|
|
|
include "llvm/IR/IntrinsicsXCore.td"
|
|
|
|
include "llvm/IR/IntrinsicsHexagon.td"
|
|
|
|
include "llvm/IR/IntrinsicsNVVM.td"
|
|
|
|
include "llvm/IR/IntrinsicsMips.td"
|
2015-06-19 19:39:03 +02:00
|
|
|
include "llvm/IR/IntrinsicsAMDGPU.td"
|
BPF backend
Summary:
V8->V9:
- cleanup tests
V7->V8:
- addressed feedback from David:
- switched to range-based 'for' loops
- fixed formatting of tests
V6->V7:
- rebased and adjusted AsmPrinter args
- CamelCased .td, fixed formatting, cleaned up names, removed unused patterns
- diffstat: 3 files changed, 203 insertions(+), 227 deletions(-)
V5->V6:
- addressed feedback from Chandler:
- reinstated full verbose standard banner in all files
- fixed variables that were not in CamelCase
- fixed names of #ifdef in header files
- removed redundant braces in if/else chains with single statements
- fixed comments
- removed trailing empty line
- dropped debug annotations from tests
- diffstat of these changes:
46 files changed, 456 insertions(+), 469 deletions(-)
V4->V5:
- fix setLoadExtAction() interface
- clang-formated all where it made sense
V3->V4:
- added CODE_OWNERS entry for BPF backend
V2->V3:
- fix metadata in tests
V1->V2:
- addressed feedback from Tom and Matt
- removed top level change to configure (now everything via 'experimental-backend')
- reworked error reporting via DiagnosticInfo (similar to R600)
- added few more tests
- added cmake build
- added Triple::bpf
- tested on linux and darwin
V1 cover letter:
---------------------
recently linux gained "universal in-kernel virtual machine" which is called
eBPF or extended BPF. The name comes from "Berkeley Packet Filter", since
new instruction set is based on it.
This patch adds a new backend that emits extended BPF instruction set.
The concept and development are covered by the following articles:
http://lwn.net/Articles/599755/
http://lwn.net/Articles/575531/
http://lwn.net/Articles/603983/
http://lwn.net/Articles/606089/
http://lwn.net/Articles/612878/
One of use cases: dtrace/systemtap alternative.
bpf syscall manpage:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b4fc1a460f3017e958e6a8ea560ea0afd91bf6fe
instruction set description and differences vs classic BPF:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/filter.txt
Short summary of instruction set:
- 64-bit registers
R0 - return value from in-kernel function, and exit value for BPF program
R1 - R5 - arguments from BPF program to in-kernel function
R6 - R9 - callee saved registers that in-kernel function will preserve
R10 - read-only frame pointer to access stack
- two-operand instructions like +, -, *, mov, load/store
- implicit prologue/epilogue (invisible stack pointer)
- no floating point, no simd
Short history of extended BPF in kernel:
interpreter in 3.15, x64 JIT in 3.16, arm64 JIT, verifier, bpf syscall in 3.18, more to come in the future.
It's a very small and simple backend.
There is no support for global variables, arbitrary function calls, floating point, varargs,
exceptions, indirect jumps, arbitrary pointer arithmetic, alloca, etc.
From C front-end point of view it's very restricted. It's done on purpose, since kernel
rejects all programs that it cannot prove safe. It rejects programs with loops
and with memory accesses via arbitrary pointers. When kernel accepts the program it is
guaranteed that program will terminate and will not crash the kernel.
This patch implements all 'must have' bits. There are several things on TODO list,
so this is not the end of development.
Most of the code is a boiler plate code, copy-pasted from other backends.
Only odd things are lack or < and <= instructions, specialized load_byte intrinsics
and 'compare and goto' as single instruction.
Current instruction set is fixed, but more instructions can be added in the future.
Signed-off-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subscribers: majnemer, chandlerc, echristo, joerg, pete, rengolin, kristof.beyls, arsenm, t.p.northover, tstellarAMD, aemerson, llvm-commits
Differential Revision: http://reviews.llvm.org/D6494
llvm-svn: 227008
2015-01-24 18:51:26 +01:00
|
|
|
include "llvm/IR/IntrinsicsBPF.td"
|
[SystemZ] Support transactional execution on zEC12
The zEC12 provides the transactional-execution facility. This is exposed
to users via a set of builtin routines on other compilers. This patch
adds LLVM support to enable those builtins. In partciular, the patch:
- adds the transactional-execution and processor-assist facilities
- adds MC support for all instructions provided by those facilities
- adds LLVM intrinsics for those instructions and hooks them up for CodeGen
- adds CodeGen support to optimize CC return value checking
Since this is first use of target-specific intrinsics on the platform,
the patch creates the include/llvm/IR/IntrinsicsSystemZ.td file and
hooks it up in Intrinsics.td. I've also changed Triple::getArchTypePrefix
to return "s390" instead of "systemz", since the naming convention for
GCC intrinsics uses "s390" on the platform, and it neemed more straight-
forward to use the same convention for LLVM IR intrinsics.
An associated clang patch makes the intrinsics (and command line switches)
available at the source-language level.
For reference, the transactional-execution instructions are documented
in the z/Architecture Principles of Operation for the zEC12:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/download/DZ9ZR009.pdf
The associated builtins are documented in the GCC manual:
http://gcc.gnu.org/onlinedocs/gcc/S_002f390-System-z-Built-in-Functions.html
Index: llvm-head/lib/Target/SystemZ/SystemZOperators.td
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZOperators.td
+++ llvm-head/lib/Target/SystemZ/SystemZOperators.td
@@ -79,6 +79,9 @@ def SDT_ZI32Intrinsic : SDTypeProf
def SDT_ZPrefetch : SDTypeProfile<0, 2,
[SDTCisVT<0, i32>,
SDTCisPtrTy<1>]>;
+def SDT_ZTBegin : SDTypeProfile<0, 2,
+ [SDTCisPtrTy<0>,
+ SDTCisVT<1, i32>]>;
//===----------------------------------------------------------------------===//
// Node definitions
@@ -180,6 +183,15 @@ def z_prefetch : SDNode<"System
[SDNPHasChain, SDNPMayLoad, SDNPMayStore,
SDNPMemOperand]>;
+def z_tbegin : SDNode<"SystemZISD::TBEGIN", SDT_ZTBegin,
+ [SDNPHasChain, SDNPOutGlue, SDNPMayStore,
+ SDNPSideEffect]>;
+def z_tbegin_nofloat : SDNode<"SystemZISD::TBEGIN_NOFLOAT", SDT_ZTBegin,
+ [SDNPHasChain, SDNPOutGlue, SDNPMayStore,
+ SDNPSideEffect]>;
+def z_tend : SDNode<"SystemZISD::TEND", SDTNone,
+ [SDNPHasChain, SDNPOutGlue, SDNPSideEffect]>;
+
//===----------------------------------------------------------------------===//
// Pattern fragments
//===----------------------------------------------------------------------===//
Index: llvm-head/lib/Target/SystemZ/SystemZInstrFormats.td
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZInstrFormats.td
+++ llvm-head/lib/Target/SystemZ/SystemZInstrFormats.td
@@ -473,6 +473,17 @@ class InstSS<bits<8> op, dag outs, dag i
let Inst{15-0} = BD2;
}
+class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
+ : InstSystemZ<4, outs, ins, asmstr, pattern> {
+ field bits<32> Inst;
+ field bits<32> SoftFail = 0;
+
+ bits<16> BD2;
+
+ let Inst{31-16} = op;
+ let Inst{15-0} = BD2;
+}
+
//===----------------------------------------------------------------------===//
// Instruction definitions with semantics
//===----------------------------------------------------------------------===//
Index: llvm-head/lib/Target/SystemZ/SystemZInstrInfo.td
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZInstrInfo.td
+++ llvm-head/lib/Target/SystemZ/SystemZInstrInfo.td
@@ -1362,6 +1362,60 @@ let Defs = [CC] in {
}
//===----------------------------------------------------------------------===//
+// Transactional execution
+//===----------------------------------------------------------------------===//
+
+let Predicates = [FeatureTransactionalExecution] in {
+ // Transaction Begin
+ let hasSideEffects = 1, mayStore = 1,
+ usesCustomInserter = 1, Defs = [CC] in {
+ def TBEGIN : InstSIL<0xE560,
+ (outs), (ins bdaddr12only:$BD1, imm32zx16:$I2),
+ "tbegin\t$BD1, $I2",
+ [(z_tbegin bdaddr12only:$BD1, imm32zx16:$I2)]>;
+ def TBEGIN_nofloat : Pseudo<(outs), (ins bdaddr12only:$BD1, imm32zx16:$I2),
+ [(z_tbegin_nofloat bdaddr12only:$BD1,
+ imm32zx16:$I2)]>;
+ def TBEGINC : InstSIL<0xE561,
+ (outs), (ins bdaddr12only:$BD1, imm32zx16:$I2),
+ "tbeginc\t$BD1, $I2",
+ [(int_s390_tbeginc bdaddr12only:$BD1,
+ imm32zx16:$I2)]>;
+ }
+
+ // Transaction End
+ let hasSideEffects = 1, Defs = [CC], BD2 = 0 in
+ def TEND : InstS<0xB2F8, (outs), (ins), "tend", [(z_tend)]>;
+
+ // Transaction Abort
+ let hasSideEffects = 1, isTerminator = 1, isBarrier = 1 in
+ def TABORT : InstS<0xB2FC, (outs), (ins bdaddr12only:$BD2),
+ "tabort\t$BD2",
+ [(int_s390_tabort bdaddr12only:$BD2)]>;
+
+ // Nontransactional Store
+ let hasSideEffects = 1 in
+ def NTSTG : StoreRXY<"ntstg", 0xE325, int_s390_ntstg, GR64, 8>;
+
+ // Extract Transaction Nesting Depth
+ let hasSideEffects = 1 in
+ def ETND : InherentRRE<"etnd", 0xB2EC, GR32, (int_s390_etnd)>;
+}
+
+//===----------------------------------------------------------------------===//
+// Processor assist
+//===----------------------------------------------------------------------===//
+
+let Predicates = [FeatureProcessorAssist] in {
+ let hasSideEffects = 1, R4 = 0 in
+ def PPA : InstRRF<0xB2E8, (outs), (ins GR64:$R1, GR64:$R2, imm32zx4:$R3),
+ "ppa\t$R1, $R2, $R3", []>;
+ def : Pat<(int_s390_ppa_txassist GR32:$src),
+ (PPA (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$src, subreg_l32),
+ 0, 1)>;
+}
+
+//===----------------------------------------------------------------------===//
// Miscellaneous Instructions.
//===----------------------------------------------------------------------===//
Index: llvm-head/lib/Target/SystemZ/SystemZProcessors.td
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZProcessors.td
+++ llvm-head/lib/Target/SystemZ/SystemZProcessors.td
@@ -60,6 +60,16 @@ def FeatureMiscellaneousExtensions : Sys
"Assume that the miscellaneous-extensions facility is installed"
>;
+def FeatureTransactionalExecution : SystemZFeature<
+ "transactional-execution", "TransactionalExecution",
+ "Assume that the transactional-execution facility is installed"
+>;
+
+def FeatureProcessorAssist : SystemZFeature<
+ "processor-assist", "ProcessorAssist",
+ "Assume that the processor-assist facility is installed"
+>;
+
def : Processor<"generic", NoItineraries, []>;
def : Processor<"z10", NoItineraries, []>;
def : Processor<"z196", NoItineraries,
@@ -70,4 +80,5 @@ def : Processor<"zEC12", NoItineraries,
[FeatureDistinctOps, FeatureLoadStoreOnCond, FeatureHighWord,
FeatureFPExtension, FeaturePopulationCount,
FeatureFastSerialization, FeatureInterlockedAccess1,
- FeatureMiscellaneousExtensions]>;
+ FeatureMiscellaneousExtensions,
+ FeatureTransactionalExecution, FeatureProcessorAssist]>;
Index: llvm-head/lib/Target/SystemZ/SystemZSubtarget.cpp
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZSubtarget.cpp
+++ llvm-head/lib/Target/SystemZ/SystemZSubtarget.cpp
@@ -40,6 +40,7 @@ SystemZSubtarget::SystemZSubtarget(const
HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false),
HasPopulationCount(false), HasFastSerialization(false),
HasInterlockedAccess1(false), HasMiscellaneousExtensions(false),
+ HasTransactionalExecution(false), HasProcessorAssist(false),
TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
TLInfo(TM, *this), TSInfo(*TM.getDataLayout()), FrameLowering() {}
Index: llvm-head/lib/Target/SystemZ/SystemZSubtarget.h
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZSubtarget.h
+++ llvm-head/lib/Target/SystemZ/SystemZSubtarget.h
@@ -42,6 +42,8 @@ protected:
bool HasFastSerialization;
bool HasInterlockedAccess1;
bool HasMiscellaneousExtensions;
+ bool HasTransactionalExecution;
+ bool HasProcessorAssist;
private:
Triple TargetTriple;
@@ -102,6 +104,12 @@ public:
return HasMiscellaneousExtensions;
}
+ // Return true if the target has the transactional-execution facility.
+ bool hasTransactionalExecution() const { return HasTransactionalExecution; }
+
+ // Return true if the target has the processor-assist facility.
+ bool hasProcessorAssist() const { return HasProcessorAssist; }
+
// Return true if GV can be accessed using LARL for reloc model RM
// and code model CM.
bool isPC32DBLSymbol(const GlobalValue *GV, Reloc::Model RM,
Index: llvm-head/lib/Support/Triple.cpp
===================================================================
--- llvm-head.orig/lib/Support/Triple.cpp
+++ llvm-head/lib/Support/Triple.cpp
@@ -92,7 +92,7 @@ const char *Triple::getArchTypePrefix(Ar
case sparcv9:
case sparc: return "sparc";
- case systemz: return "systemz";
+ case systemz: return "s390";
case x86:
case x86_64: return "x86";
Index: llvm-head/include/llvm/IR/Intrinsics.td
===================================================================
--- llvm-head.orig/include/llvm/IR/Intrinsics.td
+++ llvm-head/include/llvm/IR/Intrinsics.td
@@ -634,3 +634,4 @@ include "llvm/IR/IntrinsicsNVVM.td"
include "llvm/IR/IntrinsicsMips.td"
include "llvm/IR/IntrinsicsR600.td"
include "llvm/IR/IntrinsicsBPF.td"
+include "llvm/IR/IntrinsicsSystemZ.td"
Index: llvm-head/include/llvm/IR/IntrinsicsSystemZ.td
===================================================================
--- /dev/null
+++ llvm-head/include/llvm/IR/IntrinsicsSystemZ.td
@@ -0,0 +1,46 @@
+//===- IntrinsicsSystemZ.td - Defines SystemZ intrinsics ---*- tablegen -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines all of the SystemZ-specific intrinsics.
+//
+//===----------------------------------------------------------------------===//
+
+//===----------------------------------------------------------------------===//
+//
+// Transactional-execution intrinsics
+//
+//===----------------------------------------------------------------------===//
+
+let TargetPrefix = "s390" in {
+ def int_s390_tbegin : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
+ [IntrNoDuplicate]>;
+
+ def int_s390_tbegin_nofloat : Intrinsic<[llvm_i32_ty],
+ [llvm_ptr_ty, llvm_i32_ty],
+ [IntrNoDuplicate]>;
+
+ def int_s390_tbeginc : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
+ [IntrNoDuplicate]>;
+
+ def int_s390_tabort : Intrinsic<[], [llvm_i64_ty],
+ [IntrNoReturn, Throws]>;
+
+ def int_s390_tend : GCCBuiltin<"__builtin_tend">,
+ Intrinsic<[llvm_i32_ty], []>;
+
+ def int_s390_etnd : GCCBuiltin<"__builtin_tx_nesting_depth">,
+ Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>;
+
+ def int_s390_ntstg : Intrinsic<[], [llvm_i64_ty, llvm_ptr64_ty],
+ [IntrReadWriteArgMem]>;
+
+ def int_s390_ppa_txassist : GCCBuiltin<"__builtin_tx_assist">,
+ Intrinsic<[], [llvm_i32_ty]>;
+}
+
Index: llvm-head/lib/Target/SystemZ/SystemZ.h
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZ.h
+++ llvm-head/lib/Target/SystemZ/SystemZ.h
@@ -68,6 +68,18 @@ const unsigned CCMASK_TM_MSB_0 = C
const unsigned CCMASK_TM_MSB_1 = CCMASK_2 | CCMASK_3;
const unsigned CCMASK_TM = CCMASK_ANY;
+// Condition-code mask assignments for TRANSACTION_BEGIN.
+const unsigned CCMASK_TBEGIN_STARTED = CCMASK_0;
+const unsigned CCMASK_TBEGIN_INDETERMINATE = CCMASK_1;
+const unsigned CCMASK_TBEGIN_TRANSIENT = CCMASK_2;
+const unsigned CCMASK_TBEGIN_PERSISTENT = CCMASK_3;
+const unsigned CCMASK_TBEGIN = CCMASK_ANY;
+
+// Condition-code mask assignments for TRANSACTION_END.
+const unsigned CCMASK_TEND_TX = CCMASK_0;
+const unsigned CCMASK_TEND_NOTX = CCMASK_2;
+const unsigned CCMASK_TEND = CCMASK_TEND_TX | CCMASK_TEND_NOTX;
+
// The position of the low CC bit in an IPM result.
const unsigned IPM_CC = 28;
Index: llvm-head/lib/Target/SystemZ/SystemZISelLowering.h
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZISelLowering.h
+++ llvm-head/lib/Target/SystemZ/SystemZISelLowering.h
@@ -146,6 +146,15 @@ enum {
// Perform a serialization operation. (BCR 15,0 or BCR 14,0.)
SERIALIZE,
+ // Transaction begin. The first operand is the chain, the second
+ // the TDB pointer, and the third the immediate control field.
+ // Returns chain and glue.
+ TBEGIN,
+ TBEGIN_NOFLOAT,
+
+ // Transaction end. Just the chain operand. Returns chain and glue.
+ TEND,
+
// Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or
// ATOMIC_LOAD_<op>.
//
@@ -318,6 +327,7 @@ private:
SDValue lowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerPREFETCH(SDValue Op, SelectionDAG &DAG) const;
+ SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
// If the last instruction before MBBI in MBB was some form of COMPARE,
// try to replace it with a COMPARE AND BRANCH just before MBBI.
@@ -355,6 +365,10 @@ private:
MachineBasicBlock *emitStringWrapper(MachineInstr *MI,
MachineBasicBlock *BB,
unsigned Opcode) const;
+ MachineBasicBlock *emitTransactionBegin(MachineInstr *MI,
+ MachineBasicBlock *MBB,
+ unsigned Opcode,
+ bool NoFloat) const;
};
} // end namespace llvm
Index: llvm-head/lib/Target/SystemZ/SystemZISelLowering.cpp
===================================================================
--- llvm-head.orig/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ llvm-head/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -20,6 +20,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
+#include "llvm/IR/Intrinsics.h"
#include <cctype>
using namespace llvm;
@@ -304,6 +305,9 @@ SystemZTargetLowering::SystemZTargetLowe
// Codes for which we want to perform some z-specific combinations.
setTargetDAGCombine(ISD::SIGN_EXTEND);
+ // Handle intrinsics.
+ setOperationAction(ISD::INTRINSIC_W_CHAIN, MVT::Other, Custom);
+
// We want to use MVC in preference to even a single load/store pair.
MaxStoresPerMemcpy = 0;
MaxStoresPerMemcpyOptSize = 0;
@@ -1031,6 +1035,53 @@ prepareVolatileOrAtomicLoad(SDValue Chai
return DAG.getNode(SystemZISD::SERIALIZE, DL, MVT::Other, Chain);
}
+// Return true if Op is an intrinsic node with chain that returns the CC value
+// as its only (other) argument. Provide the associated SystemZISD opcode and
+// the mask of valid CC values if so.
+static bool isIntrinsicWithCCAndChain(SDValue Op, unsigned &Opcode,
+ unsigned &CCValid) {
+ unsigned Id = cast<ConstantSDNode>(Op.getOperand(1))->getZExtValue();
+ switch (Id) {
+ case Intrinsic::s390_tbegin:
+ Opcode = SystemZISD::TBEGIN;
+ CCValid = SystemZ::CCMASK_TBEGIN;
+ return true;
+
+ case Intrinsic::s390_tbegin_nofloat:
+ Opcode = SystemZISD::TBEGIN_NOFLOAT;
+ CCValid = SystemZ::CCMASK_TBEGIN;
+ return true;
+
+ case Intrinsic::s390_tend:
+ Opcode = SystemZISD::TEND;
+ CCValid = SystemZ::CCMASK_TEND;
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+// Emit an intrinsic with chain with a glued value instead of its CC result.
+static SDValue emitIntrinsicWithChainAndGlue(SelectionDAG &DAG, SDValue Op,
+ unsigned Opcode) {
+ // Copy all operands except the intrinsic ID.
+ unsigned NumOps = Op.getNumOperands();
+ SmallVector<SDValue, 6> Ops;
+ Ops.reserve(NumOps - 1);
+ Ops.push_back(Op.getOperand(0));
+ for (unsigned I = 2; I < NumOps; ++I)
+ Ops.push_back(Op.getOperand(I));
+
+ assert(Op->getNumValues() == 2 && "Expected only CC result and chain");
+ SDVTList RawVTs = DAG.getVTList(MVT::Other, MVT::Glue);
+ SDValue Intr = DAG.getNode(Opcode, SDLoc(Op), RawVTs, Ops);
+ SDValue OldChain = SDValue(Op.getNode(), 1);
+ SDValue NewChain = SDValue(Intr.getNode(), 0);
+ DAG.ReplaceAllUsesOfValueWith(OldChain, NewChain);
+ return Intr;
+}
+
// CC is a comparison that will be implemented using an integer or
// floating-point comparison. Return the condition code mask for
// a branch on true. In the integer case, CCMASK_CMP_UO is set for
@@ -1588,9 +1639,53 @@ static void adjustForTestUnderMask(Selec
C.CCMask = NewCCMask;
}
+// Return a Comparison that tests the condition-code result of intrinsic
+// node Call against constant integer CC using comparison code Cond.
+// Opcode is the opcode of the SystemZISD operation for the intrinsic
+// and CCValid is the set of possible condition-code results.
+static Comparison getIntrinsicCmp(SelectionDAG &DAG, unsigned Opcode,
+ SDValue Call, unsigned CCValid, uint64_t CC,
+ ISD::CondCode Cond) {
+ Comparison C(Call, SDValue());
+ C.Opcode = Opcode;
+ C.CCValid = CCValid;
+ if (Cond == ISD::SETEQ)
+ // bit 3 for CC==0, bit 0 for CC==3, always false for CC>3.
+ C.CCMask = CC < 4 ? 1 << (3 - CC) : 0;
+ else if (Cond == ISD::SETNE)
+ // ...and the inverse of that.
+ C.CCMask = CC < 4 ? ~(1 << (3 - CC)) : -1;
+ else if (Cond == ISD::SETLT || Cond == ISD::SETULT)
+ // bits above bit 3 for CC==0 (always false), bits above bit 0 for CC==3,
+ // always true for CC>3.
+ C.CCMask = CC < 4 ? -1 << (4 - CC) : -1;
+ else if (Cond == ISD::SETGE || Cond == ISD::SETUGE)
+ // ...and the inverse of that.
+ C.CCMask = CC < 4 ? ~(-1 << (4 - CC)) : 0;
+ else if (Cond == ISD::SETLE || Cond == ISD::SETULE)
+ // bit 3 and above for CC==0, bit 0 and above for CC==3 (always true),
+ // always true for CC>3.
+ C.CCMask = CC < 4 ? -1 << (3 - CC) : -1;
+ else if (Cond == ISD::SETGT || Cond == ISD::SETUGT)
+ // ...and the inverse of that.
+ C.CCMask = CC < 4 ? ~(-1 << (3 - CC)) : 0;
+ else
+ llvm_unreachable("Unexpected integer comparison type");
+ C.CCMask &= CCValid;
+ return C;
+}
+
// Decide how to implement a comparison of type Cond between CmpOp0 with CmpOp1.
static Comparison getCmp(SelectionDAG &DAG, SDValue CmpOp0, SDValue CmpOp1,
ISD::CondCode Cond) {
+ if (CmpOp1.getOpcode() == ISD::Constant) {
+ uint64_t Constant = cast<ConstantSDNode>(CmpOp1)->getZExtValue();
+ unsigned Opcode, CCValid;
+ if (CmpOp0.getOpcode() == ISD::INTRINSIC_W_CHAIN &&
+ CmpOp0.getResNo() == 0 && CmpOp0->hasNUsesOfValue(1, 0) &&
+ isIntrinsicWithCCAndChain(CmpOp0, Opcode, CCValid))
+ return getIntrinsicCmp(DAG, Opcode, CmpOp0, CCValid, Constant, Cond);
+ }
Comparison C(CmpOp0, CmpOp1);
C.CCMask = CCMaskForCondCode(Cond);
if (C.Op0.getValueType().isFloatingPoint()) {
@@ -1632,6 +1727,17 @@ static Comparison getCmp(SelectionDAG &D
// Emit the comparison instruction described by C.
static SDValue emitCmp(SelectionDAG &DAG, SDLoc DL, Comparison &C) {
+ if (!C.Op1.getNode()) {
+ SDValue Op;
+ switch (C.Op0.getOpcode()) {
+ case ISD::INTRINSIC_W_CHAIN:
+ Op = emitIntrinsicWithChainAndGlue(DAG, C.Op0, C.Opcode);
+ break;
+ default:
+ llvm_unreachable("Invalid comparison operands");
+ }
+ return SDValue(Op.getNode(), Op->getNumValues() - 1);
+ }
if (C.Opcode == SystemZISD::ICMP)
return DAG.getNode(SystemZISD::ICMP, DL, MVT::Glue, C.Op0, C.Op1,
DAG.getConstant(C.ICmpType, MVT::i32));
@@ -1713,7 +1819,6 @@ SDValue SystemZTargetLowering::lowerSETC
}
SDValue SystemZTargetLowering::lowerBR_CC(SDValue Op, SelectionDAG &DAG) const {
- SDValue Chain = Op.getOperand(0);
ISD::CondCode CC = cast<CondCodeSDNode>(Op.getOperand(1))->get();
SDValue CmpOp0 = Op.getOperand(2);
SDValue CmpOp1 = Op.getOperand(3);
@@ -1723,7 +1828,7 @@ SDValue SystemZTargetLowering::lowerBR_C
Comparison C(getCmp(DAG, CmpOp0, CmpOp1, CC));
SDValue Glue = emitCmp(DAG, DL, C);
return DAG.getNode(SystemZISD::BR_CCMASK, DL, Op.getValueType(),
- Chain, DAG.getConstant(C.CCValid, MVT::i32),
+ Op.getOperand(0), DAG.getConstant(C.CCValid, MVT::i32),
DAG.getConstant(C.CCMask, MVT::i32), Dest, Glue);
}
@@ -2561,6 +2666,30 @@ SDValue SystemZTargetLowering::lowerPREF
Node->getMemoryVT(), Node->getMemOperand());
}
+// Return an i32 that contains the value of CC immediately after After,
+// whose final operand must be MVT::Glue.
+static SDValue getCCResult(SelectionDAG &DAG, SDNode *After) {
+ SDValue Glue = SDValue(After, After->getNumValues() - 1);
+ SDValue IPM = DAG.getNode(SystemZISD::IPM, SDLoc(After), MVT::i32, Glue);
+ return DAG.getNode(ISD::SRL, SDLoc(After), MVT::i32, IPM,
+ DAG.getConstant(SystemZ::IPM_CC, MVT::i32));
+}
+
+SDValue
+SystemZTargetLowering::lowerINTRINSIC_W_CHAIN(SDValue Op,
+ SelectionDAG &DAG) const {
+ unsigned Opcode, CCValid;
+ if (isIntrinsicWithCCAndChain(Op, Opcode, CCValid)) {
+ assert(Op->getNumValues() == 2 && "Expected only CC result and chain");
+ SDValue Glued = emitIntrinsicWithChainAndGlue(DAG, Op, Opcode);
+ SDValue CC = getCCResult(DAG, Glued.getNode());
+ DAG.ReplaceAllUsesOfValueWith(SDValue(Op.getNode(), 0), CC);
+ return SDValue();
+ }
+
+ return SDValue();
+}
+
SDValue SystemZTargetLowering::LowerOperation(SDValue Op,
SelectionDAG &DAG) const {
switch (Op.getOpcode()) {
@@ -2634,6 +2763,8 @@ SDValue SystemZTargetLowering::LowerOper
return lowerSTACKRESTORE(Op, DAG);
case ISD::PREFETCH:
return lowerPREFETCH(Op, DAG);
+ case ISD::INTRINSIC_W_CHAIN:
+ return lowerINTRINSIC_W_CHAIN(Op, DAG);
default:
llvm_unreachable("Unexpected node to lower");
}
@@ -2674,6 +2805,9 @@ const char *SystemZTargetLowering::getTa
OPCODE(SEARCH_STRING);
OPCODE(IPM);
OPCODE(SERIALIZE);
+ OPCODE(TBEGIN);
+ OPCODE(TBEGIN_NOFLOAT);
+ OPCODE(TEND);
OPCODE(ATOMIC_SWAPW);
OPCODE(ATOMIC_LOADW_ADD);
OPCODE(ATOMIC_LOADW_SUB);
@@ -3501,6 +3635,50 @@ SystemZTargetLowering::emitStringWrapper
return DoneMBB;
}
+// Update TBEGIN instruction with final opcode and register clobbers.
+MachineBasicBlock *
+SystemZTargetLowering::emitTransactionBegin(MachineInstr *MI,
+ MachineBasicBlock *MBB,
+ unsigned Opcode,
+ bool NoFloat) const {
+ MachineFunction &MF = *MBB->getParent();
+ const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
+ const SystemZInstrInfo *TII = Subtarget.getInstrInfo();
+
+ // Update opcode.
+ MI->setDesc(TII->get(Opcode));
+
+ // We cannot handle a TBEGIN that clobbers the stack or frame pointer.
+ // Make sure to add the corresponding GRSM bits if they are missing.
+ uint64_t Control = MI->getOperand(2).getImm();
+ static const unsigned GPRControlBit[16] = {
+ 0x8000, 0x8000, 0x4000, 0x4000, 0x2000, 0x2000, 0x1000, 0x1000,
+ 0x0800, 0x0800, 0x0400, 0x0400, 0x0200, 0x0200, 0x0100, 0x0100
+ };
+ Control |= GPRControlBit[15];
+ if (TFI->hasFP(MF))
+ Control |= GPRControlBit[11];
+ MI->getOperand(2).setImm(Control);
+
+ // Add GPR clobbers.
+ for (int I = 0; I < 16; I++) {
+ if ((Control & GPRControlBit[I]) == 0) {
+ unsigned Reg = SystemZMC::GR64Regs[I];
+ MI->addOperand(MachineOperand::CreateReg(Reg, true, true));
+ }
+ }
+
+ // Add FPR clobbers.
+ if (!NoFloat && (Control & 4) != 0) {
+ for (int I = 0; I < 16; I++) {
+ unsigned Reg = SystemZMC::FP64Regs[I];
+ MI->addOperand(MachineOperand::CreateReg(Reg, true, true));
+ }
+ }
+
+ return MBB;
+}
+
MachineBasicBlock *SystemZTargetLowering::
EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const {
switch (MI->getOpcode()) {
@@ -3742,6 +3920,12 @@ EmitInstrWithCustomInserter(MachineInstr
return emitStringWrapper(MI, MBB, SystemZ::MVST);
case SystemZ::SRSTLoop:
return emitStringWrapper(MI, MBB, SystemZ::SRST);
+ case SystemZ::TBEGIN:
+ return emitTransactionBegin(MI, MBB, SystemZ::TBEGIN, false);
+ case SystemZ::TBEGIN_nofloat:
+ return emitTransactionBegin(MI, MBB, SystemZ::TBEGIN, true);
+ case SystemZ::TBEGINC:
+ return emitTransactionBegin(MI, MBB, SystemZ::TBEGINC, true);
default:
llvm_unreachable("Unexpected instr type to insert");
}
Index: llvm-head/test/CodeGen/SystemZ/htm-intrinsics.ll
===================================================================
--- /dev/null
+++ llvm-head/test/CodeGen/SystemZ/htm-intrinsics.ll
@@ -0,0 +1,352 @@
+; Test transactional-execution intrinsics.
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=zEC12 | FileCheck %s
+
+declare i32 @llvm.s390.tbegin(i8 *, i32)
+declare i32 @llvm.s390.tbegin.nofloat(i8 *, i32)
+declare void @llvm.s390.tbeginc(i8 *, i32)
+declare i32 @llvm.s390.tend()
+declare void @llvm.s390.tabort(i64)
+declare void @llvm.s390.ntstg(i64, i64 *)
+declare i32 @llvm.s390.etnd()
+declare void @llvm.s390.ppa.txassist(i32)
+
+; TBEGIN.
+define void @test_tbegin() {
+; CHECK-LABEL: test_tbegin:
+; CHECK-NOT: stmg
+; CHECK: std %f8,
+; CHECK: std %f9,
+; CHECK: std %f10,
+; CHECK: std %f11,
+; CHECK: std %f12,
+; CHECK: std %f13,
+; CHECK: std %f14,
+; CHECK: std %f15,
+; CHECK: tbegin 0, 65292
+; CHECK: ld %f8,
+; CHECK: ld %f9,
+; CHECK: ld %f10,
+; CHECK: ld %f11,
+; CHECK: ld %f12,
+; CHECK: ld %f13,
+; CHECK: ld %f14,
+; CHECK: ld %f15,
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin(i8 *null, i32 65292)
+ ret void
+}
+
+; TBEGIN (nofloat).
+define void @test_tbegin_nofloat1() {
+; CHECK-LABEL: test_tbegin_nofloat1:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbegin 0, 65292
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 65292)
+ ret void
+}
+
+; TBEGIN (nofloat) with integer CC return value.
+define i32 @test_tbegin_nofloat2() {
+; CHECK-LABEL: test_tbegin_nofloat2:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbegin 0, 65292
+; CHECK: ipm %r2
+; CHECK: srl %r2, 28
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 65292)
+ ret i32 %res
+}
+
+; TBEGIN (nofloat) with implicit CC check.
+define void @test_tbegin_nofloat3(i32 *%ptr) {
+; CHECK-LABEL: test_tbegin_nofloat3:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbegin 0, 65292
+; CHECK: jnh {{\.L*}}
+; CHECK: mvhi 0(%r2), 0
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 65292)
+ %cmp = icmp eq i32 %res, 2
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store i32 0, i32* %ptr, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret void
+}
+
+; TBEGIN (nofloat) with dual CC use.
+define i32 @test_tbegin_nofloat4(i32 %pad, i32 *%ptr) {
+; CHECK-LABEL: test_tbegin_nofloat4:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbegin 0, 65292
+; CHECK: ipm %r2
+; CHECK: srl %r2, 28
+; CHECK: cijlh %r2, 2, {{\.L*}}
+; CHECK: mvhi 0(%r3), 0
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 65292)
+ %cmp = icmp eq i32 %res, 2
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store i32 0, i32* %ptr, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret i32 %res
+}
+
+; TBEGIN (nofloat) with register.
+define void @test_tbegin_nofloat5(i8 *%ptr) {
+; CHECK-LABEL: test_tbegin_nofloat5:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbegin 0(%r2), 65292
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin.nofloat(i8 *%ptr, i32 65292)
+ ret void
+}
+
+; TBEGIN (nofloat) with GRSM 0x0f00.
+define void @test_tbegin_nofloat6() {
+; CHECK-LABEL: test_tbegin_nofloat6:
+; CHECK: stmg %r6, %r15,
+; CHECK-NOT: std
+; CHECK: tbegin 0, 3840
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 3840)
+ ret void
+}
+
+; TBEGIN (nofloat) with GRSM 0xf100.
+define void @test_tbegin_nofloat7() {
+; CHECK-LABEL: test_tbegin_nofloat7:
+; CHECK: stmg %r8, %r15,
+; CHECK-NOT: std
+; CHECK: tbegin 0, 61696
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 61696)
+ ret void
+}
+
+; TBEGIN (nofloat) with GRSM 0xfe00 -- stack pointer added automatically.
+define void @test_tbegin_nofloat8() {
+; CHECK-LABEL: test_tbegin_nofloat8:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbegin 0, 65280
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 65024)
+ ret void
+}
+
+; TBEGIN (nofloat) with GRSM 0xfb00 -- no frame pointer needed.
+define void @test_tbegin_nofloat9() {
+; CHECK-LABEL: test_tbegin_nofloat9:
+; CHECK: stmg %r10, %r15,
+; CHECK-NOT: std
+; CHECK: tbegin 0, 64256
+; CHECK: br %r14
+ call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 64256)
+ ret void
+}
+
+; TBEGIN (nofloat) with GRSM 0xfb00 -- frame pointer added automatically.
+define void @test_tbegin_nofloat10(i64 %n) {
+; CHECK-LABEL: test_tbegin_nofloat10:
+; CHECK: stmg %r11, %r15,
+; CHECK-NOT: std
+; CHECK: tbegin 0, 65280
+; CHECK: br %r14
+ %buf = alloca i8, i64 %n
+ call i32 @llvm.s390.tbegin.nofloat(i8 *null, i32 64256)
+ ret void
+}
+
+; TBEGINC.
+define void @test_tbeginc() {
+; CHECK-LABEL: test_tbeginc:
+; CHECK-NOT: stmg
+; CHECK-NOT: std
+; CHECK: tbeginc 0, 65288
+; CHECK: br %r14
+ call void @llvm.s390.tbeginc(i8 *null, i32 65288)
+ ret void
+}
+
+; TEND with integer CC return value.
+define i32 @test_tend1() {
+; CHECK-LABEL: test_tend1:
+; CHECK: tend
+; CHECK: ipm %r2
+; CHECK: srl %r2, 28
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.tend()
+ ret i32 %res
+}
+
+; TEND with implicit CC check.
+define void @test_tend3(i32 *%ptr) {
+; CHECK-LABEL: test_tend3:
+; CHECK: tend
+; CHECK: je {{\.L*}}
+; CHECK: mvhi 0(%r2), 0
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.tend()
+ %cmp = icmp eq i32 %res, 2
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store i32 0, i32* %ptr, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret void
+}
+
+; TEND with dual CC use.
+define i32 @test_tend2(i32 %pad, i32 *%ptr) {
+; CHECK-LABEL: test_tend2:
+; CHECK: tend
+; CHECK: ipm %r2
+; CHECK: srl %r2, 28
+; CHECK: cijlh %r2, 2, {{\.L*}}
+; CHECK: mvhi 0(%r3), 0
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.tend()
+ %cmp = icmp eq i32 %res, 2
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store i32 0, i32* %ptr, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret i32 %res
+}
+
+; TABORT with register only.
+define void @test_tabort1(i64 %val) {
+; CHECK-LABEL: test_tabort1:
+; CHECK: tabort 0(%r2)
+; CHECK: br %r14
+ call void @llvm.s390.tabort(i64 %val)
+ ret void
+}
+
+; TABORT with immediate only.
+define void @test_tabort2(i64 %val) {
+; CHECK-LABEL: test_tabort2:
+; CHECK: tabort 1234
+; CHECK: br %r14
+ call void @llvm.s390.tabort(i64 1234)
+ ret void
+}
+
+; TABORT with register + immediate.
+define void @test_tabort3(i64 %val) {
+; CHECK-LABEL: test_tabort3:
+; CHECK: tabort 1234(%r2)
+; CHECK: br %r14
+ %sum = add i64 %val, 1234
+ call void @llvm.s390.tabort(i64 %sum)
+ ret void
+}
+
+; TABORT with out-of-range immediate.
+define void @test_tabort4(i64 %val) {
+; CHECK-LABEL: test_tabort4:
+; CHECK: tabort 0({{%r[1-5]}})
+; CHECK: br %r14
+ call void @llvm.s390.tabort(i64 4096)
+ ret void
+}
+
+; NTSTG with base pointer only.
+define void @test_ntstg1(i64 *%ptr, i64 %val) {
+; CHECK-LABEL: test_ntstg1:
+; CHECK: ntstg %r3, 0(%r2)
+; CHECK: br %r14
+ call void @llvm.s390.ntstg(i64 %val, i64 *%ptr)
+ ret void
+}
+
+; NTSTG with base and index.
+; Check that VSTL doesn't allow an index.
+define void @test_ntstg2(i64 *%base, i64 %index, i64 %val) {
+; CHECK-LABEL: test_ntstg2:
+; CHECK: sllg [[REG:%r[1-5]]], %r3, 3
+; CHECK: ntstg %r4, 0([[REG]],%r2)
+; CHECK: br %r14
+ %ptr = getelementptr i64, i64 *%base, i64 %index
+ call void @llvm.s390.ntstg(i64 %val, i64 *%ptr)
+ ret void
+}
+
+; NTSTG with the highest in-range displacement.
+define void @test_ntstg3(i64 *%base, i64 %val) {
+; CHECK-LABEL: test_ntstg3:
+; CHECK: ntstg %r3, 524280(%r2)
+; CHECK: br %r14
+ %ptr = getelementptr i64, i64 *%base, i64 65535
+ call void @llvm.s390.ntstg(i64 %val, i64 *%ptr)
+ ret void
+}
+
+; NTSTG with an out-of-range positive displacement.
+define void @test_ntstg4(i64 *%base, i64 %val) {
+; CHECK-LABEL: test_ntstg4:
+; CHECK: ntstg %r3, 0({{%r[1-5]}})
+; CHECK: br %r14
+ %ptr = getelementptr i64, i64 *%base, i64 65536
+ call void @llvm.s390.ntstg(i64 %val, i64 *%ptr)
+ ret void
+}
+
+; NTSTG with the lowest in-range displacement.
+define void @test_ntstg5(i64 *%base, i64 %val) {
+; CHECK-LABEL: test_ntstg5:
+; CHECK: ntstg %r3, -524288(%r2)
+; CHECK: br %r14
+ %ptr = getelementptr i64, i64 *%base, i64 -65536
+ call void @llvm.s390.ntstg(i64 %val, i64 *%ptr)
+ ret void
+}
+
+; NTSTG with an out-of-range negative displacement.
+define void @test_ntstg6(i64 *%base, i64 %val) {
+; CHECK-LABEL: test_ntstg6:
+; CHECK: ntstg %r3, 0({{%r[1-5]}})
+; CHECK: br %r14
+ %ptr = getelementptr i64, i64 *%base, i64 -65537
+ call void @llvm.s390.ntstg(i64 %val, i64 *%ptr)
+ ret void
+}
+
+; ETND.
+define i32 @test_etnd() {
+; CHECK-LABEL: test_etnd:
+; CHECK: etnd %r2
+; CHECK: br %r14
+ %res = call i32 @llvm.s390.etnd()
+ ret i32 %res
+}
+
+; PPA (Transaction-Abort Assist)
+define void @test_ppa_txassist(i32 %val) {
+; CHECK-LABEL: test_ppa_txassist:
+; CHECK: ppa %r2, 0, 1
+; CHECK: br %r14
+ call void @llvm.s390.ppa.txassist(i32 %val)
+ ret void
+}
+
Index: llvm-head/test/MC/SystemZ/insn-bad-zEC12.s
===================================================================
--- llvm-head.orig/test/MC/SystemZ/insn-bad-zEC12.s
+++ llvm-head/test/MC/SystemZ/insn-bad-zEC12.s
@@ -3,6 +3,22 @@
# RUN: FileCheck < %t %s
#CHECK: error: invalid operand
+#CHECK: ntstg %r0, -524289
+#CHECK: error: invalid operand
+#CHECK: ntstg %r0, 524288
+
+ ntstg %r0, -524289
+ ntstg %r0, 524288
+
+#CHECK: error: invalid operand
+#CHECK: ppa %r0, %r0, -1
+#CHECK: error: invalid operand
+#CHECK: ppa %r0, %r0, 16
+
+ ppa %r0, %r0, -1
+ ppa %r0, %r0, 16
+
+#CHECK: error: invalid operand
#CHECK: risbgn %r0,%r0,0,0,-1
#CHECK: error: invalid operand
#CHECK: risbgn %r0,%r0,0,0,64
@@ -22,3 +38,47 @@
risbgn %r0,%r0,-1,0,0
risbgn %r0,%r0,256,0,0
+#CHECK: error: invalid operand
+#CHECK: tabort -1
+#CHECK: error: invalid operand
+#CHECK: tabort 4096
+#CHECK: error: invalid use of indexed addressing
+#CHECK: tabort 0(%r1,%r2)
+
+ tabort -1
+ tabort 4096
+ tabort 0(%r1,%r2)
+
+#CHECK: error: invalid operand
+#CHECK: tbegin -1, 0
+#CHECK: error: invalid operand
+#CHECK: tbegin 4096, 0
+#CHECK: error: invalid use of indexed addressing
+#CHECK: tbegin 0(%r1,%r2), 0
+#CHECK: error: invalid operand
+#CHECK: tbegin 0, -1
+#CHECK: error: invalid operand
+#CHECK: tbegin 0, 65536
+
+ tbegin -1, 0
+ tbegin 4096, 0
+ tbegin 0(%r1,%r2), 0
+ tbegin 0, -1
+ tbegin 0, 65536
+
+#CHECK: error: invalid operand
+#CHECK: tbeginc -1, 0
+#CHECK: error: invalid operand
+#CHECK: tbeginc 4096, 0
+#CHECK: error: invalid use of indexed addressing
+#CHECK: tbeginc 0(%r1,%r2), 0
+#CHECK: error: invalid operand
+#CHECK: tbeginc 0, -1
+#CHECK: error: invalid operand
+#CHECK: tbeginc 0, 65536
+
+ tbeginc -1, 0
+ tbeginc 4096, 0
+ tbeginc 0(%r1,%r2), 0
+ tbeginc 0, -1
+ tbeginc 0, 65536
Index: llvm-head/test/MC/SystemZ/insn-good-zEC12.s
===================================================================
--- llvm-head.orig/test/MC/SystemZ/insn-good-zEC12.s
+++ llvm-head/test/MC/SystemZ/insn-good-zEC12.s
@@ -1,6 +1,48 @@
# For zEC12 and above.
# RUN: llvm-mc -triple s390x-linux-gnu -mcpu=zEC12 -show-encoding %s | FileCheck %s
+#CHECK: etnd %r0 # encoding: [0xb2,0xec,0x00,0x00]
+#CHECK: etnd %r15 # encoding: [0xb2,0xec,0x00,0xf0]
+#CHECK: etnd %r7 # encoding: [0xb2,0xec,0x00,0x70]
+
+ etnd %r0
+ etnd %r15
+ etnd %r7
+
+#CHECK: ntstg %r0, -524288 # encoding: [0xe3,0x00,0x00,0x00,0x80,0x25]
+#CHECK: ntstg %r0, -1 # encoding: [0xe3,0x00,0x0f,0xff,0xff,0x25]
+#CHECK: ntstg %r0, 0 # encoding: [0xe3,0x00,0x00,0x00,0x00,0x25]
+#CHECK: ntstg %r0, 1 # encoding: [0xe3,0x00,0x00,0x01,0x00,0x25]
+#CHECK: ntstg %r0, 524287 # encoding: [0xe3,0x00,0x0f,0xff,0x7f,0x25]
+#CHECK: ntstg %r0, 0(%r1) # encoding: [0xe3,0x00,0x10,0x00,0x00,0x25]
+#CHECK: ntstg %r0, 0(%r15) # encoding: [0xe3,0x00,0xf0,0x00,0x00,0x25]
+#CHECK: ntstg %r0, 524287(%r1,%r15) # encoding: [0xe3,0x01,0xff,0xff,0x7f,0x25]
+#CHECK: ntstg %r0, 524287(%r15,%r1) # encoding: [0xe3,0x0f,0x1f,0xff,0x7f,0x25]
+#CHECK: ntstg %r15, 0 # encoding: [0xe3,0xf0,0x00,0x00,0x00,0x25]
+
+ ntstg %r0, -524288
+ ntstg %r0, -1
+ ntstg %r0, 0
+ ntstg %r0, 1
+ ntstg %r0, 524287
+ ntstg %r0, 0(%r1)
+ ntstg %r0, 0(%r15)
+ ntstg %r0, 524287(%r1,%r15)
+ ntstg %r0, 524287(%r15,%r1)
+ ntstg %r15, 0
+
+#CHECK: ppa %r0, %r0, 0 # encoding: [0xb2,0xe8,0x00,0x00]
+#CHECK: ppa %r0, %r0, 15 # encoding: [0xb2,0xe8,0xf0,0x00]
+#CHECK: ppa %r0, %r15, 0 # encoding: [0xb2,0xe8,0x00,0x0f]
+#CHECK: ppa %r4, %r6, 7 # encoding: [0xb2,0xe8,0x70,0x46]
+#CHECK: ppa %r15, %r0, 0 # encoding: [0xb2,0xe8,0x00,0xf0]
+
+ ppa %r0, %r0, 0
+ ppa %r0, %r0, 15
+ ppa %r0, %r15, 0
+ ppa %r4, %r6, 7
+ ppa %r15, %r0, 0
+
#CHECK: risbgn %r0, %r0, 0, 0, 0 # encoding: [0xec,0x00,0x00,0x00,0x00,0x59]
#CHECK: risbgn %r0, %r0, 0, 0, 63 # encoding: [0xec,0x00,0x00,0x00,0x3f,0x59]
#CHECK: risbgn %r0, %r0, 0, 255, 0 # encoding: [0xec,0x00,0x00,0xff,0x00,0x59]
@@ -17,3 +59,68 @@
risbgn %r15,%r0,0,0,0
risbgn %r4,%r5,6,7,8
+#CHECK: tabort 0 # encoding: [0xb2,0xfc,0x00,0x00]
+#CHECK: tabort 0(%r1) # encoding: [0xb2,0xfc,0x10,0x00]
+#CHECK: tabort 0(%r15) # encoding: [0xb2,0xfc,0xf0,0x00]
+#CHECK: tabort 4095 # encoding: [0xb2,0xfc,0x0f,0xff]
+#CHECK: tabort 4095(%r1) # encoding: [0xb2,0xfc,0x1f,0xff]
+#CHECK: tabort 4095(%r15) # encoding: [0xb2,0xfc,0xff,0xff]
+
+ tabort 0
+ tabort 0(%r1)
+ tabort 0(%r15)
+ tabort 4095
+ tabort 4095(%r1)
+ tabort 4095(%r15)
+
+#CHECK: tbegin 0, 0 # encoding: [0xe5,0x60,0x00,0x00,0x00,0x00]
+#CHECK: tbegin 4095, 0 # encoding: [0xe5,0x60,0x0f,0xff,0x00,0x00]
+#CHECK: tbegin 0, 0 # encoding: [0xe5,0x60,0x00,0x00,0x00,0x00]
+#CHECK: tbegin 0, 1 # encoding: [0xe5,0x60,0x00,0x00,0x00,0x01]
+#CHECK: tbegin 0, 32767 # encoding: [0xe5,0x60,0x00,0x00,0x7f,0xff]
+#CHECK: tbegin 0, 32768 # encoding: [0xe5,0x60,0x00,0x00,0x80,0x00]
+#CHECK: tbegin 0, 65535 # encoding: [0xe5,0x60,0x00,0x00,0xff,0xff]
+#CHECK: tbegin 0(%r1), 42 # encoding: [0xe5,0x60,0x10,0x00,0x00,0x2a]
+#CHECK: tbegin 0(%r15), 42 # encoding: [0xe5,0x60,0xf0,0x00,0x00,0x2a]
+#CHECK: tbegin 4095(%r1), 42 # encoding: [0xe5,0x60,0x1f,0xff,0x00,0x2a]
+#CHECK: tbegin 4095(%r15), 42 # encoding: [0xe5,0x60,0xff,0xff,0x00,0x2a]
+
+ tbegin 0, 0
+ tbegin 4095, 0
+ tbegin 0, 0
+ tbegin 0, 1
+ tbegin 0, 32767
+ tbegin 0, 32768
+ tbegin 0, 65535
+ tbegin 0(%r1), 42
+ tbegin 0(%r15), 42
+ tbegin 4095(%r1), 42
+ tbegin 4095(%r15), 42
+
+#CHECK: tbeginc 0, 0 # encoding: [0xe5,0x61,0x00,0x00,0x00,0x00]
+#CHECK: tbeginc 4095, 0 # encoding: [0xe5,0x61,0x0f,0xff,0x00,0x00]
+#CHECK: tbeginc 0, 0 # encoding: [0xe5,0x61,0x00,0x00,0x00,0x00]
+#CHECK: tbeginc 0, 1 # encoding: [0xe5,0x61,0x00,0x00,0x00,0x01]
+#CHECK: tbeginc 0, 32767 # encoding: [0xe5,0x61,0x00,0x00,0x7f,0xff]
+#CHECK: tbeginc 0, 32768 # encoding: [0xe5,0x61,0x00,0x00,0x80,0x00]
+#CHECK: tbeginc 0, 65535 # encoding: [0xe5,0x61,0x00,0x00,0xff,0xff]
+#CHECK: tbeginc 0(%r1), 42 # encoding: [0xe5,0x61,0x10,0x00,0x00,0x2a]
+#CHECK: tbeginc 0(%r15), 42 # encoding: [0xe5,0x61,0xf0,0x00,0x00,0x2a]
+#CHECK: tbeginc 4095(%r1), 42 # encoding: [0xe5,0x61,0x1f,0xff,0x00,0x2a]
+#CHECK: tbeginc 4095(%r15), 42 # encoding: [0xe5,0x61,0xff,0xff,0x00,0x2a]
+
+ tbeginc 0, 0
+ tbeginc 4095, 0
+ tbeginc 0, 0
+ tbeginc 0, 1
+ tbeginc 0, 32767
+ tbeginc 0, 32768
+ tbeginc 0, 65535
+ tbeginc 0(%r1), 42
+ tbeginc 0(%r15), 42
+ tbeginc 4095(%r1), 42
+ tbeginc 4095(%r15), 42
+
+#CHECK: tend # encoding: [0xb2,0xf8,0x00,0x00]
+
+ tend
Index: llvm-head/test/MC/SystemZ/insn-bad-z196.s
===================================================================
--- llvm-head.orig/test/MC/SystemZ/insn-bad-z196.s
+++ llvm-head/test/MC/SystemZ/insn-bad-z196.s
@@ -244,6 +244,11 @@
cxlgbr %f0, 16, %r0, 0
cxlgbr %f2, 0, %r0, 0
+#CHECK: error: {{(instruction requires: transactional-execution)?}}
+#CHECK: etnd %r7
+
+ etnd %r7
+
#CHECK: error: invalid operand
#CHECK: fidbra %f0, 0, %f0, -1
#CHECK: error: invalid operand
@@ -546,6 +551,16 @@
locr %r0,%r0,-1
locr %r0,%r0,16
+#CHECK: error: {{(instruction requires: transactional-execution)?}}
+#CHECK: ntstg %r0, 524287(%r1,%r15)
+
+ ntstg %r0, 524287(%r1,%r15)
+
+#CHECK: error: {{(instruction requires: processor-assist)?}}
+#CHECK: ppa %r4, %r6, 7
+
+ ppa %r4, %r6, 7
+
#CHECK: error: {{(instruction requires: miscellaneous-extensions)?}}
#CHECK: risbgn %r1, %r2, 0, 0, 0
@@ -690,3 +705,24 @@
stocg %r0,-524289,1
stocg %r0,524288,1
stocg %r0,0(%r1,%r2),1
+
+#CHECK: error: {{(instruction requires: transactional-execution)?}}
+#CHECK: tabort 4095(%r1)
+
+ tabort 4095(%r1)
+
+#CHECK: error: {{(instruction requires: transactional-execution)?}}
+#CHECK: tbegin 4095(%r1), 42
+
+ tbegin 4095(%r1), 42
+
+#CHECK: error: {{(instruction requires: transactional-execution)?}}
+#CHECK: tbeginc 4095(%r1), 42
+
+ tbeginc 4095(%r1), 42
+
+#CHECK: error: {{(instruction requires: transactional-execution)?}}
+#CHECK: tend
+
+ tend
+
Index: llvm-head/test/MC/Disassembler/SystemZ/insns.txt
===================================================================
--- llvm-head.orig/test/MC/Disassembler/SystemZ/insns.txt
+++ llvm-head/test/MC/Disassembler/SystemZ/insns.txt
@@ -2503,6 +2503,15 @@
# CHECK: ear %r15, %a15
0xb2 0x4f 0x00 0xff
+# CHECK: etnd %r0
+0xb2 0xec 0x00 0x00
+
+# CHECK: etnd %r15
+0xb2 0xec 0x00 0xf0
+
+# CHECK: etnd %r7
+0xb2 0xec 0x00 0x70
+
# CHECK: fidbr %f0, 0, %f0
0xb3 0x5f 0x00 0x00
@@ -6034,6 +6043,36 @@
# CHECK: ny %r15, 0
0xe3 0xf0 0x00 0x00 0x00 0x54
+# CHECK: ntstg %r0, -524288
+0xe3 0x00 0x00 0x00 0x80 0x25
+
+# CHECK: ntstg %r0, -1
+0xe3 0x00 0x0f 0xff 0xff 0x25
+
+# CHECK: ntstg %r0, 0
+0xe3 0x00 0x00 0x00 0x00 0x25
+
+# CHECK: ntstg %r0, 1
+0xe3 0x00 0x00 0x01 0x00 0x25
+
+# CHECK: ntstg %r0, 524287
+0xe3 0x00 0x0f 0xff 0x7f 0x25
+
+# CHECK: ntstg %r0, 0(%r1)
+0xe3 0x00 0x10 0x00 0x00 0x25
+
+# CHECK: ntstg %r0, 0(%r15)
+0xe3 0x00 0xf0 0x00 0x00 0x25
+
+# CHECK: ntstg %r0, 524287(%r1,%r15)
+0xe3 0x01 0xff 0xff 0x7f 0x25
+
+# CHECK: ntstg %r0, 524287(%r15,%r1)
+0xe3 0x0f 0x1f 0xff 0x7f 0x25
+
+# CHECK: ntstg %r15, 0
+0xe3 0xf0 0x00 0x00 0x00 0x25
+
# CHECK: oc 0(1), 0
0xd6 0x00 0x00 0x00 0x00 0x00
@@ -6346,6 +6385,21 @@
# CHECK: popcnt %r7, %r8
0xb9 0xe1 0x00 0x78
+# CHECK: ppa %r0, %r0, 0
+0xb2 0xe8 0x00 0x00
+
+# CHECK: ppa %r0, %r0, 15
+0xb2 0xe8 0xf0 0x00
+
+# CHECK: ppa %r0, %r15, 0
+0xb2 0xe8 0x00 0x0f
+
+# CHECK: ppa %r4, %r6, 7
+0xb2 0xe8 0x70 0x46
+
+# CHECK: ppa %r15, %r0, 0
+0xb2 0xe8 0x00 0xf0
+
# CHECK: risbg %r0, %r0, 0, 0, 0
0xec 0x00 0x00 0x00 0x00 0x55
@@ -8062,6 +8116,93 @@
# CHECK: sy %r15, 0
0xe3 0xf0 0x00 0x00 0x00 0x5b
+# CHECK: tabort 0
+0xb2 0xfc 0x00 0x00
+
+# CHECK: tabort 0(%r1)
+0xb2 0xfc 0x10 0x00
+
+# CHECK: tabort 0(%r15)
+0xb2 0xfc 0xf0 0x00
+
+# CHECK: tabort 4095
+0xb2 0xfc 0x0f 0xff
+
+# CHECK: tabort 4095(%r1)
+0xb2 0xfc 0x1f 0xff
+
+# CHECK: tabort 4095(%r15)
+0xb2 0xfc 0xff 0xff
+
+# CHECK: tbegin 0, 0
+0xe5 0x60 0x00 0x00 0x00 0x00
+
+# CHECK: tbegin 4095, 0
+0xe5 0x60 0x0f 0xff 0x00 0x00
+
+# CHECK: tbegin 0, 0
+0xe5 0x60 0x00 0x00 0x00 0x00
+
+# CHECK: tbegin 0, 1
+0xe5 0x60 0x00 0x00 0x00 0x01
+
+# CHECK: tbegin 0, 32767
+0xe5 0x60 0x00 0x00 0x7f 0xff
+
+# CHECK: tbegin 0, 32768
+0xe5 0x60 0x00 0x00 0x80 0x00
+
+# CHECK: tbegin 0, 65535
+0xe5 0x60 0x00 0x00 0xff 0xff
+
+# CHECK: tbegin 0(%r1), 42
+0xe5 0x60 0x10 0x00 0x00 0x2a
+
+# CHECK: tbegin 0(%r15), 42
+0xe5 0x60 0xf0 0x00 0x00 0x2a
+
+# CHECK: tbegin 4095(%r1), 42
+0xe5 0x60 0x1f 0xff 0x00 0x2a
+
+# CHECK: tbegin 4095(%r15), 42
+0xe5 0x60 0xff 0xff 0x00 0x2a
+
+# CHECK: tbeginc 0, 0
+0xe5 0x61 0x00 0x00 0x00 0x00
+
+# CHECK: tbeginc 4095, 0
+0xe5 0x61 0x0f 0xff 0x00 0x00
+
+# CHECK: tbeginc 0, 0
+0xe5 0x61 0x00 0x00 0x00 0x00
+
+# CHECK: tbeginc 0, 1
+0xe5 0x61 0x00 0x00 0x00 0x01
+
+# CHECK: tbeginc 0, 32767
+0xe5 0x61 0x00 0x00 0x7f 0xff
+
+# CHECK: tbeginc 0, 32768
+0xe5 0x61 0x00 0x00 0x80 0x00
+
+# CHECK: tbeginc 0, 65535
+0xe5 0x61 0x00 0x00 0xff 0xff
+
+# CHECK: tbeginc 0(%r1), 42
+0xe5 0x61 0x10 0x00 0x00 0x2a
+
+# CHECK: tbeginc 0(%r15), 42
+0xe5 0x61 0xf0 0x00 0x00 0x2a
+
+# CHECK: tbeginc 4095(%r1), 42
+0xe5 0x61 0x1f 0xff 0x00 0x2a
+
+# CHECK: tbeginc 4095(%r15), 42
+0xe5 0x61 0xff 0xff 0x00 0x2a
+
+# CHECK: tend
+0xb2 0xf8 0x00 0x00
+
# CHECK: tm 0, 0
0x91 0x00 0x00 0x00
llvm-svn: 233803
2015-04-01 14:51:43 +02:00
|
|
|
include "llvm/IR/IntrinsicsSystemZ.td"
|
2015-07-09 22:57:38 +02:00
|
|
|
include "llvm/IR/IntrinsicsWebAssembly.td"
|