forked from OSchip/llvm-project
[SystemZ] Add support for IBM z14 processor (1/3)
This patch series adds support for the IBM z14 processor. This part includes: - Basic support for the new processor and its features. - Support for low-level builtins mapped to new LLVM intrinsics. Support for the -fzvector extension to vector float and the new high-level vector intrinsics is provided by separate patches. llvm-svn: 308197
This commit is contained in:
parent
f2968d58cb
commit
cac24ab04c
|
@ -253,5 +253,29 @@ TARGET_BUILTIN(__builtin_s390_vfmsdb, "V2dV2dV2dV2d", "nc", "vector")
|
|||
TARGET_BUILTIN(__builtin_s390_vfsqdb, "V2dV2d", "nc", "vector")
|
||||
TARGET_BUILTIN(__builtin_s390_vftcidb, "V2SLLiV2dIii*", "nc", "vector")
|
||||
|
||||
// Vector-enhancements facility 1 intrinsics.
|
||||
TARGET_BUILTIN(__builtin_s390_vlrl, "V16ScUivC*", "", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vstrl, "vV16ScUiv*", "", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vbperm, "V2ULLiV16UcV16Uc", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vmslg, "V16UcV2ULLiV2ULLiV16UcIi", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfmaxdb, "V2dV2dV2dIi", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfmindb, "V2dV2dV2dIi", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfnmadb, "V2dV2dV2dV2d", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfnmsdb, "V2dV2dV2dV2d", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfcesbs, "V4SiV4fV4fi*", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfchsbs, "V4SiV4fV4fi*", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfchesbs, "V4SiV4fV4fi*", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfisb, "V4fV4fIiIi", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfmaxsb, "V4fV4fV4fIi", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfminsb, "V4fV4fV4fIi", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vflnsb, "V4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vflpsb, "V4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfmasb, "V4fV4fV4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfmssb, "V4fV4fV4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfnmasb, "V4fV4fV4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfnmssb, "V4fV4fV4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vfsqsb, "V4fV4f", "nc", "vector-enhancements-1")
|
||||
TARGET_BUILTIN(__builtin_s390_vftcisb, "V4SiV4fIii*", "nc", "vector-enhancements-1")
|
||||
|
||||
#undef BUILTIN
|
||||
#undef TARGET_BUILTIN
|
||||
|
|
|
@ -7503,6 +7503,7 @@ public:
|
|||
.Cases("arch9", "z196", 9)
|
||||
.Cases("arch10", "zEC12", 10)
|
||||
.Cases("arch11", "z13", 11)
|
||||
.Cases("arch12", "z14", 12)
|
||||
.Default(-1);
|
||||
}
|
||||
bool setCPU(const std::string &Name) override {
|
||||
|
@ -7519,6 +7520,8 @@ public:
|
|||
Features["transactional-execution"] = true;
|
||||
if (ISARevision >= 11)
|
||||
Features["vector"] = true;
|
||||
if (ISARevision >= 12)
|
||||
Features["vector-enhancements-1"] = true;
|
||||
return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
|
||||
}
|
||||
|
||||
|
@ -7548,6 +7551,7 @@ public:
|
|||
.Case("arch9", ISARevision >= 9)
|
||||
.Case("arch10", ISARevision >= 10)
|
||||
.Case("arch11", ISARevision >= 11)
|
||||
.Case("arch12", ISARevision >= 12)
|
||||
.Case("htm", HasTransactionalExecution)
|
||||
.Case("vx", HasVector)
|
||||
.Default(false);
|
||||
|
|
|
@ -8790,12 +8790,14 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
return Builder.CreateCall(F, {X, Undef});
|
||||
}
|
||||
|
||||
case SystemZ::BI__builtin_s390_vfsqsb:
|
||||
case SystemZ::BI__builtin_s390_vfsqdb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::sqrt, ResultType);
|
||||
return Builder.CreateCall(F, X);
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfmasb:
|
||||
case SystemZ::BI__builtin_s390_vfmadb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
|
@ -8804,6 +8806,7 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType);
|
||||
return Builder.CreateCall(F, {X, Y, Z});
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfmssb:
|
||||
case SystemZ::BI__builtin_s390_vfmsdb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
|
@ -8813,12 +8816,35 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType);
|
||||
return Builder.CreateCall(F, {X, Y, Builder.CreateFSub(Zero, Z, "sub")});
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfnmasb:
|
||||
case SystemZ::BI__builtin_s390_vfnmadb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
Value *Y = EmitScalarExpr(E->getArg(1));
|
||||
Value *Z = EmitScalarExpr(E->getArg(2));
|
||||
Value *Zero = llvm::ConstantFP::getZeroValueForNegation(ResultType);
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType);
|
||||
return Builder.CreateFSub(Zero, Builder.CreateCall(F, {X, Y, Z}), "sub");
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfnmssb:
|
||||
case SystemZ::BI__builtin_s390_vfnmsdb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
Value *Y = EmitScalarExpr(E->getArg(1));
|
||||
Value *Z = EmitScalarExpr(E->getArg(2));
|
||||
Value *Zero = llvm::ConstantFP::getZeroValueForNegation(ResultType);
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType);
|
||||
Value *NegZ = Builder.CreateFSub(Zero, Z, "sub");
|
||||
return Builder.CreateFSub(Zero, Builder.CreateCall(F, {X, Y, NegZ}));
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vflpsb:
|
||||
case SystemZ::BI__builtin_s390_vflpdb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::fabs, ResultType);
|
||||
return Builder.CreateCall(F, X);
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vflnsb:
|
||||
case SystemZ::BI__builtin_s390_vflndb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
|
@ -8826,6 +8852,7 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
Function *F = CGM.getIntrinsic(Intrinsic::fabs, ResultType);
|
||||
return Builder.CreateFSub(Zero, Builder.CreateCall(F, X), "sub");
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfisb:
|
||||
case SystemZ::BI__builtin_s390_vfidb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
|
@ -8835,8 +8862,8 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
bool IsConstM5 = E->getArg(2)->isIntegerConstantExpr(M5, getContext());
|
||||
assert(IsConstM4 && IsConstM5 && "Constant arg isn't actually constant?");
|
||||
(void)IsConstM4; (void)IsConstM5;
|
||||
// Check whether this instance of vfidb can be represented via a LLVM
|
||||
// standard intrinsic. We only support some combinations of M4 and M5.
|
||||
// Check whether this instance can be represented via a LLVM standard
|
||||
// intrinsic. We only support some combinations of M4 and M5.
|
||||
Intrinsic::ID ID = Intrinsic::not_intrinsic;
|
||||
switch (M4.getZExtValue()) {
|
||||
default: break;
|
||||
|
@ -8861,11 +8888,76 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
Function *F = CGM.getIntrinsic(ID, ResultType);
|
||||
return Builder.CreateCall(F, X);
|
||||
}
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::s390_vfidb);
|
||||
switch (BuiltinID) {
|
||||
case SystemZ::BI__builtin_s390_vfisb: ID = Intrinsic::s390_vfisb; break;
|
||||
case SystemZ::BI__builtin_s390_vfidb: ID = Intrinsic::s390_vfidb; break;
|
||||
default: llvm_unreachable("Unknown BuiltinID");
|
||||
}
|
||||
Function *F = CGM.getIntrinsic(ID);
|
||||
Value *M4Value = llvm::ConstantInt::get(getLLVMContext(), M4);
|
||||
Value *M5Value = llvm::ConstantInt::get(getLLVMContext(), M5);
|
||||
return Builder.CreateCall(F, {X, M4Value, M5Value});
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfmaxsb:
|
||||
case SystemZ::BI__builtin_s390_vfmaxdb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
Value *Y = EmitScalarExpr(E->getArg(1));
|
||||
// Constant-fold the M4 mask argument.
|
||||
llvm::APSInt M4;
|
||||
bool IsConstM4 = E->getArg(2)->isIntegerConstantExpr(M4, getContext());
|
||||
assert(IsConstM4 && "Constant arg isn't actually constant?");
|
||||
(void)IsConstM4;
|
||||
// Check whether this instance can be represented via a LLVM standard
|
||||
// intrinsic. We only support some values of M4.
|
||||
Intrinsic::ID ID = Intrinsic::not_intrinsic;
|
||||
switch (M4.getZExtValue()) {
|
||||
default: break;
|
||||
case 4: ID = Intrinsic::maxnum; break;
|
||||
}
|
||||
if (ID != Intrinsic::not_intrinsic) {
|
||||
Function *F = CGM.getIntrinsic(ID, ResultType);
|
||||
return Builder.CreateCall(F, {X, Y});
|
||||
}
|
||||
switch (BuiltinID) {
|
||||
case SystemZ::BI__builtin_s390_vfmaxsb: ID = Intrinsic::s390_vfmaxsb; break;
|
||||
case SystemZ::BI__builtin_s390_vfmaxdb: ID = Intrinsic::s390_vfmaxdb; break;
|
||||
default: llvm_unreachable("Unknown BuiltinID");
|
||||
}
|
||||
Function *F = CGM.getIntrinsic(ID);
|
||||
Value *M4Value = llvm::ConstantInt::get(getLLVMContext(), M4);
|
||||
return Builder.CreateCall(F, {X, Y, M4Value});
|
||||
}
|
||||
case SystemZ::BI__builtin_s390_vfminsb:
|
||||
case SystemZ::BI__builtin_s390_vfmindb: {
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *X = EmitScalarExpr(E->getArg(0));
|
||||
Value *Y = EmitScalarExpr(E->getArg(1));
|
||||
// Constant-fold the M4 mask argument.
|
||||
llvm::APSInt M4;
|
||||
bool IsConstM4 = E->getArg(2)->isIntegerConstantExpr(M4, getContext());
|
||||
assert(IsConstM4 && "Constant arg isn't actually constant?");
|
||||
(void)IsConstM4;
|
||||
// Check whether this instance can be represented via a LLVM standard
|
||||
// intrinsic. We only support some values of M4.
|
||||
Intrinsic::ID ID = Intrinsic::not_intrinsic;
|
||||
switch (M4.getZExtValue()) {
|
||||
default: break;
|
||||
case 4: ID = Intrinsic::minnum; break;
|
||||
}
|
||||
if (ID != Intrinsic::not_intrinsic) {
|
||||
Function *F = CGM.getIntrinsic(ID, ResultType);
|
||||
return Builder.CreateCall(F, {X, Y});
|
||||
}
|
||||
switch (BuiltinID) {
|
||||
case SystemZ::BI__builtin_s390_vfminsb: ID = Intrinsic::s390_vfminsb; break;
|
||||
case SystemZ::BI__builtin_s390_vfmindb: ID = Intrinsic::s390_vfmindb; break;
|
||||
default: llvm_unreachable("Unknown BuiltinID");
|
||||
}
|
||||
Function *F = CGM.getIntrinsic(ID);
|
||||
Value *M4Value = llvm::ConstantInt::get(getLLVMContext(), M4);
|
||||
return Builder.CreateCall(F, {X, Y, M4Value});
|
||||
}
|
||||
|
||||
// Vector intrisincs that output the post-instruction CC value.
|
||||
|
||||
|
@ -8932,10 +9024,14 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
|
|||
INTRINSIC_WITH_CC(s390_vstrczhs);
|
||||
INTRINSIC_WITH_CC(s390_vstrczfs);
|
||||
|
||||
INTRINSIC_WITH_CC(s390_vfcesbs);
|
||||
INTRINSIC_WITH_CC(s390_vfcedbs);
|
||||
INTRINSIC_WITH_CC(s390_vfchsbs);
|
||||
INTRINSIC_WITH_CC(s390_vfchdbs);
|
||||
INTRINSIC_WITH_CC(s390_vfchesbs);
|
||||
INTRINSIC_WITH_CC(s390_vfchedbs);
|
||||
|
||||
INTRINSIC_WITH_CC(s390_vftcisb);
|
||||
INTRINSIC_WITH_CC(s390_vftcidb);
|
||||
|
||||
#undef INTRINSIC_WITH_CC
|
||||
|
|
|
@ -1739,9 +1739,11 @@ bool Sema::CheckSystemZBuiltinFunctionCall(unsigned BuiltinID,
|
|||
case SystemZ::BI__builtin_s390_vfaezbs:
|
||||
case SystemZ::BI__builtin_s390_vfaezhs:
|
||||
case SystemZ::BI__builtin_s390_vfaezfs: i = 2; l = 0; u = 15; break;
|
||||
case SystemZ::BI__builtin_s390_vfisb:
|
||||
case SystemZ::BI__builtin_s390_vfidb:
|
||||
return SemaBuiltinConstantArgRange(TheCall, 1, 0, 15) ||
|
||||
SemaBuiltinConstantArgRange(TheCall, 2, 0, 15);
|
||||
case SystemZ::BI__builtin_s390_vftcisb:
|
||||
case SystemZ::BI__builtin_s390_vftcidb: i = 1; l = 0; u = 4095; break;
|
||||
case SystemZ::BI__builtin_s390_vlbb: i = 1; l = 0; u = 15; break;
|
||||
case SystemZ::BI__builtin_s390_vpdi: i = 2; l = 0; u = 15; break;
|
||||
|
@ -1758,6 +1760,11 @@ bool Sema::CheckSystemZBuiltinFunctionCall(unsigned BuiltinID,
|
|||
case SystemZ::BI__builtin_s390_vstrczbs:
|
||||
case SystemZ::BI__builtin_s390_vstrczhs:
|
||||
case SystemZ::BI__builtin_s390_vstrczfs: i = 3; l = 0; u = 15; break;
|
||||
case SystemZ::BI__builtin_s390_vmslg: i = 3; l = 0; u = 15; break;
|
||||
case SystemZ::BI__builtin_s390_vfminsb:
|
||||
case SystemZ::BI__builtin_s390_vfmaxsb:
|
||||
case SystemZ::BI__builtin_s390_vfmindb:
|
||||
case SystemZ::BI__builtin_s390_vfmaxdb: i = 2; l = 0; u = 15; break;
|
||||
}
|
||||
return SemaBuiltinConstantArgRange(TheCall, i, l, u);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
// REQUIRES: systemz-registered-target
|
||||
// RUN: %clang_cc1 -target-cpu z14 -triple s390x-unknown-unknown \
|
||||
// RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
|
||||
|
||||
typedef __attribute__((vector_size(16))) signed char vec_schar;
|
||||
typedef __attribute__((vector_size(16))) signed short vec_sshort;
|
||||
typedef __attribute__((vector_size(16))) signed int vec_sint;
|
||||
typedef __attribute__((vector_size(16))) signed long long vec_slong;
|
||||
typedef __attribute__((vector_size(16))) unsigned char vec_uchar;
|
||||
typedef __attribute__((vector_size(16))) unsigned short vec_ushort;
|
||||
typedef __attribute__((vector_size(16))) unsigned int vec_uint;
|
||||
typedef __attribute__((vector_size(16))) unsigned long long vec_ulong;
|
||||
typedef __attribute__((vector_size(16))) double vec_double;
|
||||
typedef __attribute__((vector_size(16))) float vec_float;
|
||||
|
||||
volatile vec_schar vsc;
|
||||
volatile vec_sshort vss;
|
||||
volatile vec_sint vsi;
|
||||
volatile vec_slong vsl;
|
||||
volatile vec_uchar vuc;
|
||||
volatile vec_ushort vus;
|
||||
volatile vec_uint vui;
|
||||
volatile vec_ulong vul;
|
||||
volatile vec_double vd;
|
||||
volatile vec_float vf;
|
||||
|
||||
volatile unsigned int len;
|
||||
int cc;
|
||||
|
||||
void test_integer(void) {
|
||||
__builtin_s390_vmslg(vul, vul, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vmslg(vul, vul, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vmslg(vul, vul, vuc, len); // expected-error {{must be a constant integer}}
|
||||
}
|
||||
|
||||
void test_float(void) {
|
||||
__builtin_s390_vfmaxdb(vd, vd, -1); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfmaxdb(vd, vd, 16); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfmaxdb(vd, vd, len); // expected-error {{must be a constant integer}}
|
||||
__builtin_s390_vfmindb(vd, vd, -1); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfmindb(vd, vd, 16); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfmindb(vd, vd, len); // expected-error {{must be a constant integer}}
|
||||
|
||||
__builtin_s390_vftcisb(vf, -1, &cc); // expected-error {{argument should be a value from 0 to 4095}}
|
||||
__builtin_s390_vftcisb(vf, 4096, &cc); // expected-error {{argument should be a value from 0 to 4095}}
|
||||
__builtin_s390_vftcisb(vf, len, &cc); // expected-error {{must be a constant integer}}
|
||||
|
||||
__builtin_s390_vfisb(vf, -1, 0); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfisb(vf, 16, 0); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfisb(vf, len, 0); // expected-error {{must be a constant integer}}
|
||||
__builtin_s390_vfisb(vf, 0, -1); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfisb(vf, 0, 16); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfisb(vf, 0, len); // expected-error {{must be a constant integer}}
|
||||
|
||||
__builtin_s390_vfmaxsb(vf, vf, -1); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfmaxsb(vf, vf, 16); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfmaxsb(vf, vf, len); // expected-error {{must be a constant integer}}
|
||||
__builtin_s390_vfminsb(vf, vf, -1); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfminsb(vf, vf, 16); // expected-error {{argument should be a value from 0 to 15}}
|
||||
__builtin_s390_vfminsb(vf, vf, len); // expected-error {{must be a constant integer}}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
// REQUIRES: systemz-registered-target
|
||||
// RUN: %clang_cc1 -target-cpu z14 -triple s390x-ibm-linux -fno-lax-vector-conversions \
|
||||
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
typedef __attribute__((vector_size(16))) signed char vec_schar;
|
||||
typedef __attribute__((vector_size(16))) signed short vec_sshort;
|
||||
typedef __attribute__((vector_size(16))) signed int vec_sint;
|
||||
typedef __attribute__((vector_size(16))) signed long long vec_slong;
|
||||
typedef __attribute__((vector_size(16))) unsigned char vec_uchar;
|
||||
typedef __attribute__((vector_size(16))) unsigned short vec_ushort;
|
||||
typedef __attribute__((vector_size(16))) unsigned int vec_uint;
|
||||
typedef __attribute__((vector_size(16))) unsigned long long vec_ulong;
|
||||
typedef __attribute__((vector_size(16))) double vec_double;
|
||||
typedef __attribute__((vector_size(16))) float vec_float;
|
||||
|
||||
volatile vec_schar vsc;
|
||||
volatile vec_sshort vss;
|
||||
volatile vec_sint vsi;
|
||||
volatile vec_slong vsl;
|
||||
volatile vec_uchar vuc;
|
||||
volatile vec_ushort vus;
|
||||
volatile vec_uint vui;
|
||||
volatile vec_ulong vul;
|
||||
volatile vec_double vd;
|
||||
volatile vec_float vf;
|
||||
|
||||
volatile unsigned int len;
|
||||
const void * volatile cptr;
|
||||
void * volatile ptr;
|
||||
int cc;
|
||||
|
||||
void test_core(void) {
|
||||
vul = __builtin_s390_vbperm(vuc, vuc);
|
||||
// CHECK: call <2 x i64> @llvm.s390.vbperm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
|
||||
|
||||
vsc = __builtin_s390_vlrl(len, cptr);
|
||||
// CHECK: call <16 x i8> @llvm.s390.vlrl(i32 %{{.*}}, i8* %{{.*}})
|
||||
|
||||
__builtin_s390_vstrl(vsc, len, ptr);
|
||||
// CHECK: call void @llvm.s390.vstrl(<16 x i8> %{{.*}}, i32 %{{.*}}, i8* %{{.*}})
|
||||
}
|
||||
|
||||
void test_integer(void) {
|
||||
vuc = __builtin_s390_vmslg(vul, vul, vuc, 0);
|
||||
// CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 0)
|
||||
vuc = __builtin_s390_vmslg(vul, vul, vuc, 15);
|
||||
// CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 15)
|
||||
}
|
||||
|
||||
void test_float(void) {
|
||||
vd = __builtin_s390_vfmaxdb(vd, vd, 4);
|
||||
// CHECK: call <2 x double> @llvm.maxnum.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}})
|
||||
vd = __builtin_s390_vfmaxdb(vd, vd, 0);
|
||||
// CHECK: call <2 x double> @llvm.s390.vfmaxdb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0)
|
||||
vd = __builtin_s390_vfmaxdb(vd, vd, 15);
|
||||
// CHECK: call <2 x double> @llvm.s390.vfmaxdb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 15)
|
||||
|
||||
vd = __builtin_s390_vfmindb(vd, vd, 4);
|
||||
// CHECK: call <2 x double> @llvm.minnum.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}})
|
||||
vd = __builtin_s390_vfmindb(vd, vd, 0);
|
||||
// CHECK: call <2 x double> @llvm.s390.vfmindb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0)
|
||||
vd = __builtin_s390_vfmindb(vd, vd, 15);
|
||||
// CHECK: call <2 x double> @llvm.s390.vfmindb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 15)
|
||||
|
||||
vd = __builtin_s390_vfnmadb(vd, vd, vd);
|
||||
// CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
|
||||
// CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]]
|
||||
vd = __builtin_s390_vfnmsdb(vd, vd, vd);
|
||||
// CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}}
|
||||
// CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]])
|
||||
// CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]]
|
||||
|
||||
vsi = __builtin_s390_vfcesbs(vf, vf, &cc);
|
||||
// CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
vsi = __builtin_s390_vfchsbs(vf, vf, &cc);
|
||||
// CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
vsi = __builtin_s390_vfchesbs(vf, vf, &cc);
|
||||
// CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
|
||||
vsi = __builtin_s390_vftcisb(vf, 0, &cc);
|
||||
// CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 0)
|
||||
vsi = __builtin_s390_vftcisb(vf, 4095, &cc);
|
||||
// CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 4095)
|
||||
|
||||
vf = __builtin_s390_vfmaxsb(vf, vf, 4);
|
||||
// CHECK: call <4 x float> @llvm.maxnum.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfmaxsb(vf, vf, 0);
|
||||
// CHECK: call <4 x float> @llvm.s390.vfmaxsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0)
|
||||
vf = __builtin_s390_vfmaxsb(vf, vf, 15);
|
||||
// CHECK: call <4 x float> @llvm.s390.vfmaxsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 15)
|
||||
|
||||
vf = __builtin_s390_vfminsb(vf, vf, 4);
|
||||
// CHECK: call <4 x float> @llvm.minnum.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfminsb(vf, vf, 0);
|
||||
// CHECK: call <4 x float> @llvm.s390.vfminsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0)
|
||||
vf = __builtin_s390_vfminsb(vf, vf, 15);
|
||||
// CHECK: call <4 x float> @llvm.s390.vfminsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 15)
|
||||
|
||||
vf = __builtin_s390_vfsqsb(vf);
|
||||
// CHECK: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %{{.*}})
|
||||
|
||||
vf = __builtin_s390_vfmasb(vf, vf, vf);
|
||||
// CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfmssb(vf, vf, vf);
|
||||
// CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}}
|
||||
// CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]])
|
||||
vf = __builtin_s390_vfnmasb(vf, vf, vf);
|
||||
// CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
|
||||
// CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]]
|
||||
vf = __builtin_s390_vfnmssb(vf, vf, vf);
|
||||
// CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}}
|
||||
// CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]])
|
||||
// CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]]
|
||||
|
||||
vf = __builtin_s390_vflpsb(vf);
|
||||
// CHECK: call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vflnsb(vf);
|
||||
// CHECK: [[ABS:%[^ ]+]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}})
|
||||
// CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[ABS]]
|
||||
|
||||
vf = __builtin_s390_vfisb(vf, 0, 0);
|
||||
// CHECK: call <4 x float> @llvm.rint.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfisb(vf, 4, 0);
|
||||
// CHECK: call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfisb(vf, 4, 1);
|
||||
// CHECK: call <4 x float> @llvm.round.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfisb(vf, 4, 5);
|
||||
// CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfisb(vf, 4, 6);
|
||||
// CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfisb(vf, 4, 7);
|
||||
// CHECK: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{.*}})
|
||||
vf = __builtin_s390_vfisb(vf, 4, 4);
|
||||
// CHECK: call <4 x float> @llvm.s390.vfisb(<4 x float> %{{.*}}, i32 4, i32 4)
|
||||
}
|
||||
|
|
@ -6,6 +6,10 @@
|
|||
// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
|
||||
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \
|
||||
// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
|
||||
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 \
|
||||
// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
|
||||
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch12 \
|
||||
// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
|
||||
|
||||
// Vector types
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
// RUN: -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \
|
||||
// RUN: -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 \
|
||||
// RUN: -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch12 \
|
||||
// RUN: -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
// Scalar types
|
||||
|
||||
|
|
|
@ -171,6 +171,10 @@
|
|||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch11 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z14 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch12 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// SYSTEMZ-VECTOR: target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
|
||||
|
||||
// RUN: %clang_cc1 -triple msp430-unknown -o - -emit-llvm %s | \
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// RUN: %clang -target s390x -### -S -emit-llvm -march=arch10 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH10 %s
|
||||
// RUN: %clang -target s390x -### -S -emit-llvm -march=z13 %s 2>&1 | FileCheck --check-prefix=CHECK-Z13 %s
|
||||
// RUN: %clang -target s390x -### -S -emit-llvm -march=arch11 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH11 %s
|
||||
// RUN: %clang -target s390x -### -S -emit-llvm -march=z14 %s 2>&1 | FileCheck --check-prefix=CHECK-Z14 %s
|
||||
// RUN: %clang -target s390x -### -S -emit-llvm -march=arch12 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH12 %s
|
||||
|
||||
// CHECK-Z9: error: unknown target CPU 'z9'
|
||||
// CHECK-Z10: "-target-cpu" "z10"
|
||||
|
@ -19,5 +21,7 @@
|
|||
// CHECK-ARCH10: "-target-cpu" "arch10"
|
||||
// CHECK-Z13: "-target-cpu" "z13"
|
||||
// CHECK-ARCH11: "-target-cpu" "arch11"
|
||||
// CHECK-Z14: "-target-cpu" "z14"
|
||||
// CHECK-ARCH12: "-target-cpu" "arch12"
|
||||
|
||||
int x;
|
||||
|
|
|
@ -2237,6 +2237,25 @@
|
|||
// CHECK_SYSTEMZ_ARCH11: #define __s390x__ 1
|
||||
// CHECK_SYSTEMZ_ARCH11: #define __zarch__ 1
|
||||
//
|
||||
// RUN: %clang -march=arch12 -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target s390x-unknown-linux \
|
||||
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ARCH12
|
||||
// RUN: %clang -march=z14 -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target s390x-unknown-linux \
|
||||
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ARCH12
|
||||
//
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __ARCH__ 12
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __HTM__ 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __LONG_DOUBLE_128__ 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __VX__ 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __s390__ 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __s390x__ 1
|
||||
// CHECK_SYSTEMZ_ARCH12: #define __zarch__ 1
|
||||
//
|
||||
// RUN: %clang -mhtm -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target s390x-unknown-linux \
|
||||
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_HTM
|
||||
|
|
Loading…
Reference in New Issue