[clang,test] Convert text files from CRLF to LF

Skip files with intentional CRLF line endings.
This commit is contained in:
Fangrui Song 2024-05-03 10:23:53 -07:00
parent a56f0b51dd
commit f34a5205aa
57 changed files with 2974 additions and 2974 deletions

View File

@ -1,46 +1,46 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
template<typename K, typename V>
struct Pair {
K First;
V Second;
K getFirst() {
return this.First;
}
V getSecond() {
return Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair<int, float> Vals = {1, 2.0};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// CHECK: -CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:8:3, line:10:3> line:8:5 getFirst 'K ()' implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:16, line:10:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:9:4, col:16>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'K' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:11> 'Pair<K, V>' lvalue this
// CHECK-NEXT:-CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:12:3, line:14:3> line:12:5 getSecond 'V ()' implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:17, line:14:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:13:5, col:12>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'V' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair<K, V>' lvalue implicit this
// CHECK: -CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:8:3, line:10:3> line:8:5 used getFirst 'int ()' implicit_instantiation implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:16, line:10:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:9:4, col:16>
// CHECK-NEXT:-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' <LValueToRValue>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:11> 'Pair<int, float>' lvalue this
// CHECK-NEXT:-CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:12:3, line:14:3> line:12:5 used getSecond 'float ()' implicit_instantiation implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:17, line:14:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:13:5, col:12>
// CHECK-NEXT:-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'float' <LValueToRValue>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'float' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair<int, float>' lvalue implicit this
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
template<typename K, typename V>
struct Pair {
K First;
V Second;
K getFirst() {
return this.First;
}
V getSecond() {
return Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair<int, float> Vals = {1, 2.0};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// CHECK: -CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:8:3, line:10:3> line:8:5 getFirst 'K ()' implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:16, line:10:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:9:4, col:16>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'K' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:11> 'Pair<K, V>' lvalue this
// CHECK-NEXT:-CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:12:3, line:14:3> line:12:5 getSecond 'V ()' implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:17, line:14:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:13:5, col:12>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'V' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair<K, V>' lvalue implicit this
// CHECK: -CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:8:3, line:10:3> line:8:5 used getFirst 'int ()' implicit_instantiation implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:16, line:10:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:9:4, col:16>
// CHECK-NEXT:-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' <LValueToRValue>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:11> 'Pair<int, float>' lvalue this
// CHECK-NEXT:-CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:12:3, line:14:3> line:12:5 used getSecond 'float ()' implicit_instantiation implicit-inline
// CHECK-NEXT:-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:17, line:14:3>
// CHECK-NEXT:-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:13:5, col:12>
// CHECK-NEXT:-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'float' <LValueToRValue>
// CHECK-NEXT:-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'float' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair<int, float>' lvalue implicit this

View File

@ -1,62 +1,62 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
class Pair {
int First;
int Second;
int getFirst() {
return this.First;
}
int getSecond() {
return Second;
}
};
class PairInfo : Pair {
int Sum;
int getSum() {
return this.First + Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
PairInfo ValsInfo;
ValsInfo.First = Vals.First;
ValsInfo.Second = Vals.Second;
ValsInfo.Sum = ValsInfo.getSum();
}
// CHECK: -CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:7:3, line:9:3> line:7:7 used getFirst 'int ()' implicit-inline
// CHECK-NEXT:`-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:18, line:9:3>
// CHECK-NEXT:`-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:8:4, col:16>
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:11> 'Pair' lvalue this
// CHECK-NEXT:-CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:11:3, line:13:3> line:11:7 used getSecond 'int ()' implicit-inline
// CHECK-NEXT:`-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:19, line:13:3>
// CHECK-NEXT:`-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:12:5, col:12>
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'int' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair' lvalue implicit this
// CHECK: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:19:3, line:21:3> line:19:7 used getSum 'int ()' implicit-inline
// CHECK-NEXT:`-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:16, line:21:3>
// CHECK-NEXT:`-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:20:5, col:25>
// CHECK-NEXT:`-BinaryOperator 0x{{[0-9A-Fa-f]+}} <col:12, col:25> 'int' '+'
// CHECK-NEXT:-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12, col:17> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12, col:17> 'int' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair' lvalue <UncheckedDerivedToBase (Pair)>
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'PairInfo' lvalue this
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'int' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'Pair' lvalue <UncheckedDerivedToBase (Pair)>
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'PairInfo' lvalue implicit this
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
class Pair {
int First;
int Second;
int getFirst() {
return this.First;
}
int getSecond() {
return Second;
}
};
class PairInfo : Pair {
int Sum;
int getSum() {
return this.First + Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
PairInfo ValsInfo;
ValsInfo.First = Vals.First;
ValsInfo.Second = Vals.Second;
ValsInfo.Sum = ValsInfo.getSum();
}
// CHECK: -CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:7:3, line:9:3> line:7:7 used getFirst 'int ()' implicit-inline
// CHECK-NEXT:`-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:18, line:9:3>
// CHECK-NEXT:`-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:8:4, col:16>
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:11, col:16> 'int' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:11> 'Pair' lvalue this
// CHECK-NEXT:-CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:11:3, line:13:3> line:11:7 used getSecond 'int ()' implicit-inline
// CHECK-NEXT:`-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:19, line:13:3>
// CHECK-NEXT:`-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:12:5, col:12>
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'int' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair' lvalue implicit this
// CHECK: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <line:19:3, line:21:3> line:19:7 used getSum 'int ()' implicit-inline
// CHECK-NEXT:`-CompoundStmt 0x{{[0-9A-Fa-f]+}} <col:16, line:21:3>
// CHECK-NEXT:`-ReturnStmt 0x{{[0-9A-Fa-f]+}} <line:20:5, col:25>
// CHECK-NEXT:`-BinaryOperator 0x{{[0-9A-Fa-f]+}} <col:12, col:25> 'int' '+'
// CHECK-NEXT:-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12, col:17> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:12, col:17> 'int' lvalue .First 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'Pair' lvalue <UncheckedDerivedToBase (Pair)>
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:12> 'PairInfo' lvalue this
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'int' <LValueToRValue>
// CHECK-NEXT:`-MemberExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'int' lvalue .Second 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT:`-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'Pair' lvalue <UncheckedDerivedToBase (Pair)>
// CHECK-NEXT:`-CXXThisExpr 0x{{[0-9A-Fa-f]+}} <col:25> 'PairInfo' lvalue implicit this

View File

@ -1,21 +1,21 @@
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -std=c++11 -ast-dump %s | FileCheck %s
// CHECK: CXXCtorInitializer Field {{.*}} 'ptr' 'void *'
// CHECK: CXXCtorInitializer Field {{.*}} 'q' 'Q'
@interface NSObject
@end
@interface I : NSObject
@end
struct Q { Q(); };
struct S {
S();
void *ptr = nullptr;
Q q;
};
@implementation I
S::S() {}
@end
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -std=c++11 -ast-dump %s | FileCheck %s
// CHECK: CXXCtorInitializer Field {{.*}} 'ptr' 'void *'
// CHECK: CXXCtorInitializer Field {{.*}} 'q' 'Q'
@interface NSObject
@end
@interface I : NSObject
@end
struct Q { Q(); };
struct S {
S();
void *ptr = nullptr;
Q q;
};
@implementation I
S::S() {}
@end

View File

@ -1,56 +1,56 @@
// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
// CHECK-LABEL: example0
void example0() {
double d = 2.0;
// CHECK: VarDecl{{.*}}rd 'double &'
// CHECK-NEXT: DeclRefExpr
double &rd = d;
// CHECK: VarDecl{{.*}}rcd 'const double &'
// CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' lvalue <NoOp>
const double &rcd = d;
}
struct A { };
struct B : A { } b;
// CHECK-LABEL: example1
void example1() {
// CHECK: VarDecl{{.*}}ra 'A &'
// CHECK: ImplicitCastExpr{{.*}}'A' lvalue <DerivedToBase (A)>
A &ra = b;
// CHECK: VarDecl{{.*}}rca 'const A &'
// CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)>
// CHECK-NOT: MaterializeTemporaryExpr
// CHECK: ImplicitCastExpr{{.*}}'const B' lvalue <NoOp>
const A& rca = b;
}
extern B f();
struct X {
operator B();
} x;
// CHECK-LABEL: example2
void example2() {
// CHECK: VarDecl{{.*}}rca 'const A &'
// CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)>
// CHECK: MaterializeTemporaryExpr{{.*}}'const B'
// CHECK: ImplicitCastExpr{{.*}}'const B' <NoOp>
// CHECK: CallExpr{{.*}}B
const A &rca = f();
// CHECK: VarDecl{{.*}}r 'const A &'
// CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)>
// CHECK: MaterializeTemporaryExpr{{.*}}'const B'
// CHECK: ImplicitCastExpr{{.*}}'const B' <NoOp>
// CHECK: CXXMemberCallExpr{{.*}}'B'
const A& r = x;
}
// CHECK-LABEL: example3
void example3() {
// CHECK: VarDecl{{.*}}rcd2 'const double &'
// CHECK: ImplicitCastExpr{{.*}} <IntegralToFloating>
const double& rcd2 = 2;
}
// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
// CHECK-LABEL: example0
void example0() {
double d = 2.0;
// CHECK: VarDecl{{.*}}rd 'double &'
// CHECK-NEXT: DeclRefExpr
double &rd = d;
// CHECK: VarDecl{{.*}}rcd 'const double &'
// CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' lvalue <NoOp>
const double &rcd = d;
}
struct A { };
struct B : A { } b;
// CHECK-LABEL: example1
void example1() {
// CHECK: VarDecl{{.*}}ra 'A &'
// CHECK: ImplicitCastExpr{{.*}}'A' lvalue <DerivedToBase (A)>
A &ra = b;
// CHECK: VarDecl{{.*}}rca 'const A &'
// CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)>
// CHECK-NOT: MaterializeTemporaryExpr
// CHECK: ImplicitCastExpr{{.*}}'const B' lvalue <NoOp>
const A& rca = b;
}
extern B f();
struct X {
operator B();
} x;
// CHECK-LABEL: example2
void example2() {
// CHECK: VarDecl{{.*}}rca 'const A &'
// CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)>
// CHECK: MaterializeTemporaryExpr{{.*}}'const B'
// CHECK: ImplicitCastExpr{{.*}}'const B' <NoOp>
// CHECK: CallExpr{{.*}}B
const A &rca = f();
// CHECK: VarDecl{{.*}}r 'const A &'
// CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)>
// CHECK: MaterializeTemporaryExpr{{.*}}'const B'
// CHECK: ImplicitCastExpr{{.*}}'const B' <NoOp>
// CHECK: CXXMemberCallExpr{{.*}}'B'
const A& r = x;
}
// CHECK-LABEL: example3
void example3() {
// CHECK: VarDecl{{.*}}rcd2 'const double &'
// CHECK: ImplicitCastExpr{{.*}} <IntegralToFloating>
const double& rcd2 = 2;
}

View File

@ -1,22 +1,22 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify
class NonCopyable {
NonCopyable(const NonCopyable&) = delete; //expected-note3{{explicitly marked deleted here}}
int x = 10;
void foo() {
auto L = [this] { return x; };
const auto &M = [*this] { return x; };//expected-error{{call to deleted}}
const auto &M2 = [this] () -> auto&& {
++x;
return [*this] { //expected-error{{call to deleted}} expected-warning{{reference to local}}
return ++x; //expected-error{{read-only}}
};
};
const auto &M3 = [*this] () mutable -> auto&& { //expected-error{{call to deleted}}
++x;
return [this] { // expected-warning{{reference to local}}
return x;
};
};
}
};
// RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify
class NonCopyable {
NonCopyable(const NonCopyable&) = delete; //expected-note3{{explicitly marked deleted here}}
int x = 10;
void foo() {
auto L = [this] { return x; };
const auto &M = [*this] { return x; };//expected-error{{call to deleted}}
const auto &M2 = [this] () -> auto&& {
++x;
return [*this] { //expected-error{{call to deleted}} expected-warning{{reference to local}}
return ++x; //expected-error{{read-only}}
};
};
const auto &M3 = [*this] () mutable -> auto&& { //expected-error{{call to deleted}}
++x;
return [this] { // expected-warning{{reference to local}}
return x;
};
};
}
};

View File

@ -1,17 +1,17 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
// expected-no-diagnostics
// NOTE: This file intentionally uses DOS-style line endings to test
// that we don't propagate them into string literals as per [lex.string]p4.
constexpr const char* p = R"(a\
b
c)";
static_assert(p[0] == 'a', "");
static_assert(p[1] == '\\', "");
static_assert(p[2] == '\n', "");
static_assert(p[3] == 'b', "");
static_assert(p[4] == '\n', "");
static_assert(p[5] == 'c', "");
static_assert(p[6] == '\0', "");
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
// expected-no-diagnostics
// NOTE: This file intentionally uses DOS-style line endings to test
// that we don't propagate them into string literals as per [lex.string]p4.
constexpr const char* p = R"(a\
b
c)";
static_assert(p[0] == 'a', "");
static_assert(p[1] == '\\', "");
static_assert(p[2] == '\n', "");
static_assert(p[3] == 'b', "");
static_assert(p[4] == '\n', "");
static_assert(p[5] == 'c', "");
static_assert(p[6] == '\0', "");

View File

@ -1,25 +1,25 @@
// RUN: %clang_cc1 -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
// RUN: %clang_cc1 -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -ffast-math -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP
float f0, f1, f2;
void foo(void) {
// CHECK-LABEL: define {{.*}}void @foo()
// MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
// EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
// PRECISE: fadd contract float %{{.*}}, %{{.*}}
// FAST: fadd fast
// FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float
f0 = f1 + f2;
// CHECK: ret
}
// RUN: %clang_cc1 -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
// RUN: %clang_cc1 -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -ffast-math -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT
// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP
float f0, f1, f2;
void foo(void) {
// CHECK-LABEL: define {{.*}}void @foo()
// MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
// EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
// PRECISE: fadd contract float %{{.*}}, %{{.*}}
// FAST: fadd fast
// FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float
f0 = f1 + f2;
// CHECK: ret
}

View File

@ -1,49 +1,49 @@
// RUN: %clang_cc1 -x c++ -fexceptions -fcxx-exceptions -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
// RUN: %clang_cc1 -x c++ -ffp-contract=fast -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP
float f0, f1, f2;
template <class>
class aaaa {
public:
~aaaa();
void b();
};
template <class c>
aaaa<c>::~aaaa() { try {
b();
// CHECK-LABEL: define {{.*}}void @_ZN4aaaaIiED2Ev{{.*}}
} catch (...) {
// MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
// EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
// PRECISE: fadd contract float %{{.*}}, %{{.*}}
// FAST: fadd fast
// FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float
f0 = f1 + f2;
// CHECK: ret void
}
}
class d {
public:
d(const char *, int);
aaaa<int> e;
};
float foo() {
d x("", 1);
aaaa<int> a;
return f0;
}
// RUN: %clang_cc1 -x c++ -fexceptions -fcxx-exceptions -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
// RUN: %clang_cc1 -x c++ -ffp-contract=fast -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT
// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP
float f0, f1, f2;
template <class>
class aaaa {
public:
~aaaa();
void b();
};
template <class c>
aaaa<c>::~aaaa() { try {
b();
// CHECK-LABEL: define {{.*}}void @_ZN4aaaaIiED2Ev{{.*}}
} catch (...) {
// MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
// EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
// FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
// PRECISE: fadd contract float %{{.*}}, %{{.*}}
// FAST: fadd fast
// FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float
f0 = f1 + f2;
// CHECK: ret void
}
}
class d {
public:
d(const char *, int);
aaaa<int> e;
};
float foo() {
d x("", 1);
aaaa<int> a;
return f0;
}

View File

@ -1,31 +1,31 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-pc-win32 %s -emit-llvm -o - | FileCheck %s
// CHECK: foo{{[^#]*}}#[[ATTRS:[0-9]+]]
__attribute__((no_caller_saved_registers)) void foo() {}
namespace S {
// CHECK: bar{{[^#]*}}#[[ATTRS]]
__attribute__((no_caller_saved_registers)) void bar(int *a) { foo(); }
}
struct St {
static void baz(int *a) __attribute__((no_caller_saved_registers)) { S::bar(a); }
};
__attribute((no_caller_saved_registers)) void (*foobar)(void);
// CHECK-LABEL: @main
int main(int argc, char **argv) {
St::baz(&argc);
// CHECK: [[FOOBAR:%.+]] = load ptr, ptr @{{.*}}foobar{{.*}},
// CHECK-NEXT: call void [[FOOBAR]]() #[[ATTRS1:.+]]
foobar();
return 0;
}
// CHECK: baz{{[^#]*}}#[[ATTRS]]
// CHECK: attributes #[[ATTRS]] = {
// CHECK-SAME: "no_caller_saved_registers"
// CHECK-SAME: }
// CHECK: attributes #[[ATTRS1]] = { "no_caller_saved_registers" }
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-pc-win32 %s -emit-llvm -o - | FileCheck %s
// CHECK: foo{{[^#]*}}#[[ATTRS:[0-9]+]]
__attribute__((no_caller_saved_registers)) void foo() {}
namespace S {
// CHECK: bar{{[^#]*}}#[[ATTRS]]
__attribute__((no_caller_saved_registers)) void bar(int *a) { foo(); }
}
struct St {
static void baz(int *a) __attribute__((no_caller_saved_registers)) { S::bar(a); }
};
__attribute((no_caller_saved_registers)) void (*foobar)(void);
// CHECK-LABEL: @main
int main(int argc, char **argv) {
St::baz(&argc);
// CHECK: [[FOOBAR:%.+]] = load ptr, ptr @{{.*}}foobar{{.*}},
// CHECK-NEXT: call void [[FOOBAR]]() #[[ATTRS1:.+]]
foobar();
return 0;
}
// CHECK: baz{{[^#]*}}#[[ATTRS]]
// CHECK: attributes #[[ATTRS]] = {
// CHECK-SAME: "no_caller_saved_registers"
// CHECK-SAME: }
// CHECK: attributes #[[ATTRS1]] = { "no_caller_saved_registers" }

View File

@ -1,22 +1,22 @@
// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-windows-msvc -gcodeview -debug-info-kind=limited -o - | FileCheck %s
struct a {
~a();
};
template <typename b> struct c : a {
c(void (b::*)());
};
struct B {
virtual void e();
};
c<B> *d() {
static c<B> f(&B::e);
return &f;
}
// CHECK: define internal void @"??__Ff@?1??d@@YAPEAU?$c@UB@@@@XZ@YAXXZ"()
// CHECK-SAME: !dbg ![[SUBPROGRAM:[0-9]+]] {
// CHECK: call void @"??1?$c@UB@@@@QEAA@XZ"(ptr @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A"), !dbg ![[LOCATION:[0-9]+]]
// CHECK: ![[SUBPROGRAM]] = distinct !DISubprogram(name: "`dynamic atexit destructor for 'f'"
// CHECK-SAME: flags: DIFlagArtificial
// CHECK: ![[LOCATION]] = !DILocation(line: 0, scope: ![[SUBPROGRAM]])
// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-windows-msvc -gcodeview -debug-info-kind=limited -o - | FileCheck %s
struct a {
~a();
};
template <typename b> struct c : a {
c(void (b::*)());
};
struct B {
virtual void e();
};
c<B> *d() {
static c<B> f(&B::e);
return &f;
}
// CHECK: define internal void @"??__Ff@?1??d@@YAPEAU?$c@UB@@@@XZ@YAXXZ"()
// CHECK-SAME: !dbg ![[SUBPROGRAM:[0-9]+]] {
// CHECK: call void @"??1?$c@UB@@@@QEAA@XZ"(ptr @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A"), !dbg ![[LOCATION:[0-9]+]]
// CHECK: ![[SUBPROGRAM]] = distinct !DISubprogram(name: "`dynamic atexit destructor for 'f'"
// CHECK-SAME: flags: DIFlagArtificial
// CHECK: ![[LOCATION]] = !DILocation(line: 0, scope: ![[SUBPROGRAM]])

View File

@ -1,134 +1,134 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
#ifdef __HLSL_ENABLE_16_BIT
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.dx.clamp.i16(
int16_t test_clamp_short(int16_t p0, int16_t p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.dx.clamp.v2i16(
int16_t2 test_clamp_short2(int16_t2 p0, int16_t2 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.dx.clamp.v3i16
int16_t3 test_clamp_short3(int16_t3 p0, int16_t3 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.dx.clamp.v4i16
int16_t4 test_clamp_short4(int16_t4 p0, int16_t4 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.dx.uclamp.i16(
uint16_t test_clamp_ushort(uint16_t p0, uint16_t p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.dx.uclamp.v2i16
uint16_t2 test_clamp_ushort2(uint16_t2 p0, uint16_t2 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.dx.uclamp.v3i16
uint16_t3 test_clamp_ushort3(uint16_t3 p0, uint16_t3 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.dx.uclamp.v4i16
uint16_t4 test_clamp_ushort4(uint16_t4 p0, uint16_t4 p1) { return clamp(p0, p1,p1); }
#endif
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.dx.clamp.i32(
int test_clamp_int(int p0, int p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.dx.clamp.v2i32
int2 test_clamp_int2(int2 p0, int2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.dx.clamp.v3i32
int3 test_clamp_int3(int3 p0, int3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.dx.clamp.v4i32
int4 test_clamp_int4(int4 p0, int4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.dx.uclamp.i32(
int test_clamp_uint(uint p0, uint p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.dx.uclamp.v2i32
uint2 test_clamp_uint2(uint2 p0, uint2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.dx.uclamp.v3i32
uint3 test_clamp_uint3(uint3 p0, uint3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.dx.uclamp.v4i32
uint4 test_clamp_uint4(uint4 p0, uint4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.dx.clamp.i64(
int64_t test_clamp_long(int64_t p0, int64_t p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.dx.clamp.v2i64
int64_t2 test_clamp_long2(int64_t2 p0, int64_t2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.dx.clamp.v3i64
int64_t3 test_clamp_long3(int64_t3 p0, int64_t3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.dx.clamp.v4i64
int64_t4 test_clamp_long4(int64_t4 p0, int64_t4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.dx.uclamp.i64(
uint64_t test_clamp_long(uint64_t p0, uint64_t p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.dx.uclamp.v2i64
uint64_t2 test_clamp_long2(uint64_t2 p0, uint64_t2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.dx.uclamp.v3i64
uint64_t3 test_clamp_long3(uint64_t3 p0, uint64_t3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.dx.uclamp.v4i64
uint64_t4 test_clamp_long4(uint64_t4 p0, uint64_t4 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.dx.clamp.f16(
// NO_HALF: define noundef float @"?test_clamp_half
// NO_HALF: call float @llvm.dx.clamp.f32(
half test_clamp_half(half p0, half p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.dx.clamp.v2f16
// NO_HALF: define noundef <2 x float> @"?test_clamp_half2
// NO_HALF: call <2 x float> @llvm.dx.clamp.v2f32(
half2 test_clamp_half2(half2 p0, half2 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.dx.clamp.v3f16
// NO_HALF: define noundef <3 x float> @"?test_clamp_half3
// NO_HALF: call <3 x float> @llvm.dx.clamp.v3f32(
half3 test_clamp_half3(half3 p0, half3 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.dx.clamp.v4f16
// NO_HALF: define noundef <4 x float> @"?test_clamp_half4
// NO_HALF: call <4 x float> @llvm.dx.clamp.v4f32(
half4 test_clamp_half4(half4 p0, half4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef float @"?test_clamp_float
// CHECK: call float @llvm.dx.clamp.f32(
float test_clamp_float(float p0, float p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x float> @"?test_clamp_float2
// CHECK: call <2 x float> @llvm.dx.clamp.v2f32
float2 test_clamp_float2(float2 p0, float2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x float> @"?test_clamp_float3
// CHECK: call <3 x float> @llvm.dx.clamp.v3f32
float3 test_clamp_float3(float3 p0, float3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x float> @"?test_clamp_float4
// CHECK: call <4 x float> @llvm.dx.clamp.v4f32
float4 test_clamp_float4(float4 p0, float4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef double @
// CHECK: call double @llvm.dx.clamp.f64(
double test_clamp_double(double p0, double p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x double> @
// CHECK: call <2 x double> @llvm.dx.clamp.v2f64
double2 test_clamp_double2(double2 p0, double2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x double> @
// CHECK: call <3 x double> @llvm.dx.clamp.v3f64
double3 test_clamp_double3(double3 p0, double3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x double> @
// CHECK: call <4 x double> @llvm.dx.clamp.v4f64
double4 test_clamp_double4(double4 p0, double4 p1) { return clamp(p0, p1,p1); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
#ifdef __HLSL_ENABLE_16_BIT
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.dx.clamp.i16(
int16_t test_clamp_short(int16_t p0, int16_t p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.dx.clamp.v2i16(
int16_t2 test_clamp_short2(int16_t2 p0, int16_t2 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.dx.clamp.v3i16
int16_t3 test_clamp_short3(int16_t3 p0, int16_t3 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.dx.clamp.v4i16
int16_t4 test_clamp_short4(int16_t4 p0, int16_t4 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.dx.uclamp.i16(
uint16_t test_clamp_ushort(uint16_t p0, uint16_t p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.dx.uclamp.v2i16
uint16_t2 test_clamp_ushort2(uint16_t2 p0, uint16_t2 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.dx.uclamp.v3i16
uint16_t3 test_clamp_ushort3(uint16_t3 p0, uint16_t3 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.dx.uclamp.v4i16
uint16_t4 test_clamp_ushort4(uint16_t4 p0, uint16_t4 p1) { return clamp(p0, p1,p1); }
#endif
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.dx.clamp.i32(
int test_clamp_int(int p0, int p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.dx.clamp.v2i32
int2 test_clamp_int2(int2 p0, int2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.dx.clamp.v3i32
int3 test_clamp_int3(int3 p0, int3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.dx.clamp.v4i32
int4 test_clamp_int4(int4 p0, int4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.dx.uclamp.i32(
int test_clamp_uint(uint p0, uint p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.dx.uclamp.v2i32
uint2 test_clamp_uint2(uint2 p0, uint2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.dx.uclamp.v3i32
uint3 test_clamp_uint3(uint3 p0, uint3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.dx.uclamp.v4i32
uint4 test_clamp_uint4(uint4 p0, uint4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.dx.clamp.i64(
int64_t test_clamp_long(int64_t p0, int64_t p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.dx.clamp.v2i64
int64_t2 test_clamp_long2(int64_t2 p0, int64_t2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.dx.clamp.v3i64
int64_t3 test_clamp_long3(int64_t3 p0, int64_t3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.dx.clamp.v4i64
int64_t4 test_clamp_long4(int64_t4 p0, int64_t4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.dx.uclamp.i64(
uint64_t test_clamp_long(uint64_t p0, uint64_t p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.dx.uclamp.v2i64
uint64_t2 test_clamp_long2(uint64_t2 p0, uint64_t2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.dx.uclamp.v3i64
uint64_t3 test_clamp_long3(uint64_t3 p0, uint64_t3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.dx.uclamp.v4i64
uint64_t4 test_clamp_long4(uint64_t4 p0, uint64_t4 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.dx.clamp.f16(
// NO_HALF: define noundef float @"?test_clamp_half
// NO_HALF: call float @llvm.dx.clamp.f32(
half test_clamp_half(half p0, half p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.dx.clamp.v2f16
// NO_HALF: define noundef <2 x float> @"?test_clamp_half2
// NO_HALF: call <2 x float> @llvm.dx.clamp.v2f32(
half2 test_clamp_half2(half2 p0, half2 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.dx.clamp.v3f16
// NO_HALF: define noundef <3 x float> @"?test_clamp_half3
// NO_HALF: call <3 x float> @llvm.dx.clamp.v3f32(
half3 test_clamp_half3(half3 p0, half3 p1) { return clamp(p0, p1,p1); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.dx.clamp.v4f16
// NO_HALF: define noundef <4 x float> @"?test_clamp_half4
// NO_HALF: call <4 x float> @llvm.dx.clamp.v4f32(
half4 test_clamp_half4(half4 p0, half4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef float @"?test_clamp_float
// CHECK: call float @llvm.dx.clamp.f32(
float test_clamp_float(float p0, float p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x float> @"?test_clamp_float2
// CHECK: call <2 x float> @llvm.dx.clamp.v2f32
float2 test_clamp_float2(float2 p0, float2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x float> @"?test_clamp_float3
// CHECK: call <3 x float> @llvm.dx.clamp.v3f32
float3 test_clamp_float3(float3 p0, float3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x float> @"?test_clamp_float4
// CHECK: call <4 x float> @llvm.dx.clamp.v4f32
float4 test_clamp_float4(float4 p0, float4 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef double @
// CHECK: call double @llvm.dx.clamp.f64(
double test_clamp_double(double p0, double p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <2 x double> @
// CHECK: call <2 x double> @llvm.dx.clamp.v2f64
double2 test_clamp_double2(double2 p0, double2 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <3 x double> @
// CHECK: call <3 x double> @llvm.dx.clamp.v3f64
double3 test_clamp_double3(double3 p0, double3 p1) { return clamp(p0, p1,p1); }
// CHECK: define noundef <4 x double> @
// CHECK: call <4 x double> @llvm.dx.clamp.v4f64
double4 test_clamp_double4(double4 p0, double4 p1) { return clamp(p0, p1,p1); }

View File

@ -1,41 +1,41 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.cos.f16(
// NO_HALF: define noundef float @"?test_cos_half
// NO_HALF: call float @llvm.cos.f32(
half test_cos_half(half p0) { return cos(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.cos.v2f16
// NO_HALF: define noundef <2 x float> @"?test_cos_half2
// NO_HALF: call <2 x float> @llvm.cos.v2f32(
half2 test_cos_half2(half2 p0) { return cos(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.cos.v3f16
// NO_HALF: define noundef <3 x float> @"?test_cos_half3
// NO_HALF: call <3 x float> @llvm.cos.v3f32(
half3 test_cos_half3(half3 p0) { return cos(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.cos.v4f16
// NO_HALF: define noundef <4 x float> @"?test_cos_half4
// NO_HALF: call <4 x float> @llvm.cos.v4f32(
half4 test_cos_half4(half4 p0) { return cos(p0); }
// CHECK: define noundef float @"?test_cos_float
// CHECK: call float @llvm.cos.f32(
float test_cos_float(float p0) { return cos(p0); }
// CHECK: define noundef <2 x float> @"?test_cos_float2
// CHECK: call <2 x float> @llvm.cos.v2f32
float2 test_cos_float2(float2 p0) { return cos(p0); }
// CHECK: define noundef <3 x float> @"?test_cos_float3
// CHECK: call <3 x float> @llvm.cos.v3f32
float3 test_cos_float3(float3 p0) { return cos(p0); }
// CHECK: define noundef <4 x float> @"?test_cos_float4
// CHECK: call <4 x float> @llvm.cos.v4f32
float4 test_cos_float4(float4 p0) { return cos(p0); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.cos.f16(
// NO_HALF: define noundef float @"?test_cos_half
// NO_HALF: call float @llvm.cos.f32(
half test_cos_half(half p0) { return cos(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.cos.v2f16
// NO_HALF: define noundef <2 x float> @"?test_cos_half2
// NO_HALF: call <2 x float> @llvm.cos.v2f32(
half2 test_cos_half2(half2 p0) { return cos(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.cos.v3f16
// NO_HALF: define noundef <3 x float> @"?test_cos_half3
// NO_HALF: call <3 x float> @llvm.cos.v3f32(
half3 test_cos_half3(half3 p0) { return cos(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.cos.v4f16
// NO_HALF: define noundef <4 x float> @"?test_cos_half4
// NO_HALF: call <4 x float> @llvm.cos.v4f32(
half4 test_cos_half4(half4 p0) { return cos(p0); }
// CHECK: define noundef float @"?test_cos_float
// CHECK: call float @llvm.cos.f32(
float test_cos_float(float p0) { return cos(p0); }
// CHECK: define noundef <2 x float> @"?test_cos_float2
// CHECK: call <2 x float> @llvm.cos.v2f32
float2 test_cos_float2(float2 p0) { return cos(p0); }
// CHECK: define noundef <3 x float> @"?test_cos_float3
// CHECK: call <3 x float> @llvm.cos.v3f32
float3 test_cos_float3(float3 p0) { return cos(p0); }
// CHECK: define noundef <4 x float> @"?test_cos_float4
// CHECK: call <4 x float> @llvm.cos.v4f32
float4 test_cos_float4(float4 p0) { return cos(p0); }

View File

@ -1,43 +1,43 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
using hlsl::floor;
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.floor.f16(
// NO_HALF: define noundef float @"?test_floor_half@@YA$halff@$halff@@Z"(
// NO_HALF: call float @llvm.floor.f32(float %0)
half test_floor_half(half p0) { return floor(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.floor.v2f16(
// NO_HALF: define noundef <2 x float> @"?test_floor_half2@@YAT?$__vector@$halff@$01@__clang@@T12@@Z"(
// NO_HALF: call <2 x float> @llvm.floor.v2f32(
half2 test_floor_half2(half2 p0) { return floor(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.floor.v3f16(
// NO_HALF: define noundef <3 x float> @"?test_floor_half3@@YAT?$__vector@$halff@$02@__clang@@T12@@Z"(
// NO_HALF: call <3 x float> @llvm.floor.v3f32(
half3 test_floor_half3(half3 p0) { return floor(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.floor.v4f16(
// NO_HALF: define noundef <4 x float> @"?test_floor_half4@@YAT?$__vector@$halff@$03@__clang@@T12@@Z"(
// NO_HALF: call <4 x float> @llvm.floor.v4f32(
half4 test_floor_half4(half4 p0) { return floor(p0); }
// CHECK: define noundef float @
// CHECK: call float @llvm.floor.f32(
float test_floor_float(float p0) { return floor(p0); }
// CHECK: define noundef <2 x float> @
// CHECK: call <2 x float> @llvm.floor.v2f32(
float2 test_floor_float2(float2 p0) { return floor(p0); }
// CHECK: define noundef <3 x float> @
// CHECK: call <3 x float> @llvm.floor.v3f32(
float3 test_floor_float3(float3 p0) { return floor(p0); }
// CHECK: define noundef <4 x float> @
// CHECK: call <4 x float> @llvm.floor.v4f32(
float4 test_floor_float4(float4 p0) { return floor(p0); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
using hlsl::floor;
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.floor.f16(
// NO_HALF: define noundef float @"?test_floor_half@@YA$halff@$halff@@Z"(
// NO_HALF: call float @llvm.floor.f32(float %0)
half test_floor_half(half p0) { return floor(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.floor.v2f16(
// NO_HALF: define noundef <2 x float> @"?test_floor_half2@@YAT?$__vector@$halff@$01@__clang@@T12@@Z"(
// NO_HALF: call <2 x float> @llvm.floor.v2f32(
half2 test_floor_half2(half2 p0) { return floor(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.floor.v3f16(
// NO_HALF: define noundef <3 x float> @"?test_floor_half3@@YAT?$__vector@$halff@$02@__clang@@T12@@Z"(
// NO_HALF: call <3 x float> @llvm.floor.v3f32(
half3 test_floor_half3(half3 p0) { return floor(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.floor.v4f16(
// NO_HALF: define noundef <4 x float> @"?test_floor_half4@@YAT?$__vector@$halff@$03@__clang@@T12@@Z"(
// NO_HALF: call <4 x float> @llvm.floor.v4f32(
half4 test_floor_half4(half4 p0) { return floor(p0); }
// CHECK: define noundef float @
// CHECK: call float @llvm.floor.f32(
float test_floor_float(float p0) { return floor(p0); }
// CHECK: define noundef <2 x float> @
// CHECK: call <2 x float> @llvm.floor.v2f32(
float2 test_floor_float2(float2 p0) { return floor(p0); }
// CHECK: define noundef <3 x float> @
// CHECK: call <3 x float> @llvm.floor.v3f32(
float3 test_floor_float3(float3 p0) { return floor(p0); }
// CHECK: define noundef <4 x float> @
// CHECK: call <4 x float> @llvm.floor.v4f32(
float4 test_floor_float4(float4 p0) { return floor(p0); }

View File

@ -1,15 +1,15 @@
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s
// CHECK-LABEL: builtin_lerp_half_vector
// CHECK: %hlsl.lerp = call <3 x half> @llvm.dx.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// CHECK: ret <3 x half> %hlsl.lerp
half3 builtin_lerp_half_vector (half3 p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
}
// CHECK-LABEL: builtin_lerp_floar_vector
// CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.lerp
float2 builtin_lerp_floar_vector ( float2 p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
}
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s
// CHECK-LABEL: builtin_lerp_half_vector
// CHECK: %hlsl.lerp = call <3 x half> @llvm.dx.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// CHECK: ret <3 x half> %hlsl.lerp
half3 builtin_lerp_half_vector (half3 p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
}
// CHECK-LABEL: builtin_lerp_floar_vector
// CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.lerp
float2 builtin_lerp_floar_vector ( float2 p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
}

View File

@ -1,102 +1,102 @@
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,DXIL_CHECK,NO_HALF,DXIL_NO_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_NO_HALF,SPIR_CHECK
// DXIL_NATIVE_HALF: %hlsl.lerp = call half @llvm.dx.lerp.f16(half %0, half %1, half %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call half @llvm.spv.lerp.f16(half %0, half %1, half %2)
// NATIVE_HALF: ret half %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call float @llvm.dx.lerp.f32(float %0, float %1, float %2)
// SPIR_NO_HALF: %hlsl.lerp = call float @llvm.spv.lerp.f32(float %0, float %1, float %2)
// NO_HALF: ret float %hlsl.lerp
half test_lerp_half(half p0) { return lerp(p0, p0, p0); }
// DXIL_NATIVE_HALF: %hlsl.lerp = call <2 x half> @llvm.dx.lerp.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call <2 x half> @llvm.spv.lerp.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2)
// NATIVE_HALF: ret <2 x half> %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// SPIR_NO_HALF: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// NO_HALF: ret <2 x float> %hlsl.lerp
half2 test_lerp_half2(half2 p0) { return lerp(p0, p0, p0); }
// DXIL_NATIVE_HALF: %hlsl.lerp = call <3 x half> @llvm.dx.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call <3 x half> @llvm.spv.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// NATIVE_HALF: ret <3 x half> %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// SPIR_NO_HALF: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// NO_HALF: ret <3 x float> %hlsl.lerp
half3 test_lerp_half3(half3 p0) { return lerp(p0, p0, p0); }
// DXIL_NATIVE_HALF: %hlsl.lerp = call <4 x half> @llvm.dx.lerp.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call <4 x half> @llvm.spv.lerp.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2)
// NATIVE_HALF: ret <4 x half> %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// SPIR_NO_HALF: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// NO_HALF: ret <4 x float> %hlsl.lerp
half4 test_lerp_half4(half4 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call float @llvm.dx.lerp.f32(float %0, float %1, float %2)
// SPIR_CHECK: %hlsl.lerp = call float @llvm.spv.lerp.f32(float %0, float %1, float %2)
// CHECK: ret float %hlsl.lerp
float test_lerp_float(float p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.lerp
float2 test_lerp_float2(float2 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.lerp
float3 test_lerp_float3(float3 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.lerp
float4 test_lerp_float4(float4 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.lerp
float2 test_lerp_float2_splat(float p0, float2 p1) { return lerp(p0, p1, p1); }
// DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.lerp
float3 test_lerp_float3_splat(float p0, float3 p1) { return lerp(p0, p1, p1); }
// DXIL_CHECK: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.lerp
float4 test_lerp_float4_splat(float p0, float4 p1) { return lerp(p0, p1, p1); }
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <2 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <2 x float> %splat.splatinsert, <2 x float> poison, <2 x i32> zeroinitializer
// DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat)
// SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat)
// CHECK: ret <2 x float> %hlsl.lerp
float2 test_lerp_float2_int_splat(float2 p0, int p1) {
return lerp(p0, p0, p1);
}
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <3 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <3 x float> %splat.splatinsert, <3 x float> poison, <3 x i32> zeroinitializer
// DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat)
// SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat)
// CHECK: ret <3 x float> %hlsl.lerp
float3 test_lerp_float3_int_splat(float3 p0, int p1) {
return lerp(p0, p0, p1);
}
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,DXIL_CHECK,NO_HALF,DXIL_NO_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_NO_HALF,SPIR_CHECK
// DXIL_NATIVE_HALF: %hlsl.lerp = call half @llvm.dx.lerp.f16(half %0, half %1, half %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call half @llvm.spv.lerp.f16(half %0, half %1, half %2)
// NATIVE_HALF: ret half %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call float @llvm.dx.lerp.f32(float %0, float %1, float %2)
// SPIR_NO_HALF: %hlsl.lerp = call float @llvm.spv.lerp.f32(float %0, float %1, float %2)
// NO_HALF: ret float %hlsl.lerp
half test_lerp_half(half p0) { return lerp(p0, p0, p0); }
// DXIL_NATIVE_HALF: %hlsl.lerp = call <2 x half> @llvm.dx.lerp.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call <2 x half> @llvm.spv.lerp.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2)
// NATIVE_HALF: ret <2 x half> %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// SPIR_NO_HALF: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// NO_HALF: ret <2 x float> %hlsl.lerp
half2 test_lerp_half2(half2 p0) { return lerp(p0, p0, p0); }
// DXIL_NATIVE_HALF: %hlsl.lerp = call <3 x half> @llvm.dx.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call <3 x half> @llvm.spv.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// NATIVE_HALF: ret <3 x half> %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// SPIR_NO_HALF: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// NO_HALF: ret <3 x float> %hlsl.lerp
half3 test_lerp_half3(half3 p0) { return lerp(p0, p0, p0); }
// DXIL_NATIVE_HALF: %hlsl.lerp = call <4 x half> @llvm.dx.lerp.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2)
// SPIR_NATIVE_HALF: %hlsl.lerp = call <4 x half> @llvm.spv.lerp.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2)
// NATIVE_HALF: ret <4 x half> %hlsl.lerp
// DXIL_NO_HALF: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// SPIR_NO_HALF: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// NO_HALF: ret <4 x float> %hlsl.lerp
half4 test_lerp_half4(half4 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call float @llvm.dx.lerp.f32(float %0, float %1, float %2)
// SPIR_CHECK: %hlsl.lerp = call float @llvm.spv.lerp.f32(float %0, float %1, float %2)
// CHECK: ret float %hlsl.lerp
float test_lerp_float(float p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.lerp
float2 test_lerp_float2(float2 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.lerp
float3 test_lerp_float3(float3 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.lerp
float4 test_lerp_float4(float4 p0) { return lerp(p0, p0, p0); }
// DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.lerp
float2 test_lerp_float2_splat(float p0, float2 p1) { return lerp(p0, p1, p1); }
// DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.lerp
float3 test_lerp_float3_splat(float p0, float3 p1) { return lerp(p0, p1, p1); }
// DXIL_CHECK: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2)
// SPIR_CHECK: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.lerp
float4 test_lerp_float4_splat(float p0, float4 p1) { return lerp(p0, p1, p1); }
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <2 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <2 x float> %splat.splatinsert, <2 x float> poison, <2 x i32> zeroinitializer
// DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat)
// SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat)
// CHECK: ret <2 x float> %hlsl.lerp
float2 test_lerp_float2_int_splat(float2 p0, int p1) {
return lerp(p0, p0, p1);
}
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <3 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <3 x float> %splat.splatinsert, <3 x float> poison, <3 x i32> zeroinitializer
// DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat)
// SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat)
// CHECK: ret <3 x float> %hlsl.lerp
float3 test_lerp_float3_int_splat(float3 p0, int p1) {
return lerp(p0, p0, p1);
}

View File

@ -1,41 +1,41 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.log.f16(
// NO_HALF: define noundef float @"?test_log_half@@YA$halff@$halff@@Z"(
// NO_HALF: call float @llvm.log.f32(
half test_log_half(half p0) { return log(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.log.v2f16
// NO_HALF: define noundef <2 x float> @"?test_log_half2
// NO_HALF: call <2 x float> @llvm.log.v2f32(
half2 test_log_half2(half2 p0) { return log(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.log.v3f16
// NO_HALF: define noundef <3 x float> @"?test_log_half3
// NO_HALF: call <3 x float> @llvm.log.v3f32(
half3 test_log_half3(half3 p0) { return log(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.log.v4f16
// NO_HALF: define noundef <4 x float> @"?test_log_half4
// NO_HALF: call <4 x float> @llvm.log.v4f32(
half4 test_log_half4(half4 p0) { return log(p0); }
// CHECK: define noundef float @"?test_log_float
// CHECK: call float @llvm.log.f32(
float test_log_float(float p0) { return log(p0); }
// CHECK: define noundef <2 x float> @"?test_log_float2
// CHECK: call <2 x float> @llvm.log.v2f32
float2 test_log_float2(float2 p0) { return log(p0); }
// CHECK: define noundef <3 x float> @"?test_log_float3
// CHECK: call <3 x float> @llvm.log.v3f32
float3 test_log_float3(float3 p0) { return log(p0); }
// CHECK: define noundef <4 x float> @"?test_log_float4
// CHECK: call <4 x float> @llvm.log.v4f32
float4 test_log_float4(float4 p0) { return log(p0); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.log.f16(
// NO_HALF: define noundef float @"?test_log_half@@YA$halff@$halff@@Z"(
// NO_HALF: call float @llvm.log.f32(
half test_log_half(half p0) { return log(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.log.v2f16
// NO_HALF: define noundef <2 x float> @"?test_log_half2
// NO_HALF: call <2 x float> @llvm.log.v2f32(
half2 test_log_half2(half2 p0) { return log(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.log.v3f16
// NO_HALF: define noundef <3 x float> @"?test_log_half3
// NO_HALF: call <3 x float> @llvm.log.v3f32(
half3 test_log_half3(half3 p0) { return log(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.log.v4f16
// NO_HALF: define noundef <4 x float> @"?test_log_half4
// NO_HALF: call <4 x float> @llvm.log.v4f32(
half4 test_log_half4(half4 p0) { return log(p0); }
// CHECK: define noundef float @"?test_log_float
// CHECK: call float @llvm.log.f32(
float test_log_float(float p0) { return log(p0); }
// CHECK: define noundef <2 x float> @"?test_log_float2
// CHECK: call <2 x float> @llvm.log.v2f32
float2 test_log_float2(float2 p0) { return log(p0); }
// CHECK: define noundef <3 x float> @"?test_log_float3
// CHECK: call <3 x float> @llvm.log.v3f32
float3 test_log_float3(float3 p0) { return log(p0); }
// CHECK: define noundef <4 x float> @"?test_log_float4
// CHECK: call <4 x float> @llvm.log.v4f32
float4 test_log_float4(float4 p0) { return log(p0); }

View File

@ -1,41 +1,41 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.log2.f16(
// NO_HALF: define noundef float @"?test_log2_half
// NO_HALF: call float @llvm.log2.f32(
half test_log2_half(half p0) { return log2(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.log2.v2f16
// NO_HALF: define noundef <2 x float> @"?test_log2_half2
// NO_HALF: call <2 x float> @llvm.log2.v2f32(
half2 test_log2_half2(half2 p0) { return log2(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.log2.v3f16
// NO_HALF: define noundef <3 x float> @"?test_log2_half3
// NO_HALF: call <3 x float> @llvm.log2.v3f32(
half3 test_log2_half3(half3 p0) { return log2(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.log2.v4f16
// NO_HALF: define noundef <4 x float> @"?test_log2_half4
// NO_HALF: call <4 x float> @llvm.log2.v4f32(
half4 test_log2_half4(half4 p0) { return log2(p0); }
// CHECK: define noundef float @"?test_log2_float
// CHECK: call float @llvm.log2.f32(
float test_log2_float(float p0) { return log2(p0); }
// CHECK: define noundef <2 x float> @"?test_log2_float2
// CHECK: call <2 x float> @llvm.log2.v2f32
float2 test_log2_float2(float2 p0) { return log2(p0); }
// CHECK: define noundef <3 x float> @"?test_log2_float3
// CHECK: call <3 x float> @llvm.log2.v3f32
float3 test_log2_float3(float3 p0) { return log2(p0); }
// CHECK: define noundef <4 x float> @"?test_log2_float4
// CHECK: call <4 x float> @llvm.log2.v4f32
float4 test_log2_float4(float4 p0) { return log2(p0); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.log2.f16(
// NO_HALF: define noundef float @"?test_log2_half
// NO_HALF: call float @llvm.log2.f32(
half test_log2_half(half p0) { return log2(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.log2.v2f16
// NO_HALF: define noundef <2 x float> @"?test_log2_half2
// NO_HALF: call <2 x float> @llvm.log2.v2f32(
half2 test_log2_half2(half2 p0) { return log2(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.log2.v3f16
// NO_HALF: define noundef <3 x float> @"?test_log2_half3
// NO_HALF: call <3 x float> @llvm.log2.v3f32(
half3 test_log2_half3(half3 p0) { return log2(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.log2.v4f16
// NO_HALF: define noundef <4 x float> @"?test_log2_half4
// NO_HALF: call <4 x float> @llvm.log2.v4f32(
half4 test_log2_half4(half4 p0) { return log2(p0); }
// CHECK: define noundef float @"?test_log2_float
// CHECK: call float @llvm.log2.f32(
float test_log2_float(float p0) { return log2(p0); }
// CHECK: define noundef <2 x float> @"?test_log2_float2
// CHECK: call <2 x float> @llvm.log2.v2f32
float2 test_log2_float2(float2 p0) { return log2(p0); }
// CHECK: define noundef <3 x float> @"?test_log2_float3
// CHECK: call <3 x float> @llvm.log2.v3f32
float3 test_log2_float3(float3 p0) { return log2(p0); }
// CHECK: define noundef <4 x float> @"?test_log2_float4
// CHECK: call <4 x float> @llvm.log2.v4f32
float4 test_log2_float4(float4 p0) { return log2(p0); }

View File

@ -1,247 +1,247 @@
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,DXIL_CHECK,NO_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_CHECK
#ifdef __HLSL_ENABLE_16_BIT
// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.dx.umad.i16(i16 %0, i16 %1, i16 %2)
// DXIL_NATIVE_HALF: ret i16 %dx.umad
// SPIR_NATIVE_HALF: mul nuw i16 %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw i16 %{{.*}}, %{{.*}}
uint16_t test_mad_uint16_t(uint16_t p0, uint16_t p1, uint16_t p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.umad = call <2 x i16> @llvm.dx.umad.v2i16(<2 x i16> %0, <2 x i16> %1, <2 x i16> %2)
// DXIL_NATIVE_HALF: ret <2 x i16> %dx.umad
// SPIR_NATIVE_HALF: mul nuw <2 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw <2 x i16> %{{.*}}, %{{.*}}
uint16_t2 test_mad_uint16_t2(uint16_t2 p0, uint16_t2 p1, uint16_t2 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.umad = call <3 x i16> @llvm.dx.umad.v3i16(<3 x i16> %0, <3 x i16> %1, <3 x i16> %2)
// DXIL_NATIVE_HALF: ret <3 x i16> %dx.umad
// SPIR_NATIVE_HALF: mul nuw <3 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw <3 x i16> %{{.*}}, %{{.*}}
uint16_t3 test_mad_uint16_t3(uint16_t3 p0, uint16_t3 p1, uint16_t3 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.umad = call <4 x i16> @llvm.dx.umad.v4i16(<4 x i16> %0, <4 x i16> %1, <4 x i16> %2)
// DXIL_NATIVE_HALF: ret <4 x i16> %dx.umad
// SPIR_NATIVE_HALF: mul nuw <4 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw <4 x i16> %{{.*}}, %{{.*}}
uint16_t4 test_mad_uint16_t4(uint16_t4 p0, uint16_t4 p1, uint16_t4 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call i16 @llvm.dx.imad.i16(i16 %0, i16 %1, i16 %2)
// DXIL_NATIVE_HALF: ret i16 %dx.imad
// SPIR_NATIVE_HALF: mul nsw i16 %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw i16 %{{.*}}, %{{.*}}
int16_t test_mad_int16_t(int16_t p0, int16_t p1, int16_t p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call <2 x i16> @llvm.dx.imad.v2i16(<2 x i16> %0, <2 x i16> %1, <2 x i16> %2)
// DXIL_NATIVE_HALF: ret <2 x i16> %dx.imad
// SPIR_NATIVE_HALF: mul nsw <2 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw <2 x i16> %{{.*}}, %{{.*}}
int16_t2 test_mad_int16_t2(int16_t2 p0, int16_t2 p1, int16_t2 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call <3 x i16> @llvm.dx.imad.v3i16(<3 x i16> %0, <3 x i16> %1, <3 x i16> %2)
// DXIL_NATIVE_HALF: ret <3 x i16> %dx.imad
// SPIR_NATIVE_HALF: mul nsw <3 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw <3 x i16> %{{.*}}, %{{.*}}
int16_t3 test_mad_int16_t3(int16_t3 p0, int16_t3 p1, int16_t3 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call <4 x i16> @llvm.dx.imad.v4i16(<4 x i16> %0, <4 x i16> %1, <4 x i16> %2)
// DXIL_NATIVE_HALF: ret <4 x i16> %dx.imad
// SPIR_NATIVE_HALF: mul nsw <4 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw <4 x i16> %{{.*}}, %{{.*}}
int16_t4 test_mad_int16_t4(int16_t4 p0, int16_t4 p1, int16_t4 p2) { return mad(p0, p1, p2); }
#endif // __HLSL_ENABLE_16_BIT
// NATIVE_HALF: %hlsl.fmad = call half @llvm.fmuladd.f16(half %0, half %1, half %2)
// NATIVE_HALF: ret half %hlsl.fmad
// NO_HALF: %hlsl.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2)
// NO_HALF: ret float %hlsl.fmad
half test_mad_half(half p0, half p1, half p2) { return mad(p0, p1, p2); }
// NATIVE_HALF: %hlsl.fmad = call <2 x half> @llvm.fmuladd.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2)
// NATIVE_HALF: ret <2 x half> %hlsl.fmad
// NO_HALF: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// NO_HALF: ret <2 x float> %hlsl.fmad
half2 test_mad_half2(half2 p0, half2 p1, half2 p2) { return mad(p0, p1, p2); }
// NATIVE_HALF: %hlsl.fmad = call <3 x half> @llvm.fmuladd.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// NATIVE_HALF: ret <3 x half> %hlsl.fmad
// NO_HALF: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// NO_HALF: ret <3 x float> %hlsl.fmad
half3 test_mad_half3(half3 p0, half3 p1, half3 p2) { return mad(p0, p1, p2); }
// NATIVE_HALF: %hlsl.fmad = call <4 x half> @llvm.fmuladd.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2)
// NATIVE_HALF: ret <4 x half> %hlsl.fmad
// NO_HALF: %hlsl.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// NO_HALF: ret <4 x float> %hlsl.fmad
half4 test_mad_half4(half4 p0, half4 p1, half4 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2)
// CHECK: ret float %hlsl.fmad
float test_mad_float(float p0, float p1, float p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.fmad
float2 test_mad_float2(float2 p0, float2 p1, float2 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.fmad
float3 test_mad_float3(float3 p0, float3 p1, float3 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.fmad
float4 test_mad_float4(float4 p0, float4 p1, float4 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call double @llvm.fmuladd.f64(double %0, double %1, double %2)
// CHECK: ret double %hlsl.fmad
double test_mad_double(double p0, double p1, double p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %0, <2 x double> %1, <2 x double> %2)
// CHECK: ret <2 x double> %hlsl.fmad
double2 test_mad_double2(double2 p0, double2 p1, double2 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <3 x double> @llvm.fmuladd.v3f64(<3 x double> %0, <3 x double> %1, <3 x double> %2)
// CHECK: ret <3 x double> %hlsl.fmad
double3 test_mad_double3(double3 p0, double3 p1, double3 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <4 x double> @llvm.fmuladd.v4f64(<4 x double> %0, <4 x double> %1, <4 x double> %2)
// CHECK: ret <4 x double> %hlsl.fmad
double4 test_mad_double4(double4 p0, double4 p1, double4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call i32 @llvm.dx.imad.i32(i32 %0, i32 %1, i32 %2)
// DXIL_CHECK: ret i32 %dx.imad
// SPIR_CHECK: mul nsw i32 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw i32 %{{.*}}, %{{.*}}
int test_mad_int(int p0, int p1, int p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <2 x i32> @llvm.dx.imad.v2i32(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2)
// DXIL_CHECK: ret <2 x i32> %dx.imad
// SPIR_CHECK: mul nsw <2 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <2 x i32> %{{.*}}, %{{.*}}
int2 test_mad_int2(int2 p0, int2 p1, int2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <3 x i32> @llvm.dx.imad.v3i32(<3 x i32> %0, <3 x i32> %1, <3 x i32> %2)
// DXIL_CHECK: ret <3 x i32> %dx.imad
// SPIR_CHECK: mul nsw <3 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <3 x i32> %{{.*}}, %{{.*}}
int3 test_mad_int3(int3 p0, int3 p1, int3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <4 x i32> @llvm.dx.imad.v4i32(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2)
// DXIL_CHECK: ret <4 x i32> %dx.imad
// SPIR_CHECK: mul nsw <4 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <4 x i32> %{{.*}}, %{{.*}}
int4 test_mad_int4(int4 p0, int4 p1, int4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call i64 @llvm.dx.imad.i64(i64 %0, i64 %1, i64 %2)
// DXIL_CHECK: ret i64 %dx.imad
// SPIR_CHECK: mul nsw i64 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw i64 %{{.*}}, %{{.*}}
int64_t test_mad_int64_t(int64_t p0, int64_t p1, int64_t p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <2 x i64> @llvm.dx.imad.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2)
// DXIL_CHECK: ret <2 x i64> %dx.imad
// SPIR_CHECK: mul nsw <2 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <2 x i64> %{{.*}}, %{{.*}}
int64_t2 test_mad_int64_t2(int64_t2 p0, int64_t2 p1, int64_t2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <3 x i64> @llvm.dx.imad.v3i64(<3 x i64> %0, <3 x i64> %1, <3 x i64> %2)
// DXIL_CHECK: ret <3 x i64> %dx.imad
// SPIR_CHECK: mul nsw <3 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <3 x i64> %{{.*}}, %{{.*}}
int64_t3 test_mad_int64_t3(int64_t3 p0, int64_t3 p1, int64_t3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <4 x i64> @llvm.dx.imad.v4i64(<4 x i64> %0, <4 x i64> %1, <4 x i64> %2)
// DXIL_CHECK: ret <4 x i64> %dx.imad
// SPIR_CHECK: mul nsw <4 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <4 x i64> %{{.*}}, %{{.*}}
int64_t4 test_mad_int64_t4(int64_t4 p0, int64_t4 p1, int64_t4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call i32 @llvm.dx.umad.i32(i32 %0, i32 %1, i32 %2)
// DXIL_CHECK: ret i32 %dx.umad
// SPIR_CHECK: mul nuw i32 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw i32 %{{.*}}, %{{.*}}
uint test_mad_uint(uint p0, uint p1, uint p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <2 x i32> @llvm.dx.umad.v2i32(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2)
// DXIL_CHECK: ret <2 x i32> %dx.umad
// SPIR_CHECK: mul nuw <2 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <2 x i32> %{{.*}}, %{{.*}}
uint2 test_mad_uint2(uint2 p0, uint2 p1, uint2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <3 x i32> @llvm.dx.umad.v3i32(<3 x i32> %0, <3 x i32> %1, <3 x i32> %2)
// DXIL_CHECK: ret <3 x i32> %dx.umad
// SPIR_CHECK: mul nuw <3 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <3 x i32> %{{.*}}, %{{.*}}
uint3 test_mad_uint3(uint3 p0, uint3 p1, uint3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <4 x i32> @llvm.dx.umad.v4i32(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2)
// DXIL_CHECK: ret <4 x i32> %dx.umad
// SPIR_CHECK: mul nuw <4 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <4 x i32> %{{.*}}, %{{.*}}
uint4 test_mad_uint4(uint4 p0, uint4 p1, uint4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call i64 @llvm.dx.umad.i64(i64 %0, i64 %1, i64 %2)
// DXIL_CHECK: ret i64 %dx.umad
// SPIR_CHECK: mul nuw i64 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw i64 %{{.*}}, %{{.*}}
uint64_t test_mad_uint64_t(uint64_t p0, uint64_t p1, uint64_t p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <2 x i64> @llvm.dx.umad.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2)
// DXIL_CHECK: ret <2 x i64> %dx.umad
// SPIR_CHECK: mul nuw <2 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <2 x i64> %{{.*}}, %{{.*}}
uint64_t2 test_mad_uint64_t2(uint64_t2 p0, uint64_t2 p1, uint64_t2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <3 x i64> @llvm.dx.umad.v3i64(<3 x i64> %0, <3 x i64> %1, <3 x i64> %2)
// DXIL_CHECK: ret <3 x i64> %dx.umad
// SPIR_CHECK: mul nuw <3 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <3 x i64> %{{.*}}, %{{.*}}
uint64_t3 test_mad_uint64_t3(uint64_t3 p0, uint64_t3 p1, uint64_t3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <4 x i64> @llvm.dx.umad.v4i64(<4 x i64> %0, <4 x i64> %1, <4 x i64> %2)
// DXIL_CHECK: ret <4 x i64> %dx.umad
// SPIR_CHECK: mul nuw <4 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <4 x i64> %{{.*}}, %{{.*}}
uint64_t4 test_mad_uint64_t4(uint64_t4 p0, uint64_t4 p1, uint64_t4 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.fmad
float2 test_mad_float2_splat(float p0, float2 p1, float2 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.fmad
float3 test_mad_float3_splat(float p0, float3 p1, float3 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.fmad
float4 test_mad_float4_splat(float p0, float4 p1, float4 p2) { return mad(p0, p1, p2); }
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <2 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <2 x float> %splat.splatinsert, <2 x float> poison, <2 x i32> zeroinitializer
// CHECK: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat)
// CHECK: ret <2 x float> %hlsl.fmad
float2 test_mad_float2_int_splat(float2 p0, float2 p1, int p2) {
return mad(p0, p1, p2);
}
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <3 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <3 x float> %splat.splatinsert, <3 x float> poison, <3 x i32> zeroinitializer
// CHECK: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat)
// CHECK: ret <3 x float> %hlsl.fmad
float3 test_mad_float3_int_splat(float3 p0, float3 p1, int p2) {
return mad(p0, p1, p2);
}
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,DXIL_CHECK,NO_HALF
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_CHECK
#ifdef __HLSL_ENABLE_16_BIT
// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.dx.umad.i16(i16 %0, i16 %1, i16 %2)
// DXIL_NATIVE_HALF: ret i16 %dx.umad
// SPIR_NATIVE_HALF: mul nuw i16 %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw i16 %{{.*}}, %{{.*}}
uint16_t test_mad_uint16_t(uint16_t p0, uint16_t p1, uint16_t p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.umad = call <2 x i16> @llvm.dx.umad.v2i16(<2 x i16> %0, <2 x i16> %1, <2 x i16> %2)
// DXIL_NATIVE_HALF: ret <2 x i16> %dx.umad
// SPIR_NATIVE_HALF: mul nuw <2 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw <2 x i16> %{{.*}}, %{{.*}}
uint16_t2 test_mad_uint16_t2(uint16_t2 p0, uint16_t2 p1, uint16_t2 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.umad = call <3 x i16> @llvm.dx.umad.v3i16(<3 x i16> %0, <3 x i16> %1, <3 x i16> %2)
// DXIL_NATIVE_HALF: ret <3 x i16> %dx.umad
// SPIR_NATIVE_HALF: mul nuw <3 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw <3 x i16> %{{.*}}, %{{.*}}
uint16_t3 test_mad_uint16_t3(uint16_t3 p0, uint16_t3 p1, uint16_t3 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.umad = call <4 x i16> @llvm.dx.umad.v4i16(<4 x i16> %0, <4 x i16> %1, <4 x i16> %2)
// DXIL_NATIVE_HALF: ret <4 x i16> %dx.umad
// SPIR_NATIVE_HALF: mul nuw <4 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nuw <4 x i16> %{{.*}}, %{{.*}}
uint16_t4 test_mad_uint16_t4(uint16_t4 p0, uint16_t4 p1, uint16_t4 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call i16 @llvm.dx.imad.i16(i16 %0, i16 %1, i16 %2)
// DXIL_NATIVE_HALF: ret i16 %dx.imad
// SPIR_NATIVE_HALF: mul nsw i16 %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw i16 %{{.*}}, %{{.*}}
int16_t test_mad_int16_t(int16_t p0, int16_t p1, int16_t p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call <2 x i16> @llvm.dx.imad.v2i16(<2 x i16> %0, <2 x i16> %1, <2 x i16> %2)
// DXIL_NATIVE_HALF: ret <2 x i16> %dx.imad
// SPIR_NATIVE_HALF: mul nsw <2 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw <2 x i16> %{{.*}}, %{{.*}}
int16_t2 test_mad_int16_t2(int16_t2 p0, int16_t2 p1, int16_t2 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call <3 x i16> @llvm.dx.imad.v3i16(<3 x i16> %0, <3 x i16> %1, <3 x i16> %2)
// DXIL_NATIVE_HALF: ret <3 x i16> %dx.imad
// SPIR_NATIVE_HALF: mul nsw <3 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw <3 x i16> %{{.*}}, %{{.*}}
int16_t3 test_mad_int16_t3(int16_t3 p0, int16_t3 p1, int16_t3 p2) { return mad(p0, p1, p2); }
// DXIL_NATIVE_HALF: %dx.imad = call <4 x i16> @llvm.dx.imad.v4i16(<4 x i16> %0, <4 x i16> %1, <4 x i16> %2)
// DXIL_NATIVE_HALF: ret <4 x i16> %dx.imad
// SPIR_NATIVE_HALF: mul nsw <4 x i16> %{{.*}}, %{{.*}}
// SPIR_NATIVE_HALF: add nsw <4 x i16> %{{.*}}, %{{.*}}
int16_t4 test_mad_int16_t4(int16_t4 p0, int16_t4 p1, int16_t4 p2) { return mad(p0, p1, p2); }
#endif // __HLSL_ENABLE_16_BIT
// NATIVE_HALF: %hlsl.fmad = call half @llvm.fmuladd.f16(half %0, half %1, half %2)
// NATIVE_HALF: ret half %hlsl.fmad
// NO_HALF: %hlsl.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2)
// NO_HALF: ret float %hlsl.fmad
half test_mad_half(half p0, half p1, half p2) { return mad(p0, p1, p2); }
// NATIVE_HALF: %hlsl.fmad = call <2 x half> @llvm.fmuladd.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2)
// NATIVE_HALF: ret <2 x half> %hlsl.fmad
// NO_HALF: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// NO_HALF: ret <2 x float> %hlsl.fmad
half2 test_mad_half2(half2 p0, half2 p1, half2 p2) { return mad(p0, p1, p2); }
// NATIVE_HALF: %hlsl.fmad = call <3 x half> @llvm.fmuladd.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2)
// NATIVE_HALF: ret <3 x half> %hlsl.fmad
// NO_HALF: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// NO_HALF: ret <3 x float> %hlsl.fmad
half3 test_mad_half3(half3 p0, half3 p1, half3 p2) { return mad(p0, p1, p2); }
// NATIVE_HALF: %hlsl.fmad = call <4 x half> @llvm.fmuladd.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2)
// NATIVE_HALF: ret <4 x half> %hlsl.fmad
// NO_HALF: %hlsl.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// NO_HALF: ret <4 x float> %hlsl.fmad
half4 test_mad_half4(half4 p0, half4 p1, half4 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2)
// CHECK: ret float %hlsl.fmad
float test_mad_float(float p0, float p1, float p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.fmad
float2 test_mad_float2(float2 p0, float2 p1, float2 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.fmad
float3 test_mad_float3(float3 p0, float3 p1, float3 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.fmad
float4 test_mad_float4(float4 p0, float4 p1, float4 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call double @llvm.fmuladd.f64(double %0, double %1, double %2)
// CHECK: ret double %hlsl.fmad
double test_mad_double(double p0, double p1, double p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %0, <2 x double> %1, <2 x double> %2)
// CHECK: ret <2 x double> %hlsl.fmad
double2 test_mad_double2(double2 p0, double2 p1, double2 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <3 x double> @llvm.fmuladd.v3f64(<3 x double> %0, <3 x double> %1, <3 x double> %2)
// CHECK: ret <3 x double> %hlsl.fmad
double3 test_mad_double3(double3 p0, double3 p1, double3 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <4 x double> @llvm.fmuladd.v4f64(<4 x double> %0, <4 x double> %1, <4 x double> %2)
// CHECK: ret <4 x double> %hlsl.fmad
double4 test_mad_double4(double4 p0, double4 p1, double4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call i32 @llvm.dx.imad.i32(i32 %0, i32 %1, i32 %2)
// DXIL_CHECK: ret i32 %dx.imad
// SPIR_CHECK: mul nsw i32 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw i32 %{{.*}}, %{{.*}}
int test_mad_int(int p0, int p1, int p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <2 x i32> @llvm.dx.imad.v2i32(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2)
// DXIL_CHECK: ret <2 x i32> %dx.imad
// SPIR_CHECK: mul nsw <2 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <2 x i32> %{{.*}}, %{{.*}}
int2 test_mad_int2(int2 p0, int2 p1, int2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <3 x i32> @llvm.dx.imad.v3i32(<3 x i32> %0, <3 x i32> %1, <3 x i32> %2)
// DXIL_CHECK: ret <3 x i32> %dx.imad
// SPIR_CHECK: mul nsw <3 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <3 x i32> %{{.*}}, %{{.*}}
int3 test_mad_int3(int3 p0, int3 p1, int3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <4 x i32> @llvm.dx.imad.v4i32(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2)
// DXIL_CHECK: ret <4 x i32> %dx.imad
// SPIR_CHECK: mul nsw <4 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <4 x i32> %{{.*}}, %{{.*}}
int4 test_mad_int4(int4 p0, int4 p1, int4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call i64 @llvm.dx.imad.i64(i64 %0, i64 %1, i64 %2)
// DXIL_CHECK: ret i64 %dx.imad
// SPIR_CHECK: mul nsw i64 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw i64 %{{.*}}, %{{.*}}
int64_t test_mad_int64_t(int64_t p0, int64_t p1, int64_t p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <2 x i64> @llvm.dx.imad.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2)
// DXIL_CHECK: ret <2 x i64> %dx.imad
// SPIR_CHECK: mul nsw <2 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <2 x i64> %{{.*}}, %{{.*}}
int64_t2 test_mad_int64_t2(int64_t2 p0, int64_t2 p1, int64_t2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <3 x i64> @llvm.dx.imad.v3i64(<3 x i64> %0, <3 x i64> %1, <3 x i64> %2)
// DXIL_CHECK: ret <3 x i64> %dx.imad
// SPIR_CHECK: mul nsw <3 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <3 x i64> %{{.*}}, %{{.*}}
int64_t3 test_mad_int64_t3(int64_t3 p0, int64_t3 p1, int64_t3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.imad = call <4 x i64> @llvm.dx.imad.v4i64(<4 x i64> %0, <4 x i64> %1, <4 x i64> %2)
// DXIL_CHECK: ret <4 x i64> %dx.imad
// SPIR_CHECK: mul nsw <4 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nsw <4 x i64> %{{.*}}, %{{.*}}
int64_t4 test_mad_int64_t4(int64_t4 p0, int64_t4 p1, int64_t4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call i32 @llvm.dx.umad.i32(i32 %0, i32 %1, i32 %2)
// DXIL_CHECK: ret i32 %dx.umad
// SPIR_CHECK: mul nuw i32 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw i32 %{{.*}}, %{{.*}}
uint test_mad_uint(uint p0, uint p1, uint p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <2 x i32> @llvm.dx.umad.v2i32(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2)
// DXIL_CHECK: ret <2 x i32> %dx.umad
// SPIR_CHECK: mul nuw <2 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <2 x i32> %{{.*}}, %{{.*}}
uint2 test_mad_uint2(uint2 p0, uint2 p1, uint2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <3 x i32> @llvm.dx.umad.v3i32(<3 x i32> %0, <3 x i32> %1, <3 x i32> %2)
// DXIL_CHECK: ret <3 x i32> %dx.umad
// SPIR_CHECK: mul nuw <3 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <3 x i32> %{{.*}}, %{{.*}}
uint3 test_mad_uint3(uint3 p0, uint3 p1, uint3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <4 x i32> @llvm.dx.umad.v4i32(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2)
// DXIL_CHECK: ret <4 x i32> %dx.umad
// SPIR_CHECK: mul nuw <4 x i32> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <4 x i32> %{{.*}}, %{{.*}}
uint4 test_mad_uint4(uint4 p0, uint4 p1, uint4 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call i64 @llvm.dx.umad.i64(i64 %0, i64 %1, i64 %2)
// DXIL_CHECK: ret i64 %dx.umad
// SPIR_CHECK: mul nuw i64 %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw i64 %{{.*}}, %{{.*}}
uint64_t test_mad_uint64_t(uint64_t p0, uint64_t p1, uint64_t p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <2 x i64> @llvm.dx.umad.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2)
// DXIL_CHECK: ret <2 x i64> %dx.umad
// SPIR_CHECK: mul nuw <2 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <2 x i64> %{{.*}}, %{{.*}}
uint64_t2 test_mad_uint64_t2(uint64_t2 p0, uint64_t2 p1, uint64_t2 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <3 x i64> @llvm.dx.umad.v3i64(<3 x i64> %0, <3 x i64> %1, <3 x i64> %2)
// DXIL_CHECK: ret <3 x i64> %dx.umad
// SPIR_CHECK: mul nuw <3 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <3 x i64> %{{.*}}, %{{.*}}
uint64_t3 test_mad_uint64_t3(uint64_t3 p0, uint64_t3 p1, uint64_t3 p2) { return mad(p0, p1, p2); }
// DXIL_CHECK: %dx.umad = call <4 x i64> @llvm.dx.umad.v4i64(<4 x i64> %0, <4 x i64> %1, <4 x i64> %2)
// DXIL_CHECK: ret <4 x i64> %dx.umad
// SPIR_CHECK: mul nuw <4 x i64> %{{.*}}, %{{.*}}
// SPIR_CHECK: add nuw <4 x i64> %{{.*}}, %{{.*}}
uint64_t4 test_mad_uint64_t4(uint64_t4 p0, uint64_t4 p1, uint64_t4 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2)
// CHECK: ret <2 x float> %hlsl.fmad
float2 test_mad_float2_splat(float p0, float2 p1, float2 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2)
// CHECK: ret <3 x float> %hlsl.fmad
float3 test_mad_float3_splat(float p0, float3 p1, float3 p2) { return mad(p0, p1, p2); }
// CHECK: %hlsl.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2)
// CHECK: ret <4 x float> %hlsl.fmad
float4 test_mad_float4_splat(float p0, float4 p1, float4 p2) { return mad(p0, p1, p2); }
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <2 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <2 x float> %splat.splatinsert, <2 x float> poison, <2 x i32> zeroinitializer
// CHECK: %hlsl.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat)
// CHECK: ret <2 x float> %hlsl.fmad
float2 test_mad_float2_int_splat(float2 p0, float2 p1, int p2) {
return mad(p0, p1, p2);
}
// CHECK: %conv = sitofp i32 %2 to float
// CHECK: %splat.splatinsert = insertelement <3 x float> poison, float %conv, i64 0
// CHECK: %splat.splat = shufflevector <3 x float> %splat.splatinsert, <3 x float> poison, <3 x i32> zeroinitializer
// CHECK: %hlsl.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat)
// CHECK: ret <3 x float> %hlsl.fmad
float3 test_mad_float3_int_splat(float3 p0, float3 p1, int p2) {
return mad(p0, p1, p2);
}

View File

@ -1,134 +1,134 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
#ifdef __HLSL_ENABLE_16_BIT
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.smax.i16(
int16_t test_max_short(int16_t p0, int16_t p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.smax.v2i16(
int16_t2 test_max_short2(int16_t2 p0, int16_t2 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.smax.v3i16
int16_t3 test_max_short3(int16_t3 p0, int16_t3 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.smax.v4i16
int16_t4 test_max_short4(int16_t4 p0, int16_t4 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.umax.i16(
uint16_t test_max_ushort(uint16_t p0, uint16_t p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.umax.v2i16
uint16_t2 test_max_ushort2(uint16_t2 p0, uint16_t2 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.umax.v3i16
uint16_t3 test_max_ushort3(uint16_t3 p0, uint16_t3 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.umax.v4i16
uint16_t4 test_max_ushort4(uint16_t4 p0, uint16_t4 p1) { return max(p0, p1); }
#endif
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.smax.i32(
int test_max_int(int p0, int p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.smax.v2i32
int2 test_max_int2(int2 p0, int2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.smax.v3i32
int3 test_max_int3(int3 p0, int3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.smax.v4i32
int4 test_max_int4(int4 p0, int4 p1) { return max(p0, p1); }
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.umax.i32(
int test_max_uint(uint p0, uint p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.umax.v2i32
uint2 test_max_uint2(uint2 p0, uint2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.umax.v3i32
uint3 test_max_uint3(uint3 p0, uint3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.umax.v4i32
uint4 test_max_uint4(uint4 p0, uint4 p1) { return max(p0, p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.smax.i64(
int64_t test_max_long(int64_t p0, int64_t p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.smax.v2i64
int64_t2 test_max_long2(int64_t2 p0, int64_t2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.smax.v3i64
int64_t3 test_max_long3(int64_t3 p0, int64_t3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.smax.v4i64
int64_t4 test_max_long4(int64_t4 p0, int64_t4 p1) { return max(p0, p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.umax.i64(
uint64_t test_max_long(uint64_t p0, uint64_t p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.umax.v2i64
uint64_t2 test_max_long2(uint64_t2 p0, uint64_t2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.umax.v3i64
uint64_t3 test_max_long3(uint64_t3 p0, uint64_t3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.umax.v4i64
uint64_t4 test_max_long4(uint64_t4 p0, uint64_t4 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.maxnum.f16(
// NO_HALF: define noundef float @"?test_max_half
// NO_HALF: call float @llvm.maxnum.f32(
half test_max_half(half p0, half p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.maxnum.v2f16
// NO_HALF: define noundef <2 x float> @"?test_max_half2
// NO_HALF: call <2 x float> @llvm.maxnum.v2f32(
half2 test_max_half2(half2 p0, half2 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.maxnum.v3f16
// NO_HALF: define noundef <3 x float> @"?test_max_half3
// NO_HALF: call <3 x float> @llvm.maxnum.v3f32(
half3 test_max_half3(half3 p0, half3 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.maxnum.v4f16
// NO_HALF: define noundef <4 x float> @"?test_max_half4
// NO_HALF: call <4 x float> @llvm.maxnum.v4f32(
half4 test_max_half4(half4 p0, half4 p1) { return max(p0, p1); }
// CHECK: define noundef float @"?test_max_float
// CHECK: call float @llvm.maxnum.f32(
float test_max_float(float p0, float p1) { return max(p0, p1); }
// CHECK: define noundef <2 x float> @"?test_max_float2
// CHECK: call <2 x float> @llvm.maxnum.v2f32
float2 test_max_float2(float2 p0, float2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x float> @"?test_max_float3
// CHECK: call <3 x float> @llvm.maxnum.v3f32
float3 test_max_float3(float3 p0, float3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x float> @"?test_max_float4
// CHECK: call <4 x float> @llvm.maxnum.v4f32
float4 test_max_float4(float4 p0, float4 p1) { return max(p0, p1); }
// CHECK: define noundef double @
// CHECK: call double @llvm.maxnum.f64(
double test_max_double(double p0, double p1) { return max(p0, p1); }
// CHECK: define noundef <2 x double> @
// CHECK: call <2 x double> @llvm.maxnum.v2f64
double2 test_max_double2(double2 p0, double2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x double> @
// CHECK: call <3 x double> @llvm.maxnum.v3f64
double3 test_max_double3(double3 p0, double3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x double> @
// CHECK: call <4 x double> @llvm.maxnum.v4f64
double4 test_max_double4(double4 p0, double4 p1) { return max(p0, p1); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
#ifdef __HLSL_ENABLE_16_BIT
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.smax.i16(
int16_t test_max_short(int16_t p0, int16_t p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.smax.v2i16(
int16_t2 test_max_short2(int16_t2 p0, int16_t2 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.smax.v3i16
int16_t3 test_max_short3(int16_t3 p0, int16_t3 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.smax.v4i16
int16_t4 test_max_short4(int16_t4 p0, int16_t4 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef i16 @
// NATIVE_HALF: call i16 @llvm.umax.i16(
uint16_t test_max_ushort(uint16_t p0, uint16_t p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <2 x i16> @
// NATIVE_HALF: call <2 x i16> @llvm.umax.v2i16
uint16_t2 test_max_ushort2(uint16_t2 p0, uint16_t2 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <3 x i16> @
// NATIVE_HALF: call <3 x i16> @llvm.umax.v3i16
uint16_t3 test_max_ushort3(uint16_t3 p0, uint16_t3 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <4 x i16> @
// NATIVE_HALF: call <4 x i16> @llvm.umax.v4i16
uint16_t4 test_max_ushort4(uint16_t4 p0, uint16_t4 p1) { return max(p0, p1); }
#endif
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.smax.i32(
int test_max_int(int p0, int p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.smax.v2i32
int2 test_max_int2(int2 p0, int2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.smax.v3i32
int3 test_max_int3(int3 p0, int3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.smax.v4i32
int4 test_max_int4(int4 p0, int4 p1) { return max(p0, p1); }
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.umax.i32(
int test_max_uint(uint p0, uint p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.umax.v2i32
uint2 test_max_uint2(uint2 p0, uint2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.umax.v3i32
uint3 test_max_uint3(uint3 p0, uint3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.umax.v4i32
uint4 test_max_uint4(uint4 p0, uint4 p1) { return max(p0, p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.smax.i64(
int64_t test_max_long(int64_t p0, int64_t p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.smax.v2i64
int64_t2 test_max_long2(int64_t2 p0, int64_t2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.smax.v3i64
int64_t3 test_max_long3(int64_t3 p0, int64_t3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.smax.v4i64
int64_t4 test_max_long4(int64_t4 p0, int64_t4 p1) { return max(p0, p1); }
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.umax.i64(
uint64_t test_max_long(uint64_t p0, uint64_t p1) { return max(p0, p1); }
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.umax.v2i64
uint64_t2 test_max_long2(uint64_t2 p0, uint64_t2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.umax.v3i64
uint64_t3 test_max_long3(uint64_t3 p0, uint64_t3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.umax.v4i64
uint64_t4 test_max_long4(uint64_t4 p0, uint64_t4 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.maxnum.f16(
// NO_HALF: define noundef float @"?test_max_half
// NO_HALF: call float @llvm.maxnum.f32(
half test_max_half(half p0, half p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.maxnum.v2f16
// NO_HALF: define noundef <2 x float> @"?test_max_half2
// NO_HALF: call <2 x float> @llvm.maxnum.v2f32(
half2 test_max_half2(half2 p0, half2 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.maxnum.v3f16
// NO_HALF: define noundef <3 x float> @"?test_max_half3
// NO_HALF: call <3 x float> @llvm.maxnum.v3f32(
half3 test_max_half3(half3 p0, half3 p1) { return max(p0, p1); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.maxnum.v4f16
// NO_HALF: define noundef <4 x float> @"?test_max_half4
// NO_HALF: call <4 x float> @llvm.maxnum.v4f32(
half4 test_max_half4(half4 p0, half4 p1) { return max(p0, p1); }
// CHECK: define noundef float @"?test_max_float
// CHECK: call float @llvm.maxnum.f32(
float test_max_float(float p0, float p1) { return max(p0, p1); }
// CHECK: define noundef <2 x float> @"?test_max_float2
// CHECK: call <2 x float> @llvm.maxnum.v2f32
float2 test_max_float2(float2 p0, float2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x float> @"?test_max_float3
// CHECK: call <3 x float> @llvm.maxnum.v3f32
float3 test_max_float3(float3 p0, float3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x float> @"?test_max_float4
// CHECK: call <4 x float> @llvm.maxnum.v4f32
float4 test_max_float4(float4 p0, float4 p1) { return max(p0, p1); }
// CHECK: define noundef double @
// CHECK: call double @llvm.maxnum.f64(
double test_max_double(double p0, double p1) { return max(p0, p1); }
// CHECK: define noundef <2 x double> @
// CHECK: call <2 x double> @llvm.maxnum.v2f64
double2 test_max_double2(double2 p0, double2 p1) { return max(p0, p1); }
// CHECK: define noundef <3 x double> @
// CHECK: call <3 x double> @llvm.maxnum.v3f64
double3 test_max_double3(double3 p0, double3 p1) { return max(p0, p1); }
// CHECK: define noundef <4 x double> @
// CHECK: call <4 x double> @llvm.maxnum.v4f64
double4 test_max_double4(double4 p0, double4 p1) { return max(p0, p1); }

View File

@ -1,41 +1,41 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.pow.f16(
// NO_HALF: define noundef float @"?test_pow_half
// NO_HALF: call float @llvm.pow.f32(
half test_pow_half(half p0, half p1) { return pow(p0, p1); }
// NATIVE_HALF: define noundef <2 x half> @"?test_pow_half2
// NATIVE_HALF: call <2 x half> @llvm.pow.v2f16
// NO_HALF: define noundef <2 x float> @"?test_pow_half2
// NO_HALF: call <2 x float> @llvm.pow.v2f32(
half2 test_pow_half2(half2 p0, half2 p1) { return pow(p0, p1); }
// NATIVE_HALF: define noundef <3 x half> @"?test_pow_half3
// NATIVE_HALF: call <3 x half> @llvm.pow.v3f16
// NO_HALF: define noundef <3 x float> @"?test_pow_half3
// NO_HALF: call <3 x float> @llvm.pow.v3f32(
half3 test_pow_half3(half3 p0, half3 p1) { return pow(p0, p1); }
// NATIVE_HALF: define noundef <4 x half> @"?test_pow_half4
// NATIVE_HALF: call <4 x half> @llvm.pow.v4f16
// NO_HALF: define noundef <4 x float> @"?test_pow_half4
// NO_HALF: call <4 x float> @llvm.pow.v4f32(
half4 test_pow_half4(half4 p0, half4 p1) { return pow(p0, p1); }
// CHECK: define noundef float @"?test_pow_float
// CHECK: call float @llvm.pow.f32(
float test_pow_float(float p0, float p1) { return pow(p0, p1); }
// CHECK: define noundef <2 x float> @"?test_pow_float2
// CHECK: call <2 x float> @llvm.pow.v2f32
float2 test_pow_float2(float2 p0, float2 p1) { return pow(p0, p1); }
// CHECK: define noundef <3 x float> @"?test_pow_float3
// CHECK: call <3 x float> @llvm.pow.v3f32
float3 test_pow_float3(float3 p0, float3 p1) { return pow(p0, p1); }
// CHECK: define noundef <4 x float> @"?test_pow_float4
// CHECK: call <4 x float> @llvm.pow.v4f32
float4 test_pow_float4(float4 p0, float4 p1) { return pow(p0, p1); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.pow.f16(
// NO_HALF: define noundef float @"?test_pow_half
// NO_HALF: call float @llvm.pow.f32(
half test_pow_half(half p0, half p1) { return pow(p0, p1); }
// NATIVE_HALF: define noundef <2 x half> @"?test_pow_half2
// NATIVE_HALF: call <2 x half> @llvm.pow.v2f16
// NO_HALF: define noundef <2 x float> @"?test_pow_half2
// NO_HALF: call <2 x float> @llvm.pow.v2f32(
half2 test_pow_half2(half2 p0, half2 p1) { return pow(p0, p1); }
// NATIVE_HALF: define noundef <3 x half> @"?test_pow_half3
// NATIVE_HALF: call <3 x half> @llvm.pow.v3f16
// NO_HALF: define noundef <3 x float> @"?test_pow_half3
// NO_HALF: call <3 x float> @llvm.pow.v3f32(
half3 test_pow_half3(half3 p0, half3 p1) { return pow(p0, p1); }
// NATIVE_HALF: define noundef <4 x half> @"?test_pow_half4
// NATIVE_HALF: call <4 x half> @llvm.pow.v4f16
// NO_HALF: define noundef <4 x float> @"?test_pow_half4
// NO_HALF: call <4 x float> @llvm.pow.v4f32(
half4 test_pow_half4(half4 p0, half4 p1) { return pow(p0, p1); }
// CHECK: define noundef float @"?test_pow_float
// CHECK: call float @llvm.pow.f32(
float test_pow_float(float p0, float p1) { return pow(p0, p1); }
// CHECK: define noundef <2 x float> @"?test_pow_float2
// CHECK: call <2 x float> @llvm.pow.v2f32
float2 test_pow_float2(float2 p0, float2 p1) { return pow(p0, p1); }
// CHECK: define noundef <3 x float> @"?test_pow_float3
// CHECK: call <3 x float> @llvm.pow.v3f32
float3 test_pow_float3(float3 p0, float3 p1) { return pow(p0, p1); }
// CHECK: define noundef <4 x float> @"?test_pow_float4
// CHECK: call <4 x float> @llvm.pow.v4f32
float4 test_pow_float4(float4 p0, float4 p1) { return pow(p0, p1); }

View File

@ -1,80 +1,80 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s
#ifdef __HLSL_ENABLE_16_BIT
// CHECK: define noundef i16 @
// CHECK: call i16 @llvm.bitreverse.i16(
uint16_t test_bitreverse_ushort(uint16_t p0)
{
return reversebits(p0);
}
// CHECK: define noundef <2 x i16> @
// CHECK: call <2 x i16> @llvm.bitreverse.v2i16
uint16_t2 test_bitreverse_ushort2(uint16_t2 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <3 x i16> @
// CHECK: call <3 x i16> @llvm.bitreverse.v3i16
uint16_t3 test_bitreverse_ushort3(uint16_t3 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <4 x i16> @
// CHECK: call <4 x i16> @llvm.bitreverse.v4i16
uint16_t4 test_bitreverse_ushort4(uint16_t4 p0)
{
return reversebits(p0);
}
#endif
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.bitreverse.i32(
int test_bitreverse_uint(uint p0)
{
return reversebits(p0);
}
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.bitreverse.v2i32
uint2 test_bitreverse_uint2(uint2 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.bitreverse.v3i32
uint3 test_bitreverse_uint3(uint3 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.bitreverse.v4i32
uint4 test_bitreverse_uint4(uint4 p0)
{
return reversebits(p0);
}
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.bitreverse.i64(
uint64_t test_bitreverse_long(uint64_t p0)
{
return reversebits(p0);
}
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.bitreverse.v2i64
uint64_t2 test_bitreverse_long2(uint64_t2 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.bitreverse.v3i64
uint64_t3 test_bitreverse_long3(uint64_t3 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.bitreverse.v4i64
uint64_t4 test_bitreverse_long4(uint64_t4 p0)
{
return reversebits(p0);
}
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s
#ifdef __HLSL_ENABLE_16_BIT
// CHECK: define noundef i16 @
// CHECK: call i16 @llvm.bitreverse.i16(
uint16_t test_bitreverse_ushort(uint16_t p0)
{
return reversebits(p0);
}
// CHECK: define noundef <2 x i16> @
// CHECK: call <2 x i16> @llvm.bitreverse.v2i16
uint16_t2 test_bitreverse_ushort2(uint16_t2 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <3 x i16> @
// CHECK: call <3 x i16> @llvm.bitreverse.v3i16
uint16_t3 test_bitreverse_ushort3(uint16_t3 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <4 x i16> @
// CHECK: call <4 x i16> @llvm.bitreverse.v4i16
uint16_t4 test_bitreverse_ushort4(uint16_t4 p0)
{
return reversebits(p0);
}
#endif
// CHECK: define noundef i32 @
// CHECK: call i32 @llvm.bitreverse.i32(
int test_bitreverse_uint(uint p0)
{
return reversebits(p0);
}
// CHECK: define noundef <2 x i32> @
// CHECK: call <2 x i32> @llvm.bitreverse.v2i32
uint2 test_bitreverse_uint2(uint2 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <3 x i32> @
// CHECK: call <3 x i32> @llvm.bitreverse.v3i32
uint3 test_bitreverse_uint3(uint3 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <4 x i32> @
// CHECK: call <4 x i32> @llvm.bitreverse.v4i32
uint4 test_bitreverse_uint4(uint4 p0)
{
return reversebits(p0);
}
// CHECK: define noundef i64 @
// CHECK: call i64 @llvm.bitreverse.i64(
uint64_t test_bitreverse_long(uint64_t p0)
{
return reversebits(p0);
}
// CHECK: define noundef <2 x i64> @
// CHECK: call <2 x i64> @llvm.bitreverse.v2i64
uint64_t2 test_bitreverse_long2(uint64_t2 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <3 x i64> @
// CHECK: call <3 x i64> @llvm.bitreverse.v3i64
uint64_t3 test_bitreverse_long3(uint64_t3 p0)
{
return reversebits(p0);
}
// CHECK: define noundef <4 x i64> @
// CHECK: call <4 x i64> @llvm.bitreverse.v4i64
uint64_t4 test_bitreverse_long4(uint64_t4 p0)
{
return reversebits(p0);
}

View File

@ -1,41 +1,41 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.sin.f16(
// NO_HALF: define noundef float @"?test_sin_half@@YA$halff@$halff@@Z"(
// NO_HALF: call float @llvm.sin.f32(
half test_sin_half(half p0) { return sin(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.sin.v2f16
// NO_HALF: define noundef <2 x float> @"?test_sin_half2
// NO_HALF: call <2 x float> @llvm.sin.v2f32(
half2 test_sin_half2(half2 p0) { return sin(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.sin.v3f16
// NO_HALF: define noundef <3 x float> @"?test_sin_half3
// NO_HALF: call <3 x float> @llvm.sin.v3f32(
half3 test_sin_half3(half3 p0) { return sin(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.sin.v4f16
// NO_HALF: define noundef <4 x float> @"?test_sin_half4
// NO_HALF: call <4 x float> @llvm.sin.v4f32(
half4 test_sin_half4(half4 p0) { return sin(p0); }
// CHECK: define noundef float @
// CHECK: call float @llvm.sin.f32(
float test_sin_float(float p0) { return sin(p0); }
// CHECK: define noundef <2 x float> @
// CHECK: call <2 x float> @llvm.sin.v2f32
float2 test_sin_float2(float2 p0) { return sin(p0); }
// CHECK: define noundef <3 x float> @
// CHECK: call <3 x float> @llvm.sin.v3f32
float3 test_sin_float3(float3 p0) { return sin(p0); }
// CHECK: define noundef <4 x float> @
// CHECK: call <4 x float> @llvm.sin.v4f32
float4 test_sin_float4(float4 p0) { return sin(p0); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @
// NATIVE_HALF: call half @llvm.sin.f16(
// NO_HALF: define noundef float @"?test_sin_half@@YA$halff@$halff@@Z"(
// NO_HALF: call float @llvm.sin.f32(
half test_sin_half(half p0) { return sin(p0); }
// NATIVE_HALF: define noundef <2 x half> @
// NATIVE_HALF: call <2 x half> @llvm.sin.v2f16
// NO_HALF: define noundef <2 x float> @"?test_sin_half2
// NO_HALF: call <2 x float> @llvm.sin.v2f32(
half2 test_sin_half2(half2 p0) { return sin(p0); }
// NATIVE_HALF: define noundef <3 x half> @
// NATIVE_HALF: call <3 x half> @llvm.sin.v3f16
// NO_HALF: define noundef <3 x float> @"?test_sin_half3
// NO_HALF: call <3 x float> @llvm.sin.v3f32(
half3 test_sin_half3(half3 p0) { return sin(p0); }
// NATIVE_HALF: define noundef <4 x half> @
// NATIVE_HALF: call <4 x half> @llvm.sin.v4f16
// NO_HALF: define noundef <4 x float> @"?test_sin_half4
// NO_HALF: call <4 x float> @llvm.sin.v4f32(
half4 test_sin_half4(half4 p0) { return sin(p0); }
// CHECK: define noundef float @
// CHECK: call float @llvm.sin.f32(
float test_sin_float(float p0) { return sin(p0); }
// CHECK: define noundef <2 x float> @
// CHECK: call <2 x float> @llvm.sin.v2f32
float2 test_sin_float2(float2 p0) { return sin(p0); }
// CHECK: define noundef <3 x float> @
// CHECK: call <3 x float> @llvm.sin.v3f32
float3 test_sin_float3(float3 p0) { return sin(p0); }
// CHECK: define noundef <4 x float> @
// CHECK: call <4 x float> @llvm.sin.v4f32
float4 test_sin_float4(float4 p0) { return sin(p0); }

View File

@ -1,47 +1,47 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @"?test_trunc_half
// NATIVE_HALF: call half @llvm.trunc.f16(
// NO_HALF: define noundef float @"?test_trunc_half
// NO_HALF: call float @llvm.trunc.f32(
half test_trunc_half(half p0) { return trunc(p0); }
// NATIVE_HALF: define noundef <2 x half> @"?test_trunc_half2
// NATIVE_HALF: call <2 x half> @llvm.trunc.v2f16
// NO_HALF: define noundef <2 x float> @"?test_trunc_half2
// NO_HALF: call <2 x float> @llvm.trunc.v2f32(
half2 test_trunc_half2(half2 p0) { return trunc(p0); }
// NATIVE_HALF: define noundef <3 x half> @"?test_trunc_half3
// NATIVE_HALF: call <3 x half> @llvm.trunc.v3f16
// NO_HALF: define noundef <3 x float> @"?test_trunc_half3
// NO_HALF: call <3 x float> @llvm.trunc.v3f32(
half3 test_trunc_half3(half3 p0) { return trunc(p0); }
// NATIVE_HALF: define noundef <4 x half> @"?test_trunc_half4
// NATIVE_HALF: call <4 x half> @llvm.trunc.v4f16
// NO_HALF: define noundef <4 x float> @"?test_trunc_half4
// NO_HALF: call <4 x float> @llvm.trunc.v4f32(
half4 test_trunc_half4(half4 p0) { return trunc(p0); }
// CHECK: define noundef float @"?test_trunc_float
// CHECK: call float @llvm.trunc.f32(
float test_trunc_float(float p0) { return trunc(p0); }
// CHECK: define noundef <2 x float> @"?test_trunc_float2
// CHECK: call <2 x float> @llvm.trunc.v2f32
float2 test_trunc_float2(float2 p0) { return trunc(p0); }
// CHECK: define noundef <3 x float> @"?test_trunc_float3
// CHECK: call <3 x float> @llvm.trunc.v3f32
float3 test_trunc_float3(float3 p0) { return trunc(p0); }
// CHECK: define noundef <4 x float> @"?test_trunc_float4
// CHECK: call <4 x float> @llvm.trunc.v4f32
float4 test_trunc_float4(float4 p0) { return trunc(p0); }
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
// RUN: --check-prefixes=CHECK,NATIVE_HALF
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
// NATIVE_HALF: define noundef half @"?test_trunc_half
// NATIVE_HALF: call half @llvm.trunc.f16(
// NO_HALF: define noundef float @"?test_trunc_half
// NO_HALF: call float @llvm.trunc.f32(
half test_trunc_half(half p0) { return trunc(p0); }
// NATIVE_HALF: define noundef <2 x half> @"?test_trunc_half2
// NATIVE_HALF: call <2 x half> @llvm.trunc.v2f16
// NO_HALF: define noundef <2 x float> @"?test_trunc_half2
// NO_HALF: call <2 x float> @llvm.trunc.v2f32(
half2 test_trunc_half2(half2 p0) { return trunc(p0); }
// NATIVE_HALF: define noundef <3 x half> @"?test_trunc_half3
// NATIVE_HALF: call <3 x half> @llvm.trunc.v3f16
// NO_HALF: define noundef <3 x float> @"?test_trunc_half3
// NO_HALF: call <3 x float> @llvm.trunc.v3f32(
half3 test_trunc_half3(half3 p0) { return trunc(p0); }
// NATIVE_HALF: define noundef <4 x half> @"?test_trunc_half4
// NATIVE_HALF: call <4 x half> @llvm.trunc.v4f16
// NO_HALF: define noundef <4 x float> @"?test_trunc_half4
// NO_HALF: call <4 x float> @llvm.trunc.v4f32(
half4 test_trunc_half4(half4 p0) { return trunc(p0); }
// CHECK: define noundef float @"?test_trunc_float
// CHECK: call float @llvm.trunc.f32(
float test_trunc_float(float p0) { return trunc(p0); }
// CHECK: define noundef <2 x float> @"?test_trunc_float2
// CHECK: call <2 x float> @llvm.trunc.v2f32
float2 test_trunc_float2(float2 p0) { return trunc(p0); }
// CHECK: define noundef <3 x float> @"?test_trunc_float3
// CHECK: call <3 x float> @llvm.trunc.v3f32
float3 test_trunc_float3(float3 p0) { return trunc(p0); }
// CHECK: define noundef <4 x float> @"?test_trunc_float4
// CHECK: call <4 x float> @llvm.trunc.v4f32
float4 test_trunc_float4(float4 p0) { return trunc(p0); }

View File

@ -1,25 +1,25 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL
// RUN: %clang_cc1 -triple spirv-linux-vulkan-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV
// Make sure SV_DispatchThreadID translated into dx.thread.id.
// CHECK: define void @foo()
// CHECK-DXIL: %[[#ID:]] = call i32 @llvm.dx.thread.id(i32 0)
// CHECK-SPIRV: %[[#ID:]] = call i32 @llvm.spv.thread.id(i32 0)
// CHECK: call void @{{.*}}foo{{.*}}(i32 %[[#ID]])
[shader("compute")]
[numthreads(8,8,1)]
void foo(uint Idx : SV_DispatchThreadID) {}
// CHECK: define void @bar()
// CHECK-DXIL: %[[#ID_X:]] = call i32 @llvm.dx.thread.id(i32 0)
// CHECK-SPIRV: %[[#ID_X:]] = call i32 @llvm.spv.thread.id(i32 0)
// CHECK: %[[#ID_X_:]] = insertelement <2 x i32> poison, i32 %[[#ID_X]], i64 0
// CHECK-DXIL: %[[#ID_Y:]] = call i32 @llvm.dx.thread.id(i32 1)
// CHECK-SPIRV: %[[#ID_Y:]] = call i32 @llvm.spv.thread.id(i32 1)
// CHECK: %[[#ID_XY:]] = insertelement <2 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1
// CHECK-DXIL: call void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]])
[shader("compute")]
[numthreads(8,8,1)]
void bar(uint2 Idx : SV_DispatchThreadID) {}
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL
// RUN: %clang_cc1 -triple spirv-linux-vulkan-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV
// Make sure SV_DispatchThreadID translated into dx.thread.id.
// CHECK: define void @foo()
// CHECK-DXIL: %[[#ID:]] = call i32 @llvm.dx.thread.id(i32 0)
// CHECK-SPIRV: %[[#ID:]] = call i32 @llvm.spv.thread.id(i32 0)
// CHECK: call void @{{.*}}foo{{.*}}(i32 %[[#ID]])
[shader("compute")]
[numthreads(8,8,1)]
void foo(uint Idx : SV_DispatchThreadID) {}
// CHECK: define void @bar()
// CHECK-DXIL: %[[#ID_X:]] = call i32 @llvm.dx.thread.id(i32 0)
// CHECK-SPIRV: %[[#ID_X:]] = call i32 @llvm.spv.thread.id(i32 0)
// CHECK: %[[#ID_X_:]] = insertelement <2 x i32> poison, i32 %[[#ID_X]], i64 0
// CHECK-DXIL: %[[#ID_Y:]] = call i32 @llvm.dx.thread.id(i32 1)
// CHECK-SPIRV: %[[#ID_Y:]] = call i32 @llvm.spv.thread.id(i32 1)
// CHECK: %[[#ID_XY:]] = insertelement <2 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1
// CHECK-DXIL: call void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]])
[shader("compute")]
[numthreads(8,8,1)]
void bar(uint2 Idx : SV_DispatchThreadID) {}

View File

@ -1,22 +1,22 @@
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
// FIXME: add semantic to a.
// See https://github.com/llvm/llvm-project/issues/57874
struct S {
float a;
};
// Make sure sret parameter is generated.
// CHECK:define internal void @"?ps_main@@YA?AUS@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S) align 4 %agg.result)
// FIXME: change it to real value instead of poison value once semantic is add to a.
// Make sure the function with sret is called.
// CHECK:call void @"?ps_main@@YA?AUS@@XZ"(ptr poison)
[shader("pixel")]
S ps_main() {
S s;
s.a = 0;
return s;
};
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
// FIXME: add semantic to a.
// See https://github.com/llvm/llvm-project/issues/57874
struct S {
float a;
};
// Make sure sret parameter is generated.
// CHECK:define internal void @"?ps_main@@YA?AUS@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S) align 4 %agg.result)
// FIXME: change it to real value instead of poison value once semantic is add to a.
// Make sure the function with sret is called.
// CHECK:call void @"?ps_main@@YA?AUS@@XZ"(ptr poison)
[shader("pixel")]
S ps_main() {
S s;
s.a = 0;
return s;
};

View File

@ -1,55 +1,55 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -disable-llvm-passes -o - -std=hlsl202x %s | FileCheck %s
struct Pair {
int First;
int Second;
int getFirst() {
Pair Another = {5, 10};
this = Another;
return this.First;
}
int getSecond() {
this = Pair();
return Second;
}
void operator=(Pair P) {
First = P.First;
Second = 2;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// This test makes a probably safe assumption that HLSL 202x includes operator overloading for assignment operators.
// CHECK: define linkonce_odr noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #2 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%Another = alloca %struct.Pair, align 4
// CHECK-NEXT:%agg.tmp = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:%First = getelementptr inbounds %struct.Pair, ptr %Another, i32 0, i32 0
// CHECK-NEXT:store i32 5, ptr %First, align 4
// CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %Another, i32 0, i32 1
// CHECK-NEXT:store i32 10, ptr %Second, align 4
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %agg.tmp, ptr align 4 %Another, i32 8, i1 false)
// CHECK-NEXT:call void @"??4Pair@@QAAXU0@@Z"(ptr noundef nonnull align 4 dereferenceable(8) %this1, ptr noundef byval(%struct.Pair) align 4 %agg.tmp)
// CHECK-NEXT:%First2 = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 0
// CHECK-NEXT:%0 = load i32, ptr %First2, align 4
// CHECK-NEXT:ret i32 %0
// CHECK: define linkonce_odr noundef i32 @"?getSecond@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #2 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%agg.tmp = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:call void @llvm.memset.p0.i32(ptr align 4 %agg.tmp, i8 0, i32 8, i1 false)
// CHECK-NEXT:call void @"??4Pair@@QAAXU0@@Z"(ptr noundef nonnull align 4 dereferenceable(8) %this1, ptr noundef byval(%struct.Pair) align 4 %agg.tmp)
// CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 1
// CHECK-NEXT:%0 = load i32, ptr %Second, align 4
// CHECK-NEXT:ret i32 %0
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -disable-llvm-passes -o - -std=hlsl202x %s | FileCheck %s
struct Pair {
int First;
int Second;
int getFirst() {
Pair Another = {5, 10};
this = Another;
return this.First;
}
int getSecond() {
this = Pair();
return Second;
}
void operator=(Pair P) {
First = P.First;
Second = 2;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// This test makes a probably safe assumption that HLSL 202x includes operator overloading for assignment operators.
// CHECK: define linkonce_odr noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #2 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%Another = alloca %struct.Pair, align 4
// CHECK-NEXT:%agg.tmp = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:%First = getelementptr inbounds %struct.Pair, ptr %Another, i32 0, i32 0
// CHECK-NEXT:store i32 5, ptr %First, align 4
// CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %Another, i32 0, i32 1
// CHECK-NEXT:store i32 10, ptr %Second, align 4
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %agg.tmp, ptr align 4 %Another, i32 8, i1 false)
// CHECK-NEXT:call void @"??4Pair@@QAAXU0@@Z"(ptr noundef nonnull align 4 dereferenceable(8) %this1, ptr noundef byval(%struct.Pair) align 4 %agg.tmp)
// CHECK-NEXT:%First2 = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 0
// CHECK-NEXT:%0 = load i32, ptr %First2, align 4
// CHECK-NEXT:ret i32 %0
// CHECK: define linkonce_odr noundef i32 @"?getSecond@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #2 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%agg.tmp = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:call void @llvm.memset.p0.i32(ptr align 4 %agg.tmp, i8 0, i32 8, i1 false)
// CHECK-NEXT:call void @"??4Pair@@QAAXU0@@Z"(ptr noundef nonnull align 4 dereferenceable(8) %this1, ptr noundef byval(%struct.Pair) align 4 %agg.tmp)
// CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 1
// CHECK-NEXT:%0 = load i32, ptr %Second, align 4
// CHECK-NEXT:ret i32 %0

View File

@ -1,45 +1,45 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
struct Pair {
int First;
int Second;
int getFirst() {
Pair Another = {5, 10};
this = Another;
return this.First;
}
int getSecond() {
this = Pair();
return Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2.0};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// This tests reference like implicit this in HLSL
// CHECK: define linkonce_odr noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #3 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%Another = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %Another, ptr align 4 @"__const.?getFirst@Pair@@QAAHXZ.Another", i32 8, i1 false)
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4 %Another, i32 8, i1 false)
// CHECK-NEXT:%First = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 0
// CHECK: define linkonce_odr noundef i32 @"?getSecond@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #3 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%ref.tmp = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:call void @llvm.memset.p0.i32(ptr align 4 %ref.tmp, i8 0, i32 8, i1 false)
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4 %ref.tmp, i32 8, i1 false)
// CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 1
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
struct Pair {
int First;
int Second;
int getFirst() {
Pair Another = {5, 10};
this = Another;
return this.First;
}
int getSecond() {
this = Pair();
return Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2.0};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// This tests reference like implicit this in HLSL
// CHECK: define linkonce_odr noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #3 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%Another = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %Another, ptr align 4 @"__const.?getFirst@Pair@@QAAHXZ.Another", i32 8, i1 false)
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4 %Another, i32 8, i1 false)
// CHECK-NEXT:%First = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 0
// CHECK: define linkonce_odr noundef i32 @"?getSecond@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #3 align 2 {
// CHECK-NEXT:entry:
// CHECK-NEXT:%this.addr = alloca ptr, align 4
// CHECK-NEXT:%ref.tmp = alloca %struct.Pair, align 4
// CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
// CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
// CHECK-NEXT:call void @llvm.memset.p0.i32(ptr align 4 %ref.tmp, i8 0, i32 8, i1 false)
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4 %ref.tmp, i32 8, i1 false)
// CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 1

View File

@ -1,34 +1,34 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s -debug-info-kind=standalone -dwarf-version=4 | FileCheck %s
struct Pair {
int First;
float Second;
int getFirst() {
return this.First;
}
float getSecond() {
return Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2.0};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// This tests reference like `this` in HLSL
// CHECK: %call = call noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %Vals)
// CHECK-NEXT: %First = getelementptr inbounds %struct.Pair, ptr %Vals, i32 0, i32 0
// CHECK-NEXT: store i32 %call, ptr %First, align 4
// CHECK-NEXT: %call1 = call noundef float @"?getSecond@Pair@@QAAMXZ"(ptr noundef nonnull align 4 dereferenceable(8) %Vals)
// CHECK-NEXT: %Second = getelementptr inbounds %struct.Pair, ptr %Vals, i32 0, i32 1
// CHECK: [[Pair:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Pair"
// CHECK: [[getFirst:![0-9]+]] = distinct !DISubprogram(name: "getFirst"
// CHECK-SAME: scope: [[Pair]]
// CHECK: [[FirstThis:![0-9]+]] = !DILocalVariable(name: "this", arg: 1, scope: [[getFirst]], type: [[thisType:![0-9]+]]
// CHECK: [[thisType]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: [[Pair]], size: 32)
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s -debug-info-kind=standalone -dwarf-version=4 | FileCheck %s
struct Pair {
int First;
float Second;
int getFirst() {
return this.First;
}
float getSecond() {
return Second;
}
};
[numthreads(1, 1, 1)]
void main() {
Pair Vals = {1, 2.0};
Vals.First = Vals.getFirst();
Vals.Second = Vals.getSecond();
}
// This tests reference like `this` in HLSL
// CHECK: %call = call noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %Vals)
// CHECK-NEXT: %First = getelementptr inbounds %struct.Pair, ptr %Vals, i32 0, i32 0
// CHECK-NEXT: store i32 %call, ptr %First, align 4
// CHECK-NEXT: %call1 = call noundef float @"?getSecond@Pair@@QAAMXZ"(ptr noundef nonnull align 4 dereferenceable(8) %Vals)
// CHECK-NEXT: %Second = getelementptr inbounds %struct.Pair, ptr %Vals, i32 0, i32 1
// CHECK: [[Pair:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Pair"
// CHECK: [[getFirst:![0-9]+]] = distinct !DISubprogram(name: "getFirst"
// CHECK-SAME: scope: [[Pair]]
// CHECK: [[FirstThis:![0-9]+]] = !DILocalVariable(name: "this", arg: 1, scope: [[getFirst]], type: [[thisType:![0-9]+]]
// CHECK: [[thisType]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: [[Pair]], size: 32)

View File

@ -1,53 +1,53 @@
// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -emit-llvm -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-MINGW-OBJC2 < %t %s
// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -emit-llvm -fobjc-runtime=gcc -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-MINGW-GCC < %t %s
// RUN: %clang_cc1 -triple x86_64-w64-windows-msvc -emit-llvm -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-MSVC-OBJC2 < %t %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-LINUX-OBJC2 < %t %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-LINUX-GCC < %t %s
@interface Foo @end
void throwing(void) {
@try
{
// CHECK-MINGW-OBJC2: personality ptr @__gxx_personality_seh0
// CHECK-MINGW-OBJC2: invoke void @objc_exception_throw
// CHECK-MINGW-GCC: personality ptr @__gnu_objc_personality_v0
// CHECK-MINGW-GCC: invoke void @objc_exception_throw
// CHECK-MSVC-OBJC2: personality ptr @__CxxFrameHandler3
// CHECK-MSVC-OBJC2: invoke void @objc_exception_throw
// CHECK-LINUX-OBJC2: personality ptr @__gnustep_objc_personality_v0
// CHECK-LINUX-OBJC2: invoke void @objc_exception_throw
// CHECK-LINUX-GCC: personality ptr @__gnu_objc_personality_v0
@throw(@"error!");
}
@catch(...)
{
// CHECK-MINGW-OBJC2: call ptr @__cxa_begin_catch
// CHECK-MINGW-OBJC2: invoke ptr @__cxa_rethrow
// CHECK-MINGW-OBJC2: invoke void @__cxa_end_catch
// CHECK-MINGW-GCC: call void @objc_exception_throw
// CHECK-MSVC-OBJC2: call void @objc_exception_rethrow
// CHECK-LINUX-OBJC2: call ptr @objc_begin_catch
// CHECK-LINUX-OBJC2: invoke void @objc_exception_throw
// CHECK-LINUX-OBJC2: invoke void @objc_end_catch()
// CHECK-LINUX-GCC: invoke void @objc_exception_throw
@throw;
}
}
// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -emit-llvm -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-MINGW-OBJC2 < %t %s
// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -emit-llvm -fobjc-runtime=gcc -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-MINGW-GCC < %t %s
// RUN: %clang_cc1 -triple x86_64-w64-windows-msvc -emit-llvm -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-MSVC-OBJC2 < %t %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-LINUX-OBJC2 < %t %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc -fexceptions -fobjc-exceptions -o %t %s
// RUN: FileCheck --check-prefixes=CHECK-LINUX-GCC < %t %s
@interface Foo @end
void throwing(void) {
@try
{
// CHECK-MINGW-OBJC2: personality ptr @__gxx_personality_seh0
// CHECK-MINGW-OBJC2: invoke void @objc_exception_throw
// CHECK-MINGW-GCC: personality ptr @__gnu_objc_personality_v0
// CHECK-MINGW-GCC: invoke void @objc_exception_throw
// CHECK-MSVC-OBJC2: personality ptr @__CxxFrameHandler3
// CHECK-MSVC-OBJC2: invoke void @objc_exception_throw
// CHECK-LINUX-OBJC2: personality ptr @__gnustep_objc_personality_v0
// CHECK-LINUX-OBJC2: invoke void @objc_exception_throw
// CHECK-LINUX-GCC: personality ptr @__gnu_objc_personality_v0
@throw(@"error!");
}
@catch(...)
{
// CHECK-MINGW-OBJC2: call ptr @__cxa_begin_catch
// CHECK-MINGW-OBJC2: invoke ptr @__cxa_rethrow
// CHECK-MINGW-OBJC2: invoke void @__cxa_end_catch
// CHECK-MINGW-GCC: call void @objc_exception_throw
// CHECK-MSVC-OBJC2: call void @objc_exception_rethrow
// CHECK-LINUX-OBJC2: call ptr @objc_begin_catch
// CHECK-LINUX-OBJC2: invoke void @objc_exception_throw
// CHECK-LINUX-OBJC2: invoke void @objc_end_catch()
// CHECK-LINUX-GCC: invoke void @objc_exception_throw
@throw;
}
}

View File

@ -1,29 +1,29 @@
// RUN: %clang -### -target x86_64-scei-ps4 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-scei-ps4 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-scei-ps4 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// RUN: %clang -### -x assembler -target x86_64-scei-ps4 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-scei-ps4 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-scei-ps4 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// RUN: %clang -### -target x86_64-sie-ps5 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-sie-ps5 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-sie-ps5 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// RUN: %clang -### -x assembler -target x86_64-sie-ps5 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-sie-ps5 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-sie-ps5 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// CHECK-NOT: "-mrelax-relocations
// UNSET: "-mrelax-relocations=no"
// RUN: %clang -### -target x86_64-scei-ps4 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-scei-ps4 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-scei-ps4 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// RUN: %clang -### -x assembler -target x86_64-scei-ps4 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-scei-ps4 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-scei-ps4 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// RUN: %clang -### -target x86_64-sie-ps5 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-sie-ps5 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -target x86_64-sie-ps5 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// RUN: %clang -### -x assembler -target x86_64-sie-ps5 %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-sie-ps5 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: %clang -### -x assembler -target x86_64-sie-ps5 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \
// RUN: FileCheck -check-prefix=UNSET %s
// CHECK-NOT: "-mrelax-relocations
// UNSET: "-mrelax-relocations=no"

View File

@ -1,15 +1,15 @@
// RUN: %clang_cl /E -Xclang -frewrite-includes -- %s | %clang_cl /c -Xclang -verify /Tp -
// expected-no-diagnostics
// This test uses dos-style \r\n line endings.
// Make sure your editor doesn't rewrite them to unix-style \n line endings.
int foo();
int bar();
#define HELLO \
foo(); \
bar();
int main() {
HELLO
return 0;
}
// RUN: %clang_cl /E -Xclang -frewrite-includes -- %s | %clang_cl /c -Xclang -verify /Tp -
// expected-no-diagnostics
// This test uses dos-style \r\n line endings.
// Make sure your editor doesn't rewrite them to unix-style \n line endings.
int foo();
int bar();
#define HELLO \
foo(); \
bar();
int main() {
HELLO
return 0;
}

View File

@ -1,8 +1,8 @@
// Test double slashes in #include directive along with angle brackets. Previously, this was interpreted as comments.
// RUN: %clang_cc1 -DTEST -print-dependency-directives-minimized-source %s 2>&1 | FileCheck %s
#include "a//b.h"
#include <a//b.h>
// CHECK: #include "a//b.h"
// CHECK: #include <a//b.h>
// Test double slashes in #include directive along with angle brackets. Previously, this was interpreted as comments.
// RUN: %clang_cc1 -DTEST -print-dependency-directives-minimized-source %s 2>&1 | FileCheck %s
#include "a//b.h"
#include <a//b.h>
// CHECK: #include "a//b.h"
// CHECK: #include <a//b.h>

View File

@ -1,10 +1,10 @@
// Test UTF8 BOM at start of file
// RUN: printf '\xef\xbb\xbf' > %t.c
// RUN: echo '#ifdef TEST\n' >> %t.c
// RUN: echo '#include <string>' >> %t.c
// RUN: echo '#endif' >> %t.c
// RUN: %clang_cc1 -DTEST -print-dependency-directives-minimized-source %t.c 2>&1 | FileCheck %s
// CHECK: #ifdef TEST
// CHECK-NEXT: #include <string>
// CHECK-NEXT: #endif
// Test UTF8 BOM at start of file
// RUN: printf '\xef\xbb\xbf' > %t.c
// RUN: echo '#ifdef TEST\n' >> %t.c
// RUN: echo '#include <string>' >> %t.c
// RUN: echo '#endif' >> %t.c
// RUN: %clang_cc1 -DTEST -print-dependency-directives-minimized-source %t.c 2>&1 | FileCheck %s
// CHECK: #ifdef TEST
// CHECK-NEXT: #include <string>
// CHECK-NEXT: #endif

View File

@ -1,20 +1,20 @@
// RUN: %clang_dxc -T lib_6_4 -HV 2016 %s 2>&1 -### | FileCheck -check-prefix=2016 %s
// RUN: %clang_dxc -T lib_6_4 -HV 2017 %s 2>&1 -### | FileCheck -check-prefix=2017 %s
// RUN: %clang_dxc -T lib_6_4 /HV 2018 %s 2>&1 -### | FileCheck -check-prefix=2018 %s
// RUN: %clang_dxc -T lib_6_4 /HV 2021 %s 2>&1 -### | FileCheck -check-prefix=2021 %s
// RUN: %clang_dxc -T lib_6_4 /HV 202x %s 2>&1 -### | FileCheck -check-prefix=202x %s
// RUN: %clang_dxc -T lib_6_4 %s 2>&1 -### | FileCheck -check-prefix=NO_HV %s
// RUN: not %clang_dxc -T lib_6_4 /HV gibberish -### %s 2>&1 | FileCheck -check-prefix=CHECK-ERR %s
// 2016: "-std=hlsl2016"
// 2017: "-std=hlsl2017"
// 2018: "-std=hlsl2018"
// 2021: "-std=hlsl2021"
// 202x: "-std=hlsl202x"
// NO_HV-NOT: "-std="
// CHECK-ERR: error: invalid value 'gibberish' in 'HV'
float4 main(float4 a : A) : SV_TARGET
{
return -a.yxxx;
}
// RUN: %clang_dxc -T lib_6_4 -HV 2016 %s 2>&1 -### | FileCheck -check-prefix=2016 %s
// RUN: %clang_dxc -T lib_6_4 -HV 2017 %s 2>&1 -### | FileCheck -check-prefix=2017 %s
// RUN: %clang_dxc -T lib_6_4 /HV 2018 %s 2>&1 -### | FileCheck -check-prefix=2018 %s
// RUN: %clang_dxc -T lib_6_4 /HV 2021 %s 2>&1 -### | FileCheck -check-prefix=2021 %s
// RUN: %clang_dxc -T lib_6_4 /HV 202x %s 2>&1 -### | FileCheck -check-prefix=202x %s
// RUN: %clang_dxc -T lib_6_4 %s 2>&1 -### | FileCheck -check-prefix=NO_HV %s
// RUN: not %clang_dxc -T lib_6_4 /HV gibberish -### %s 2>&1 | FileCheck -check-prefix=CHECK-ERR %s
// 2016: "-std=hlsl2016"
// 2017: "-std=hlsl2017"
// 2018: "-std=hlsl2018"
// 2021: "-std=hlsl2021"
// 202x: "-std=hlsl202x"
// NO_HV-NOT: "-std="
// CHECK-ERR: error: invalid value 'gibberish' in 'HV'
float4 main(float4 a : A) : SV_TARGET
{
return -a.yxxx;
}

View File

@ -1,25 +1,25 @@
// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 -HV 2016 %s 2>&1 | FileCheck -check-prefix=both_invalid %s
// RUN: not %clang_dxc -enable-16bit-types -T lib_6_4 -HV 2017 %s 2>&1 | FileCheck -check-prefix=HV_invalid_2017 %s
// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 /HV 2021 %s 2>&1 | FileCheck -check-prefix=TP_invalid %s
// RUN: %clang_dxc -enable-16bit-types -T lib_6_4 /HV 2018 %s 2>&1 -### | FileCheck -check-prefix=valid_2018 %s
// RUN: %clang_dxc -enable-16bit-types -T lib_6_4 /HV 2021 %s 2>&1 -### | FileCheck -check-prefix=valid_2021 %s
// both_invalid: error: '-enable-16bit-types' option requires target HLSL Version >= 2018 and shader model >= 6.2, but HLSL Version is 'hlsl2016' and shader model is '6.0'
// HV_invalid_2017: error: '-enable-16bit-types' option requires target HLSL Version >= 2018 and shader model >= 6.2, but HLSL Version is 'hlsl2017' and shader model is '6.4'
// TP_invalid: error: '-enable-16bit-types' option requires target HLSL Version >= 2018 and shader model >= 6.2, but HLSL Version is 'hlsl2021' and shader model is '6.0'
// valid_2021: "dxil-unknown-shadermodel6.4-library"
// valid_2021-SAME: "-std=hlsl2021"
// valid_2021-SAME: "-fnative-half-type"
// valid_2018: "dxil-unknown-shadermodel6.4-library"
// valid_2018-SAME: "-std=hlsl2018"
// valid_2018-SAME: "-fnative-half-type"
[numthreads(1,1,1)]
void main()
{
return;
}
// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 -HV 2016 %s 2>&1 | FileCheck -check-prefix=both_invalid %s
// RUN: not %clang_dxc -enable-16bit-types -T lib_6_4 -HV 2017 %s 2>&1 | FileCheck -check-prefix=HV_invalid_2017 %s
// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 /HV 2021 %s 2>&1 | FileCheck -check-prefix=TP_invalid %s
// RUN: %clang_dxc -enable-16bit-types -T lib_6_4 /HV 2018 %s 2>&1 -### | FileCheck -check-prefix=valid_2018 %s
// RUN: %clang_dxc -enable-16bit-types -T lib_6_4 /HV 2021 %s 2>&1 -### | FileCheck -check-prefix=valid_2021 %s
// both_invalid: error: '-enable-16bit-types' option requires target HLSL Version >= 2018 and shader model >= 6.2, but HLSL Version is 'hlsl2016' and shader model is '6.0'
// HV_invalid_2017: error: '-enable-16bit-types' option requires target HLSL Version >= 2018 and shader model >= 6.2, but HLSL Version is 'hlsl2017' and shader model is '6.4'
// TP_invalid: error: '-enable-16bit-types' option requires target HLSL Version >= 2018 and shader model >= 6.2, but HLSL Version is 'hlsl2021' and shader model is '6.0'
// valid_2021: "dxil-unknown-shadermodel6.4-library"
// valid_2021-SAME: "-std=hlsl2021"
// valid_2021-SAME: "-fnative-half-type"
// valid_2018: "dxil-unknown-shadermodel6.4-library"
// valid_2018-SAME: "-std=hlsl2018"
// valid_2018-SAME: "-fnative-half-type"
[numthreads(1,1,1)]
void main()
{
return;
}

View File

@ -1,14 +1,14 @@
// RUN: not %clang_cc1 -internal-isystem D:\llvm-project\build\x64-Release\lib\clang\19\include -nostdsysteminc -triple spirv-vulkan-library -x hlsl -std=hlsl2016 -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s 2>&1 | FileCheck %s --check-prefix=SPIRV
// RUN: %clang_cc1 -internal-isystem D:\llvm-project\build\x64-Release\lib\clang\19\include -nostdsysteminc -triple spirv-vulkan-library -x hlsl -std=hlsl2021 -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s 2>&1 | FileCheck %s --check-prefix=valid
// SPIRV: error: '-fnative-half-type' option requires target HLSL Version >= 2018, but HLSL Version is 'hlsl2016'
// valid: "spirv-unknown-vulkan-library"
// valid: define spir_func void @main() #0 {
[numthreads(1,1,1)]
void main()
{
return;
}
// RUN: not %clang_cc1 -internal-isystem D:\llvm-project\build\x64-Release\lib\clang\19\include -nostdsysteminc -triple spirv-vulkan-library -x hlsl -std=hlsl2016 -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s 2>&1 | FileCheck %s --check-prefix=SPIRV
// RUN: %clang_cc1 -internal-isystem D:\llvm-project\build\x64-Release\lib\clang\19\include -nostdsysteminc -triple spirv-vulkan-library -x hlsl -std=hlsl2021 -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s 2>&1 | FileCheck %s --check-prefix=valid
// SPIRV: error: '-fnative-half-type' option requires target HLSL Version >= 2018, but HLSL Version is 'hlsl2016'
// valid: "spirv-unknown-vulkan-library"
// valid: define spir_func void @main() #0 {
[numthreads(1,1,1)]
void main()
{
return;
}

View File

@ -1,28 +1,28 @@
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -verify %s
// expected-no-diagnostics
@interface NSObject
@end
[[clang::objc_exception]]
@interface Foo {
[[clang::iboutlet]] NSObject *h;
}
@property (readonly) [[clang::objc_returns_inner_pointer]] void *i, *j;
@property (readonly) [[clang::iboutlet]] NSObject *k;
@end
[[clang::objc_runtime_name("name")]] @protocol Bar;
[[clang::objc_protocol_requires_explicit_implementation]]
@protocol Baz
@end
@interface Quux
-(void)g1 [[clang::ns_consumes_self]];
-(void)g2 __attribute__((ns_consumes_self));
-(void)h1: (int)x [[clang::ns_consumes_self]];
-(void)h2: (int)x __attribute__((ns_consumes_self));
-(void) [[clang::ns_consumes_self]] i1;
-(void) __attribute__((ns_consumes_self)) i2;
@end
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -verify %s
// expected-no-diagnostics
@interface NSObject
@end
[[clang::objc_exception]]
@interface Foo {
[[clang::iboutlet]] NSObject *h;
}
@property (readonly) [[clang::objc_returns_inner_pointer]] void *i, *j;
@property (readonly) [[clang::iboutlet]] NSObject *k;
@end
[[clang::objc_runtime_name("name")]] @protocol Bar;
[[clang::objc_protocol_requires_explicit_implementation]]
@protocol Baz
@end
@interface Quux
-(void)g1 [[clang::ns_consumes_self]];
-(void)g2 __attribute__((ns_consumes_self));
-(void)h1: (int)x [[clang::ns_consumes_self]];
-(void)h2: (int)x __attribute__((ns_consumes_self));
-(void) [[clang::ns_consumes_self]] i1;
-(void) __attribute__((ns_consumes_self)) i2;
@end

View File

@ -1,76 +1,76 @@
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++23-extensions -pedantic -std=c++20
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++23-extensions -pedantic -std=c++11
// RUN: %clang_cc1 -x c %s -Eonly -verify -Wno-all -Wno-c2x-extensions -pedantic -std=c99
//expected-error@+1{{missing '('}}
#define V1(...) __VA_OPT__
#undef V1
// OK
#define V1(...) __VA_OPT__ ()
#undef V1
//expected-warning@+1{{can only appear in the expansion of a variadic macro}}
#define V2() __VA_OPT__(x)
#undef V2
//expected-error@+2{{missing ')' after}}
//expected-note@+1{{to match this '('}}
#define V3(...) __VA_OPT__(
#undef V3
#define V4(...) __VA_OPT__(__VA_ARGS__)
#undef V4
//expected-error@+1{{nested}}
#define V5(...) __VA_OPT__(__VA_OPT__())
#undef V5
//expected-error@+1{{not followed by}}
#define V1(...) __VA_OPT__ (#)
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) __VA_OPT__ (##)
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) __VA_OPT__ (## X) x
#undef V1
//expected-error@+1{{cannot appear at end}}
#define V1(...) y __VA_OPT__ (X ##)
#undef V1
#define FOO(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__) //OK
//expected-error@+1{{not followed by a macro parameter}}
#define V1(...) __VA_OPT__(#)
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) a __VA_OPT__(##) b
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) a __VA_OPT__(a ## b) b __VA_OPT__(##)
#undef V1
#define V1(x,...) # __VA_OPT__(b x) // OK
#undef V1
//expected-error@+2{{missing ')' after}}
//expected-note@+1{{to match this '('}}
#define V1(...) __VA_OPT__ ((())
#undef V1
// __VA_OPT__ can't appear anywhere else.
#if __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
#endif
// expected-warning@+2 {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
#ifdef __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
#elifdef __VA_OPT__
#endif
#define BAD __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++23-extensions -pedantic -std=c++20
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++23-extensions -pedantic -std=c++11
// RUN: %clang_cc1 -x c %s -Eonly -verify -Wno-all -Wno-c2x-extensions -pedantic -std=c99
//expected-error@+1{{missing '('}}
#define V1(...) __VA_OPT__
#undef V1
// OK
#define V1(...) __VA_OPT__ ()
#undef V1
//expected-warning@+1{{can only appear in the expansion of a variadic macro}}
#define V2() __VA_OPT__(x)
#undef V2
//expected-error@+2{{missing ')' after}}
//expected-note@+1{{to match this '('}}
#define V3(...) __VA_OPT__(
#undef V3
#define V4(...) __VA_OPT__(__VA_ARGS__)
#undef V4
//expected-error@+1{{nested}}
#define V5(...) __VA_OPT__(__VA_OPT__())
#undef V5
//expected-error@+1{{not followed by}}
#define V1(...) __VA_OPT__ (#)
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) __VA_OPT__ (##)
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) __VA_OPT__ (## X) x
#undef V1
//expected-error@+1{{cannot appear at end}}
#define V1(...) y __VA_OPT__ (X ##)
#undef V1
#define FOO(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__) //OK
//expected-error@+1{{not followed by a macro parameter}}
#define V1(...) __VA_OPT__(#)
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) a __VA_OPT__(##) b
#undef V1
//expected-error@+1{{cannot appear at start}}
#define V1(...) a __VA_OPT__(a ## b) b __VA_OPT__(##)
#undef V1
#define V1(x,...) # __VA_OPT__(b x) // OK
#undef V1
//expected-error@+2{{missing ')' after}}
//expected-note@+1{{to match this '('}}
#define V1(...) __VA_OPT__ ((())
#undef V1
// __VA_OPT__ can't appear anywhere else.
#if __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
#endif
// expected-warning@+2 {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
#ifdef __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}}
#elifdef __VA_OPT__
#endif
#define BAD __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}}

View File

@ -1,150 +1,150 @@
// RUN: %clang_cc1 -E %s -pedantic -std=c++20 | FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -E %s -pedantic -std=c++11 | FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -E -x c %s -pedantic -std=c99 | FileCheck -strict-whitespace %s
#define LPAREN (
#define RPAREN )
#define A0 expandedA0
#define A1 expandedA1 A0
#define A2 expandedA2 A1
#define A3 expandedA3 A2
#define A() B LPAREN )
#define B() C LPAREN )
#define C() D LPAREN )
#define F(x, y) x + y
#define ELLIP_FUNC(...) __VA_OPT__(__VA_ARGS__)
1: ELLIP_FUNC(F, LPAREN, 'a', 'b', RPAREN);
2: ELLIP_FUNC(F LPAREN 'a', 'b' RPAREN);
#undef F
#undef ELLIP_FUNC
// CHECK: 1: F, (, 'a', 'b', );
// CHECK: 2: 'a' + 'b';
#define F(...) f(0 __VA_OPT__(,) __VA_ARGS__)
3: F(a, b, c) // replaced by f(0, a, b, c)
4: F() // replaced by f(0)
// CHECK: 3: f(0 , a, b, c)
// CHECK: 4: f(0 )
#undef F
#define G(X, ...) f(0, X __VA_OPT__(,) __VA_ARGS__)
5: G(a, b, c) // replaced by f(0, a , b, c)
6: G(a) // replaced by f(0, a)
7: G(a,) // replaced by f(0, a)
7.1: G(a,,)
// CHECK: 5: f(0, a , b, c)
// CHECK: 6: f(0, a )
// CHECK: 7: f(0, a )
// CHECK: 7.1: f(0, a , ,)
#undef G
#define HT_B() TONG
#define F(x, ...) HT_ ## __VA_OPT__(x x A() #x)
8: F(1)
9: F(A(),1)
// CHECK: 8: HT_
// CHECK: 9: TONG C ( ) B ( ) "A()"
#undef HT_B
#undef F
#define F(a,...) #__VA_OPT__(A1 a)
10: F(A())
11: F(A1 A(), 1)
// CHECK: 10: ""
// CHECK: 11: "A1 expandedA1 expandedA0 B ( )"
#undef F
#define F(a,...) a ## __VA_OPT__(A1 a) ## __VA_ARGS__ ## a
12.0: F()
12: F(,)
13: F(B,)
// CHECK: 12.0:
// CHECK: 12:
// CHECK: 13: BB
#undef F
#define F(...) #__VA_OPT__() X ## __VA_OPT__() #__VA_OPT__( )
14: F()
15: F(1)
// CHECK: 14: "" X ""
// CHECK: 15: "" X ""
#undef F
#define SDEF(sname, ...) S sname __VA_OPT__(= { __VA_ARGS__ })
16: SDEF(foo); // replaced by S foo;
17: SDEF(bar, 1, 2); // replaced by S bar = { 1, 2 };
// CHECK: 16: S foo ;
// CHECK: 17: S bar = { 1, 2 };
#undef SDEF
#define F(a,...) A() #__VA_OPT__(A3 __VA_ARGS__ a ## __VA_ARGS__ ## a ## C A3) A()
18: F()
19: F(,)
20: F(,A3)
21: F(A3, A(),A0)
// CHECK: 18: B ( ) "" B ( )
// CHECK: 19: B ( ) "" B ( )
// CHECK: 20: B ( ) "A3 expandedA3 expandedA2 expandedA1 expandedA0 A3C A3" B ( )
// CHECK: 21: B ( ) "A3 B ( ),expandedA0 A3A(),A0A3C A3" B ( )
#undef F
#define F(a,...) A() #__VA_OPT__(A3 __VA_ARGS__ a ## __VA_ARGS__ ## a ## C A3) a __VA_OPT__(A0 __VA_ARGS__ a ## __VA_ARGS__ ## a ## C A0) A()
22: F()
23: F(,)
24: F(,A0)
25: F(A0, A(),A0)
// CHECK: 22: B ( ) "" B ( )
// CHECK: 23: B ( ) "" B ( )
// CHECK: 24: B ( ) "A3 expandedA0 A0C A3" expandedA0 expandedA0 A0C expandedA0 B ( )
// CHECK: 25: B ( ) "A3 B ( ),expandedA0 A0A(),A0A0C A3" expandedA0 expandedA0 C ( ),expandedA0 A0A(),A0A0C expandedA0 B ( )
#undef F
#define F(a,...) __VA_OPT__(B a ## a) ## 1
#define G(a,...) __VA_OPT__(B a) ## 1
26: F(,1)
26_1: G(,1)
// CHECK: 26: B 1
// CHECK: 26_1: B 1
#undef F
#undef G
#define F(a,...) B ## __VA_OPT__(a 1) ## 1
#define G(a,...) B ## __VA_OPT__(a ## a 1) ## 1
27: F(,1)
27_1: F(A0,1)
28: G(,1)
// CHECK: 27: B 11
// CHECK: 27_1: BexpandedA0 11
// CHECK: 28: B 11
#undef F
#undef G
// RUN: %clang_cc1 -E %s -pedantic -std=c++20 | FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -E %s -pedantic -std=c++11 | FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -E -x c %s -pedantic -std=c99 | FileCheck -strict-whitespace %s
#define LPAREN (
#define RPAREN )
#define A0 expandedA0
#define A1 expandedA1 A0
#define A2 expandedA2 A1
#define A3 expandedA3 A2
#define A() B LPAREN )
#define B() C LPAREN )
#define C() D LPAREN )
#define F(x, y) x + y
#define ELLIP_FUNC(...) __VA_OPT__(__VA_ARGS__)
1: ELLIP_FUNC(F, LPAREN, 'a', 'b', RPAREN);
2: ELLIP_FUNC(F LPAREN 'a', 'b' RPAREN);
#undef F
#undef ELLIP_FUNC
// CHECK: 1: F, (, 'a', 'b', );
// CHECK: 2: 'a' + 'b';
#define F(...) f(0 __VA_OPT__(,) __VA_ARGS__)
3: F(a, b, c) // replaced by f(0, a, b, c)
4: F() // replaced by f(0)
// CHECK: 3: f(0 , a, b, c)
// CHECK: 4: f(0 )
#undef F
#define G(X, ...) f(0, X __VA_OPT__(,) __VA_ARGS__)
5: G(a, b, c) // replaced by f(0, a , b, c)
6: G(a) // replaced by f(0, a)
7: G(a,) // replaced by f(0, a)
7.1: G(a,,)
// CHECK: 5: f(0, a , b, c)
// CHECK: 6: f(0, a )
// CHECK: 7: f(0, a )
// CHECK: 7.1: f(0, a , ,)
#undef G
#define HT_B() TONG
#define F(x, ...) HT_ ## __VA_OPT__(x x A() #x)
8: F(1)
9: F(A(),1)
// CHECK: 8: HT_
// CHECK: 9: TONG C ( ) B ( ) "A()"
#undef HT_B
#undef F
#define F(a,...) #__VA_OPT__(A1 a)
10: F(A())
11: F(A1 A(), 1)
// CHECK: 10: ""
// CHECK: 11: "A1 expandedA1 expandedA0 B ( )"
#undef F
#define F(a,...) a ## __VA_OPT__(A1 a) ## __VA_ARGS__ ## a
12.0: F()
12: F(,)
13: F(B,)
// CHECK: 12.0:
// CHECK: 12:
// CHECK: 13: BB
#undef F
#define F(...) #__VA_OPT__() X ## __VA_OPT__() #__VA_OPT__( )
14: F()
15: F(1)
// CHECK: 14: "" X ""
// CHECK: 15: "" X ""
#undef F
#define SDEF(sname, ...) S sname __VA_OPT__(= { __VA_ARGS__ })
16: SDEF(foo); // replaced by S foo;
17: SDEF(bar, 1, 2); // replaced by S bar = { 1, 2 };
// CHECK: 16: S foo ;
// CHECK: 17: S bar = { 1, 2 };
#undef SDEF
#define F(a,...) A() #__VA_OPT__(A3 __VA_ARGS__ a ## __VA_ARGS__ ## a ## C A3) A()
18: F()
19: F(,)
20: F(,A3)
21: F(A3, A(),A0)
// CHECK: 18: B ( ) "" B ( )
// CHECK: 19: B ( ) "" B ( )
// CHECK: 20: B ( ) "A3 expandedA3 expandedA2 expandedA1 expandedA0 A3C A3" B ( )
// CHECK: 21: B ( ) "A3 B ( ),expandedA0 A3A(),A0A3C A3" B ( )
#undef F
#define F(a,...) A() #__VA_OPT__(A3 __VA_ARGS__ a ## __VA_ARGS__ ## a ## C A3) a __VA_OPT__(A0 __VA_ARGS__ a ## __VA_ARGS__ ## a ## C A0) A()
22: F()
23: F(,)
24: F(,A0)
25: F(A0, A(),A0)
// CHECK: 22: B ( ) "" B ( )
// CHECK: 23: B ( ) "" B ( )
// CHECK: 24: B ( ) "A3 expandedA0 A0C A3" expandedA0 expandedA0 A0C expandedA0 B ( )
// CHECK: 25: B ( ) "A3 B ( ),expandedA0 A0A(),A0A0C A3" expandedA0 expandedA0 C ( ),expandedA0 A0A(),A0A0C expandedA0 B ( )
#undef F
#define F(a,...) __VA_OPT__(B a ## a) ## 1
#define G(a,...) __VA_OPT__(B a) ## 1
26: F(,1)
26_1: G(,1)
// CHECK: 26: B 1
// CHECK: 26_1: B 1
#undef F
#undef G
#define F(a,...) B ## __VA_OPT__(a 1) ## 1
#define G(a,...) B ## __VA_OPT__(a ## a 1) ## 1
27: F(,1)
27_1: F(A0,1)
28: G(,1)
// CHECK: 27: B 11
// CHECK: 27_1: BexpandedA0 11
// CHECK: 28: B 11
#undef F
#undef G

View File

@ -1,23 +1,23 @@
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: aarch64-registered-target
#include <arm_sve.h>
svfloat32_t test_log_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
svfloat32_t test_log10_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log10(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
svfloat32_t test_log2_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log2(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: aarch64-registered-target
#include <arm_sve.h>
svfloat32_t test_log_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
svfloat32_t test_log10_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log10(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
svfloat32_t test_log2_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log2(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}

View File

@ -1,18 +1,18 @@
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: aarch64-registered-target
#include <arm_sve.h>
svfloat32_t test_sin_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_sin(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
svfloat32_t test_cos_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_cos(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: aarch64-registered-target
#include <arm_sve.h>
svfloat32_t test_sin_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_sin(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
svfloat32_t test_cos_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_cos(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}

View File

@ -1,14 +1,14 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
[[gnu::pure]] void foo(); // expected-warning{{'pure' attribute on function returning 'void'; attribute ignored}}
[[gnu::const]] void bar(); // expected-warning{{'const' attribute on function returning 'void'; attribute ignored}}
struct A {
[[gnu::pure]] A(); // expected-warning{{'pure' attribute on function returning 'void'; attribute ignored}}
[[gnu::const]] A(int); // expected-warning{{'const' attribute on function returning 'void'; attribute ignored}}
[[gnu::pure]] ~A(); // expected-warning{{'pure' attribute on function returning 'void'; attribute ignored}}
[[gnu::const]] [[gnu::pure]] int m(); // expected-warning{{'const' attribute imposes more restrictions; 'pure' attribute ignored}}
};
// RUN: %clang_cc1 -fsyntax-only -verify %s
[[gnu::pure]] void foo(); // expected-warning{{'pure' attribute on function returning 'void'; attribute ignored}}
[[gnu::const]] void bar(); // expected-warning{{'const' attribute on function returning 'void'; attribute ignored}}
struct A {
[[gnu::pure]] A(); // expected-warning{{'pure' attribute on function returning 'void'; attribute ignored}}
[[gnu::const]] A(int); // expected-warning{{'const' attribute on function returning 'void'; attribute ignored}}
[[gnu::pure]] ~A(); // expected-warning{{'pure' attribute on function returning 'void'; attribute ignored}}
[[gnu::const]] [[gnu::pure]] int m(); // expected-warning{{'const' attribute imposes more restrictions; 'pure' attribute ignored}}
};

View File

@ -1,25 +1,25 @@
// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: riscv-registered-target
#include <riscv_vector.h>
vfloat32mf2_t test_log_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
vfloat32mf2_t test_log10_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log10(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
vfloat32mf2_t test_log2_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log2(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: riscv-registered-target
#include <riscv_vector.h>
vfloat32mf2_t test_log_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
vfloat32mf2_t test_log10_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log10(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
vfloat32mf2_t test_log2_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log2(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}

View File

@ -1,19 +1,19 @@
// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: riscv-registered-target
#include <riscv_vector.h>
vfloat32mf2_t test_sin_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_sin(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
vfloat32mf2_t test_cos_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_cos(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \
// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \
// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify
// REQUIRES: riscv-registered-target
#include <riscv_vector.h>
vfloat32mf2_t test_sin_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_sin(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
vfloat32mf2_t test_cos_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_cos(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}

View File

@ -1,29 +1,29 @@
// RUN: %clang_cc1 -std=c++11 -triple armv7-unknown-linux-gnueabi -fsyntax-only -verify %s
struct a {
int __attribute__((no_caller_saved_registers)) b; // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
static void foo(int *a) __attribute__((no_caller_saved_registers)) {} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
};
struct a test __attribute__((no_caller_saved_registers)); // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
__attribute__((no_caller_saved_registers(999))) void bar(int *) {} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
__attribute__((no_caller_saved_registers)) void foo(int *){} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
[[gnu::no_caller_saved_registers]] void foo2(int *) {} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
typedef __attribute__((no_caller_saved_registers)) void (*foo3)(int *); // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
typedef void (*foo5)(int *);
int (*foo4)(double a, __attribute__((no_caller_saved_registers)) float b); // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
int main(int argc, char **argv) {
void (*fp)(int *) = foo;
a::foo(&argc);
foo3 func = foo2;
func(&argc);
foo5 __attribute__((no_caller_saved_registers)) func2 = foo2; // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
return 0;
}
// RUN: %clang_cc1 -std=c++11 -triple armv7-unknown-linux-gnueabi -fsyntax-only -verify %s
struct a {
int __attribute__((no_caller_saved_registers)) b; // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
static void foo(int *a) __attribute__((no_caller_saved_registers)) {} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
};
struct a test __attribute__((no_caller_saved_registers)); // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
__attribute__((no_caller_saved_registers(999))) void bar(int *) {} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
__attribute__((no_caller_saved_registers)) void foo(int *){} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
[[gnu::no_caller_saved_registers]] void foo2(int *) {} // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
typedef __attribute__((no_caller_saved_registers)) void (*foo3)(int *); // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
typedef void (*foo5)(int *);
int (*foo4)(double a, __attribute__((no_caller_saved_registers)) float b); // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
int main(int argc, char **argv) {
void (*fp)(int *) = foo;
a::foo(&argc);
foo3 func = foo2;
func(&argc);
foo5 __attribute__((no_caller_saved_registers)) func2 = foo2; // expected-warning {{unknown attribute 'no_caller_saved_registers' ignored}}
return 0;
}

View File

@ -1,33 +1,33 @@
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
struct a {
int b __attribute__((no_caller_saved_registers)); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'int'}}
static void foo(int *a) __attribute__((no_caller_saved_registers)) {}
};
struct a test __attribute__((no_caller_saved_registers)); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'struct a'}}
__attribute__((no_caller_saved_registers(999))) void bar(int *) {} // expected-error {{'no_caller_saved_registers' attribute takes no arguments}}
void __attribute__((no_caller_saved_registers)) foo(int *){}
[[gnu::no_caller_saved_registers]] void foo2(int *) {}
typedef __attribute__((no_caller_saved_registers)) void (*foo3)(int *);
int (*foo4)(double a, __attribute__((no_caller_saved_registers)) float b); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'float'}}
typedef void (*foo5)(int *);
void foo6(){} // expected-note {{previous declaration is here}}
void __attribute__((no_caller_saved_registers)) foo6(); // expected-error {{function declared with 'no_caller_saved_registers' attribute was previously declared without the 'no_caller_saved_registers' attribute}}
int main(int argc, char **argv) {
void (*fp)(int *) = foo; // expected-error {{cannot initialize a variable of type 'void (*)(int *)' with an lvalue of type 'void (int *) __attribute__((no_caller_saved_registers))'}}
a::foo(&argc);
foo3 func = foo2;
func(&argc);
foo5 __attribute__((no_caller_saved_registers)) func2 = foo2;
return 0;
}
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
struct a {
int b __attribute__((no_caller_saved_registers)); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'int'}}
static void foo(int *a) __attribute__((no_caller_saved_registers)) {}
};
struct a test __attribute__((no_caller_saved_registers)); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'struct a'}}
__attribute__((no_caller_saved_registers(999))) void bar(int *) {} // expected-error {{'no_caller_saved_registers' attribute takes no arguments}}
void __attribute__((no_caller_saved_registers)) foo(int *){}
[[gnu::no_caller_saved_registers]] void foo2(int *) {}
typedef __attribute__((no_caller_saved_registers)) void (*foo3)(int *);
int (*foo4)(double a, __attribute__((no_caller_saved_registers)) float b); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'float'}}
typedef void (*foo5)(int *);
void foo6(){} // expected-note {{previous declaration is here}}
void __attribute__((no_caller_saved_registers)) foo6(); // expected-error {{function declared with 'no_caller_saved_registers' attribute was previously declared without the 'no_caller_saved_registers' attribute}}
int main(int argc, char **argv) {
void (*fp)(int *) = foo; // expected-error {{cannot initialize a variable of type 'void (*)(int *)' with an lvalue of type 'void (int *) __attribute__((no_caller_saved_registers))'}}
a::foo(&argc);
foo3 func = foo2;
func(&argc);
foo5 __attribute__((no_caller_saved_registers)) func2 = foo2;
return 0;
}

View File

@ -1,131 +1,131 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++03 -verify -ast-dump %s > %t-03
// RUN: FileCheck --input-file=%t-03 %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -ast-dump %s > %t-11
// RUN: FileCheck --input-file=%t-11 %s
// RUN: FileCheck --input-file=%t-11 %s --check-prefix=CHECK-CXX11
// RUN: %clang_cc1 -verify -std=c++17 %s
// http://llvm.org/PR7905
namespace PR7905 {
struct S; // expected-note {{forward declaration}}
void foo1() {
(void)(S[]) {{3}}; // expected-error {{array has incomplete element type}}
}
template <typename T> struct M { T m; };
void foo2() {
(void)(M<short> []) {{3}};
}
}
// Check compound literals mixed with C++11 list-initialization.
namespace brace_initializers {
struct POD {
int x, y;
};
struct HasCtor {
HasCtor(int x, int y);
};
struct HasDtor {
int x, y;
~HasDtor();
};
struct HasCtorDtor {
HasCtorDtor(int x, int y);
~HasCtorDtor();
};
POD p = (POD){1, 2};
// CHECK-NOT: CXXBindTemporaryExpr {{.*}} 'brace_initializers::POD'
// CHECK: CompoundLiteralExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: InitListExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: ConstantExpr {{.*}}
// CHECK-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-NEXT: ConstantExpr {{.*}}
// CHECK-NEXT: IntegerLiteral {{.*}} 2{{$}}
void test() {
(void)(POD){1, 2};
// CHECK-NOT: CXXBindTemporaryExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NOT: ConstantExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK: CompoundLiteralExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: InitListExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-NEXT: IntegerLiteral {{.*}} 2{{$}}
(void)(HasDtor){1, 2};
// CHECK: CXXBindTemporaryExpr {{.*}} 'HasDtor':'brace_initializers::HasDtor'
// CHECK-NEXT: CompoundLiteralExpr {{.*}} 'HasDtor':'brace_initializers::HasDtor'
// CHECK-NEXT: InitListExpr {{.*}} 'HasDtor':'brace_initializers::HasDtor'
// CHECK-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-NEXT: IntegerLiteral {{.*}} 2{{$}}
#if __cplusplus >= 201103L
(void)(HasCtor){1, 2};
// CHECK-CXX11-NOT: CXXBindTemporaryExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11-NOT: ConstantExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11: CompoundLiteralExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11-NEXT: CXXTemporaryObjectExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 2{{$}}
(void)(HasCtorDtor){1, 2};
// CHECK-CXX11: CXXBindTemporaryExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11-NOT: ConstantExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11: CompoundLiteralExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11-NEXT: CXXTemporaryObjectExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 2{{$}}
#endif
}
struct PrivateDtor {
int x, y;
private:
~PrivateDtor(); // expected-note {{declared private here}}
};
void testPrivateDtor() {
(void)(PrivateDtor){1, 2}; // expected-error {{temporary of type 'PrivateDtor' has private destructor}}
}
}
// This doesn't necessarily need to be an error, but CodeGen can't handle it
// at the moment.
int PR17415 = (int){PR17415}; // expected-error {{initializer element is not a compile-time constant}}
// Make sure we accept this. (Not sure if we actually should... but we do
// at the moment.)
template<unsigned> struct Value { };
template<typename T>
int &check_narrowed(Value<sizeof((T){1.1})>);
#if __cplusplus >= 201103L
// Compound literals in global lambdas have automatic storage duration
// and are not subject to the constant-initialization rules.
int computed_with_lambda = [] {
int x = 5;
int result = ((int[]) { x, x + 2, x + 4, x + 6 })[0];
return result;
}();
#endif
namespace DynamicFileScopeLiteral {
// This covers the case where we have a file-scope compound literal with a
// non-constant initializer in C++. Previously, we had a bug where Clang forgot
// to consider initializer list elements for bases.
struct Empty {};
struct Foo : Empty { // expected-note 0+ {{candidate constructor}}
int x;
int y;
};
int f();
#if __cplusplus < 201103L
// expected-error@+6 {{non-aggregate type 'Foo' cannot be initialized with an initializer list}}
#elif __cplusplus < 201703L
// expected-error@+4 {{no matching constructor}}
#else
// expected-error@+2 {{initializer element is not a compile-time constant}}
#endif
Foo o = (Foo){ {}, 1, f() };
}
// RUN: %clang_cc1 -fsyntax-only -std=c++03 -verify -ast-dump %s > %t-03
// RUN: FileCheck --input-file=%t-03 %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -ast-dump %s > %t-11
// RUN: FileCheck --input-file=%t-11 %s
// RUN: FileCheck --input-file=%t-11 %s --check-prefix=CHECK-CXX11
// RUN: %clang_cc1 -verify -std=c++17 %s
// http://llvm.org/PR7905
namespace PR7905 {
struct S; // expected-note {{forward declaration}}
void foo1() {
(void)(S[]) {{3}}; // expected-error {{array has incomplete element type}}
}
template <typename T> struct M { T m; };
void foo2() {
(void)(M<short> []) {{3}};
}
}
// Check compound literals mixed with C++11 list-initialization.
namespace brace_initializers {
struct POD {
int x, y;
};
struct HasCtor {
HasCtor(int x, int y);
};
struct HasDtor {
int x, y;
~HasDtor();
};
struct HasCtorDtor {
HasCtorDtor(int x, int y);
~HasCtorDtor();
};
POD p = (POD){1, 2};
// CHECK-NOT: CXXBindTemporaryExpr {{.*}} 'brace_initializers::POD'
// CHECK: CompoundLiteralExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: InitListExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: ConstantExpr {{.*}}
// CHECK-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-NEXT: ConstantExpr {{.*}}
// CHECK-NEXT: IntegerLiteral {{.*}} 2{{$}}
void test() {
(void)(POD){1, 2};
// CHECK-NOT: CXXBindTemporaryExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NOT: ConstantExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK: CompoundLiteralExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: InitListExpr {{.*}} 'POD':'brace_initializers::POD'
// CHECK-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-NEXT: IntegerLiteral {{.*}} 2{{$}}
(void)(HasDtor){1, 2};
// CHECK: CXXBindTemporaryExpr {{.*}} 'HasDtor':'brace_initializers::HasDtor'
// CHECK-NEXT: CompoundLiteralExpr {{.*}} 'HasDtor':'brace_initializers::HasDtor'
// CHECK-NEXT: InitListExpr {{.*}} 'HasDtor':'brace_initializers::HasDtor'
// CHECK-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-NEXT: IntegerLiteral {{.*}} 2{{$}}
#if __cplusplus >= 201103L
(void)(HasCtor){1, 2};
// CHECK-CXX11-NOT: CXXBindTemporaryExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11-NOT: ConstantExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11: CompoundLiteralExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11-NEXT: CXXTemporaryObjectExpr {{.*}} 'HasCtor':'brace_initializers::HasCtor'
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 2{{$}}
(void)(HasCtorDtor){1, 2};
// CHECK-CXX11: CXXBindTemporaryExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11-NOT: ConstantExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11: CompoundLiteralExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11-NEXT: CXXTemporaryObjectExpr {{.*}} 'HasCtorDtor':'brace_initializers::HasCtorDtor'
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 1{{$}}
// CHECK-CXX11-NEXT: IntegerLiteral {{.*}} 2{{$}}
#endif
}
struct PrivateDtor {
int x, y;
private:
~PrivateDtor(); // expected-note {{declared private here}}
};
void testPrivateDtor() {
(void)(PrivateDtor){1, 2}; // expected-error {{temporary of type 'PrivateDtor' has private destructor}}
}
}
// This doesn't necessarily need to be an error, but CodeGen can't handle it
// at the moment.
int PR17415 = (int){PR17415}; // expected-error {{initializer element is not a compile-time constant}}
// Make sure we accept this. (Not sure if we actually should... but we do
// at the moment.)
template<unsigned> struct Value { };
template<typename T>
int &check_narrowed(Value<sizeof((T){1.1})>);
#if __cplusplus >= 201103L
// Compound literals in global lambdas have automatic storage duration
// and are not subject to the constant-initialization rules.
int computed_with_lambda = [] {
int x = 5;
int result = ((int[]) { x, x + 2, x + 4, x + 6 })[0];
return result;
}();
#endif
namespace DynamicFileScopeLiteral {
// This covers the case where we have a file-scope compound literal with a
// non-constant initializer in C++. Previously, we had a bug where Clang forgot
// to consider initializer list elements for bases.
struct Empty {};
struct Foo : Empty { // expected-note 0+ {{candidate constructor}}
int x;
int y;
};
int f();
#if __cplusplus < 201103L
// expected-error@+6 {{non-aggregate type 'Foo' cannot be initialized with an initializer list}}
#elif __cplusplus < 201703L
// expected-error@+4 {{no matching constructor}}
#else
// expected-error@+2 {{initializer element is not a compile-time constant}}
#endif
Foo o = (Foo){ {}, 1, f() };
}

View File

@ -1,33 +1,33 @@
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
namespace ns1 {
auto lstatic = []() static { return 3; };
int (*f2)(void) = lstatic;
}
namespace ns1_1 {
auto lstatic = []() static consteval //expected-error{{cannot take address of consteval call}} \
expected-note {{declared here}}
{ return 3; };
// FIXME: the above error should indicate that it was triggered below.
int (*f2)(void) = lstatic;
}
namespace ns2 {
auto lstatic = []() static { return 3; };
constexpr int (*f2)(void) = lstatic;
static_assert(lstatic() == f2());
}
namespace ns3 {
void main() {
static int x = 10;
auto L = []() static { return x; };
}
}
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
namespace ns1 {
auto lstatic = []() static { return 3; };
int (*f2)(void) = lstatic;
}
namespace ns1_1 {
auto lstatic = []() static consteval //expected-error{{cannot take address of consteval call}} \
expected-note {{declared here}}
{ return 3; };
// FIXME: the above error should indicate that it was triggered below.
int (*f2)(void) = lstatic;
}
namespace ns2 {
auto lstatic = []() static { return 3; };
constexpr int (*f2)(void) = lstatic;
static_assert(lstatic() == f2());
}
namespace ns3 {
void main() {
static int x = 10;
auto L = []() static { return x; };
}
}

View File

@ -1,40 +1,40 @@
// RUN: %clang_cc1 -verify=gnu -std=gnu++11 %s
// RUN: %clang_cc1 -verify=expected,cxx11 -Wvla -std=gnu++11 %s
// RUN: %clang_cc1 -verify=expected,cxx11 -std=c++11 %s
// RUN: %clang_cc1 -verify=expected,cxx98 -std=c++98 %s
// RUN: %clang_cc1 -verify=expected,off -std=c++11 -Wno-vla-extension-static-assert %s
// gnu-no-diagnostics
// Demonstrate that we do not diagnose use of VLAs by default in GNU mode, but
// we do diagnose them in C++ mode. Also note that we suggest use of
// static_assert, but only in C++11 and later and only if the warning group is
// not disabled.
// C++98 mode does not emit the same notes as C++11 mode because in C++98,
// we're looking for an integer constant expression, whereas in C++11 and later,
// we're looking for a constant expression that is of integer type (these are
// different operations; ICE looks at the syntactic form of the expression, but
// C++11 constant expressions require calculating the expression value).
void func(int n) { // cxx11-note {{declared here}} off-note {{declared here}}
int vla[n]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \
off-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
}
void old_style_static_assert(int n) { // cxx11-note 5 {{declared here}} off-note 2 {{declared here}}
int array1[n != 12 ? 1 : -1]; // cxx11-warning {{variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'?}} \
cxx98-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array2[n != 12 ? -1 : 1]; // cxx11-warning {{variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'?}} \
cxx98-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array3[n != 12 ? 1 : n]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \
off-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array4[(n ? 1 : -1)]; // cxx11-warning {{variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'?}} \
cxx98-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array5[n ? 1 : 0]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \
off-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
}
// RUN: %clang_cc1 -verify=gnu -std=gnu++11 %s
// RUN: %clang_cc1 -verify=expected,cxx11 -Wvla -std=gnu++11 %s
// RUN: %clang_cc1 -verify=expected,cxx11 -std=c++11 %s
// RUN: %clang_cc1 -verify=expected,cxx98 -std=c++98 %s
// RUN: %clang_cc1 -verify=expected,off -std=c++11 -Wno-vla-extension-static-assert %s
// gnu-no-diagnostics
// Demonstrate that we do not diagnose use of VLAs by default in GNU mode, but
// we do diagnose them in C++ mode. Also note that we suggest use of
// static_assert, but only in C++11 and later and only if the warning group is
// not disabled.
// C++98 mode does not emit the same notes as C++11 mode because in C++98,
// we're looking for an integer constant expression, whereas in C++11 and later,
// we're looking for a constant expression that is of integer type (these are
// different operations; ICE looks at the syntactic form of the expression, but
// C++11 constant expressions require calculating the expression value).
void func(int n) { // cxx11-note {{declared here}} off-note {{declared here}}
int vla[n]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \
off-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
}
void old_style_static_assert(int n) { // cxx11-note 5 {{declared here}} off-note 2 {{declared here}}
int array1[n != 12 ? 1 : -1]; // cxx11-warning {{variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'?}} \
cxx98-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array2[n != 12 ? -1 : 1]; // cxx11-warning {{variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'?}} \
cxx98-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array3[n != 12 ? 1 : n]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \
off-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array4[(n ? 1 : -1)]; // cxx11-warning {{variable length arrays in C++ are a Clang extension; did you mean to use 'static_assert'?}} \
cxx98-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
int array5[n ? 1 : 0]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
cxx11-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \
off-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
}

View File

@ -1,116 +1,116 @@
// RUN: %clang_cc1 -fsyntax-only -Wredundant-move -std=c++11 -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wredundant-move -std=c++11 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -ast-dump | FileCheck %s --check-prefix=CHECK-AST
// definitions for std::move
namespace std {
inline namespace foo {
template <class T> struct remove_reference { typedef T type; };
template <class T> struct remove_reference<T&> { typedef T type; };
template <class T> struct remove_reference<T&&> { typedef T type; };
template <class T> typename remove_reference<T>::type &&move(T &&t);
}
}
// test1 and test2 should not warn until after implementation of DR1579.
struct A {};
struct B : public A {};
A test1(B b1) {
B b2;
return b1;
return b2;
return std::move(b1);
return std::move(b2);
}
struct C {
C() {}
C(A) {}
};
C test2(A a1, B b1) {
A a2;
B b2;
return a1;
return a2;
return b1;
return b2;
return std::move(a1);
return std::move(a2);
return std::move(b1);
return std::move(b2);
}
// Copy of tests above with types changed to reference types.
A test3(B& b1) {
B& b2 = b1;
return b1;
return b2;
return std::move(b1);
return std::move(b2);
}
C test4(A& a1, B& b1) {
A& a2 = a1;
B& b2 = b1;
return a1;
return a2;
return b1;
return b2;
return std::move(a1);
return std::move(a2);
return std::move(b1);
return std::move(b2);
}
// PR23819, case 2
struct D {};
D test5(D d) {
return d;
// Verify the implicit move from the AST dump
// CHECK-AST: ReturnStmt{{.*}}line:[[@LINE-2]]
// CHECK-AST-NEXT: CXXConstructExpr{{.*}}D{{.*}}void (D &&)
// CHECK-AST-NEXT: ImplicitCastExpr
// CHECK-AST-NEXT: DeclRefExpr{{.*}}ParmVar{{.*}}'d'
return std::move(d);
// expected-warning@-1{{redundant move in return statement}}
// expected-note@-2{{remove std::move call here}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:20}:""
// CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:22}:""
}
namespace templates {
struct A {};
struct B { B(A); };
// Warn once here since the type is not dependent.
template <typename T>
A test1(A a) {
return std::move(a);
// expected-warning@-1{{redundant move in return statement}}
// expected-note@-2{{remove std::move call here}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:12-[[@LINE-3]]:22}:""
// CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:23-[[@LINE-4]]:24}:""
}
void run_test1() {
test1<A>(A());
test1<B>(A());
}
// T1 and T2 may not be the same, the warning may not always apply.
template <typename T1, typename T2>
T1 test2(T2 t) {
return std::move(t);
}
void run_test2() {
test2<A, A>(A());
test2<B, A>(A());
}
}
// RUN: %clang_cc1 -fsyntax-only -Wredundant-move -std=c++11 -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wredundant-move -std=c++11 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -ast-dump | FileCheck %s --check-prefix=CHECK-AST
// definitions for std::move
namespace std {
inline namespace foo {
template <class T> struct remove_reference { typedef T type; };
template <class T> struct remove_reference<T&> { typedef T type; };
template <class T> struct remove_reference<T&&> { typedef T type; };
template <class T> typename remove_reference<T>::type &&move(T &&t);
}
}
// test1 and test2 should not warn until after implementation of DR1579.
struct A {};
struct B : public A {};
A test1(B b1) {
B b2;
return b1;
return b2;
return std::move(b1);
return std::move(b2);
}
struct C {
C() {}
C(A) {}
};
C test2(A a1, B b1) {
A a2;
B b2;
return a1;
return a2;
return b1;
return b2;
return std::move(a1);
return std::move(a2);
return std::move(b1);
return std::move(b2);
}
// Copy of tests above with types changed to reference types.
A test3(B& b1) {
B& b2 = b1;
return b1;
return b2;
return std::move(b1);
return std::move(b2);
}
C test4(A& a1, B& b1) {
A& a2 = a1;
B& b2 = b1;
return a1;
return a2;
return b1;
return b2;
return std::move(a1);
return std::move(a2);
return std::move(b1);
return std::move(b2);
}
// PR23819, case 2
struct D {};
D test5(D d) {
return d;
// Verify the implicit move from the AST dump
// CHECK-AST: ReturnStmt{{.*}}line:[[@LINE-2]]
// CHECK-AST-NEXT: CXXConstructExpr{{.*}}D{{.*}}void (D &&)
// CHECK-AST-NEXT: ImplicitCastExpr
// CHECK-AST-NEXT: DeclRefExpr{{.*}}ParmVar{{.*}}'d'
return std::move(d);
// expected-warning@-1{{redundant move in return statement}}
// expected-note@-2{{remove std::move call here}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:20}:""
// CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:22}:""
}
namespace templates {
struct A {};
struct B { B(A); };
// Warn once here since the type is not dependent.
template <typename T>
A test1(A a) {
return std::move(a);
// expected-warning@-1{{redundant move in return statement}}
// expected-note@-2{{remove std::move call here}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:12-[[@LINE-3]]:22}:""
// CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:23-[[@LINE-4]]:24}:""
}
void run_test1() {
test1<A>(A());
test1<B>(A());
}
// T1 and T2 may not be the same, the warning may not always apply.
template <typename T1, typename T2>
T1 test2(T2 t) {
return std::move(t);
}
void run_test2() {
test2<A, A>(A());
test2<B, A>(A());
}
}

View File

@ -61,13 +61,13 @@ class A {
// expected-warning-re@+1 4 {{constructor parameter 'f{{[0-4]}}' shadows the field 'f{{[0-9]}}' of 'A'}}
A(int f1, int f2, int f3, int f4, double overload_dummy) {}
void test() {
char *field; // expected-warning {{declaration shadows a field of 'A'}}
char *data; // expected-warning {{declaration shadows a static data member of 'A'}}
char *a1; // no warning
char *a2; // no warning
char *jj; // no warning
char *jjj; // no warning
void test() {
char *field; // expected-warning {{declaration shadows a field of 'A'}}
char *data; // expected-warning {{declaration shadows a static data member of 'A'}}
char *a1; // no warning
char *a2; // no warning
char *jj; // no warning
char *jjj; // no warning
static char *f1; // expected-warning {{declaration shadows a field of 'A'}}
}
@ -197,14 +197,14 @@ void avoidWarningWhenRedefining(int b) { // expected-note {{previous definition
int k; // expected-note {{previous definition is here}}
typedef int k; // expected-error {{redefinition of 'k'}}
using l=char; // no warning or error.
using l=char; // no warning or error.
typedef char l; // no warning or error.
typedef char n; // no warning or error.
using l=char; // no warning or error.
using l=char; // no warning or error.
typedef char l; // no warning or error.
typedef char n; // no warning or error.
using n=char; // no warning or error.
}
typedef char n; // no warning or error.
using n=char; // no warning or error.
}
}
@ -220,42 +220,42 @@ void f(int a) {
struct A {
void g(int a) {}
A() { int a; }
};
}
}
namespace PR34120 {
struct A {
int B; // expected-note 2 {{declared here}}
};
class C : public A {
void D(int B) {} // expected-warning {{parameter 'B' shadows member inherited from type 'A'}}
void E() {
extern void f(int B); // Ok
}
void F(int B); // Ok, declaration; not definition.
void G(int B);
};
void C::G(int B) { // expected-warning {{parameter 'B' shadows member inherited from type 'A'}}
}
class Private {
int B;
};
class Derived : Private {
void D(int B) {} // Ok
};
struct Static {
static int B;
};
struct Derived2 : Static {
void D(int B) {}
};
}
};
}
}
namespace PR34120 {
struct A {
int B; // expected-note 2 {{declared here}}
};
class C : public A {
void D(int B) {} // expected-warning {{parameter 'B' shadows member inherited from type 'A'}}
void E() {
extern void f(int B); // Ok
}
void F(int B); // Ok, declaration; not definition.
void G(int B);
};
void C::G(int B) { // expected-warning {{parameter 'B' shadows member inherited from type 'A'}}
}
class Private {
int B;
};
class Derived : Private {
void D(int B) {} // Ok
};
struct Static {
static int B;
};
struct Derived2 : Static {
void D(int B) {}
};
}
int PR24718;
enum class X { PR24718 }; // Ok, not shadowing

View File

@ -1,91 +1,91 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float2 test_no_second_arg(float2 p0) {
return __builtin_hlsl_elementwise_clamp(p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}
float2 test_no_third_arg(float2 p0) {
return __builtin_hlsl_elementwise_clamp(p0, p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}
float2 test_clamp_no_second_arg(float2 p0) {
return clamp(p0);
// expected-error@-1 {{no matching function for call to 'clamp'}}
}
float2 test_clamp_vector_size_mismatch(float3 p0, float2 p1) {
return clamp(p0, p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float2 test_clamp_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type}}
}
float test_clamp_scalar_mismatch(float p0, half p1) {
return clamp(p1, p0, p1);
// expected-error@-1 {{call to 'clamp' is ambiguous}}
}
float2 test_clamp_element_type_mismatch(half2 p0, float2 p1) {
return clamp(p1, p0, p1);
// expected-error@-1 {{call to 'clamp' is ambiguous}}
}
float2 test_builtin_clamp_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float3 test_builtin_clamp_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float4 test_builtin_clamp_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float2 test_clamp_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float3 test_clamp_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float2 test_builtin_clamp_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float test_builtin_clamp_bool_type_promotion(bool p0) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p0);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion(float p0, bool p1) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
return __builtin_hlsl_elementwise_clamp(p1, p0, p1);
// expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}
float builtin_clamp_int_to_float_promotion(float p0, int p1) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float2 test_no_second_arg(float2 p0) {
return __builtin_hlsl_elementwise_clamp(p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}
float2 test_no_third_arg(float2 p0) {
return __builtin_hlsl_elementwise_clamp(p0, p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}
float2 test_clamp_no_second_arg(float2 p0) {
return clamp(p0);
// expected-error@-1 {{no matching function for call to 'clamp'}}
}
float2 test_clamp_vector_size_mismatch(float3 p0, float2 p1) {
return clamp(p0, p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float2 test_clamp_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type}}
}
float test_clamp_scalar_mismatch(float p0, half p1) {
return clamp(p1, p0, p1);
// expected-error@-1 {{call to 'clamp' is ambiguous}}
}
float2 test_clamp_element_type_mismatch(half2 p0, float2 p1) {
return clamp(p1, p0, p1);
// expected-error@-1 {{call to 'clamp' is ambiguous}}
}
float2 test_builtin_clamp_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float3 test_builtin_clamp_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float4 test_builtin_clamp_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float2 test_clamp_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float3 test_clamp_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float2 test_builtin_clamp_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}
float test_builtin_clamp_bool_type_promotion(bool p0) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p0);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion(float p0, bool p1) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
return __builtin_hlsl_elementwise_clamp(p1, p0, p1);
// expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}
float builtin_clamp_int_to_float_promotion(float p0, int p1) {
return __builtin_hlsl_elementwise_clamp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}

View File

@ -1,119 +1,119 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float test_no_second_arg(float2 p0) {
return __builtin_hlsl_dot(p0);
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
}
float test_too_many_arg(float2 p0) {
return __builtin_hlsl_dot(p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
}
float test_dot_no_second_arg(float2 p0) {
return dot(p0);
// expected-error@-1 {{no matching function for call to 'dot'}}
}
float test_dot_vector_size_mismatch(float3 p0, float2 p1) {
return dot(p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float test_dot_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
float test_dot_scalar_mismatch(float p0, int p1) {
return dot(p0, p1);
// expected-error@-1 {{call to 'dot' is ambiguous}}
}
float test_dot_element_type_mismatch(int2 p0, float2 p1) {
return dot(p0, p1);
// expected-error@-1 {{call to 'dot' is ambiguous}}
}
//NOTE: for all the *_promotion we are intentionally not handling type promotion in builtins
float test_builtin_dot_vec_int_to_float_promotion(int2 p0, float2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
int64_t test_builtin_dot_vec_int_to_int64_promotion(int64_t2 p0, int2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
float test_builtin_dot_vec_half_to_float_promotion(float2 p0, half2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
#ifdef __HLSL_ENABLE_16_BIT
float test_builtin_dot_vec_int16_to_float_promotion(float2 p0, int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
half test_builtin_dot_vec_int16_to_half_promotion(half2 p0, int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
int test_builtin_dot_vec_int16_to_int_promotion(int2 p0, int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
int64_t test_builtin_dot_vec_int16_to_int64_promotion(int64_t2 p0,
int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
#endif
float test_builtin_dot_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_builtin_dot_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_builtin_dot_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_dot_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_dot_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_builtin_dot_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
int test_builtin_dot_bool_type_promotion(bool p0, bool p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
}
double test_dot_double(double2 p0, double2 p1) {
return dot(p0, p1);
// expected-error@-1 {{call to 'dot' is ambiguous}}
}
double test_dot_double_builtin(double2 p0, double2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float test_no_second_arg(float2 p0) {
return __builtin_hlsl_dot(p0);
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
}
float test_too_many_arg(float2 p0) {
return __builtin_hlsl_dot(p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
}
float test_dot_no_second_arg(float2 p0) {
return dot(p0);
// expected-error@-1 {{no matching function for call to 'dot'}}
}
float test_dot_vector_size_mismatch(float3 p0, float2 p1) {
return dot(p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float test_dot_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
float test_dot_scalar_mismatch(float p0, int p1) {
return dot(p0, p1);
// expected-error@-1 {{call to 'dot' is ambiguous}}
}
float test_dot_element_type_mismatch(int2 p0, float2 p1) {
return dot(p0, p1);
// expected-error@-1 {{call to 'dot' is ambiguous}}
}
//NOTE: for all the *_promotion we are intentionally not handling type promotion in builtins
float test_builtin_dot_vec_int_to_float_promotion(int2 p0, float2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
int64_t test_builtin_dot_vec_int_to_int64_promotion(int64_t2 p0, int2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
float test_builtin_dot_vec_half_to_float_promotion(float2 p0, half2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
#ifdef __HLSL_ENABLE_16_BIT
float test_builtin_dot_vec_int16_to_float_promotion(float2 p0, int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
half test_builtin_dot_vec_int16_to_half_promotion(half2 p0, int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
int test_builtin_dot_vec_int16_to_int_promotion(int2 p0, int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
int64_t test_builtin_dot_vec_int16_to_int64_promotion(int64_t2 p0,
int16_t2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}}
}
#endif
float test_builtin_dot_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_builtin_dot_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_builtin_dot_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_dot_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_dot_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
float test_builtin_dot_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
}
int test_builtin_dot_bool_type_promotion(bool p0, bool p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
}
double test_dot_double(double2 p0, double2 p1) {
return dot(p0, p1);
// expected-error@-1 {{call to 'dot' is ambiguous}}
}
double test_dot_double_builtin(double2 p0, double2 p1) {
return __builtin_hlsl_dot(p0, p1);
// expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}

View File

@ -1,109 +1,109 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float2 test_no_second_arg(float2 p0) {
return __builtin_hlsl_lerp(p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}
float2 test_no_third_arg(float2 p0) {
return __builtin_hlsl_lerp(p0, p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_lerp(p0, p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}
float2 test_lerp_no_second_arg(float2 p0) {
return lerp(p0);
// expected-error@-1 {{no matching function for call to 'lerp'}}
}
float2 test_lerp_vector_size_mismatch(float3 p0, float2 p1) {
return lerp(p0, p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float2 test_lerp_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must have the same type}}
}
float test_lerp_scalar_mismatch(float p0, half p1) {
return lerp(p1, p0, p1);
// expected-error@-1 {{call to 'lerp' is ambiguous}}
}
float2 test_lerp_element_type_mismatch(half2 p0, float2 p1) {
return lerp(p1, p0, p1);
// expected-error@-1 {{call to 'lerp' is ambiguous}}
}
float2 test_builtin_lerp_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float3 test_builtin_lerp_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float4 test_builtin_lerp_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float2 test_lerp_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float3 test_lerp_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float2 test_builtin_lerp_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float test_builtin_lerp_bool_type_promotion(bool p0) {
return __builtin_hlsl_lerp(p0, p0, p0);
// expected-error@-1 {{1st argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion(float p0, bool p1) {
return __builtin_hlsl_lerp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
return __builtin_hlsl_lerp(p1, p0, p1);
// expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}
float builtin_lerp_int_to_float_promotion(float p0, int p1) {
return __builtin_hlsl_lerp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}
float4 test_lerp_int4(int4 p0, int4 p1, int4 p2) {
return __builtin_hlsl_lerp(p0, p1, p2);
// expected-error@-1 {{1st argument must be a floating point type (was 'int4' (aka 'vector<int, 4>'))}}
}
// note: DefaultVariadicArgumentPromotion --> DefaultArgumentPromotion has already promoted to double
// we don't know anymore that the input was half when __builtin_hlsl_lerp is called so we default to float
// for expected type
half builtin_lerp_half_scalar (half p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
// expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}}
}
float builtin_lerp_float_scalar ( float p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
// expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float2 test_no_second_arg(float2 p0) {
return __builtin_hlsl_lerp(p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}
float2 test_no_third_arg(float2 p0) {
return __builtin_hlsl_lerp(p0, p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_lerp(p0, p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}
float2 test_lerp_no_second_arg(float2 p0) {
return lerp(p0);
// expected-error@-1 {{no matching function for call to 'lerp'}}
}
float2 test_lerp_vector_size_mismatch(float3 p0, float2 p1) {
return lerp(p0, p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float2 test_lerp_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must have the same type}}
}
float test_lerp_scalar_mismatch(float p0, half p1) {
return lerp(p1, p0, p1);
// expected-error@-1 {{call to 'lerp' is ambiguous}}
}
float2 test_lerp_element_type_mismatch(half2 p0, float2 p1) {
return lerp(p1, p0, p1);
// expected-error@-1 {{call to 'lerp' is ambiguous}}
}
float2 test_builtin_lerp_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float3 test_builtin_lerp_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float4 test_builtin_lerp_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float2 test_lerp_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float3 test_lerp_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float2 test_builtin_lerp_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_lerp(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_lerp' must be vectors}}
}
float test_builtin_lerp_bool_type_promotion(bool p0) {
return __builtin_hlsl_lerp(p0, p0, p0);
// expected-error@-1 {{1st argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion(float p0, bool p1) {
return __builtin_hlsl_lerp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
return __builtin_hlsl_lerp(p1, p0, p1);
// expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}
float builtin_lerp_int_to_float_promotion(float p0, int p1) {
return __builtin_hlsl_lerp(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}
float4 test_lerp_int4(int4 p0, int4 p1, int4 p2) {
return __builtin_hlsl_lerp(p0, p1, p2);
// expected-error@-1 {{1st argument must be a floating point type (was 'int4' (aka 'vector<int, 4>'))}}
}
// note: DefaultVariadicArgumentPromotion --> DefaultArgumentPromotion has already promoted to double
// we don't know anymore that the input was half when __builtin_hlsl_lerp is called so we default to float
// for expected type
half builtin_lerp_half_scalar (half p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
// expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}}
}
float builtin_lerp_float_scalar ( float p0) {
return __builtin_hlsl_lerp ( p0, p0, p0 );
// expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}}
}

View File

@ -1,86 +1,86 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float2 test_no_second_arg(float2 p0) {
return __builtin_hlsl_mad(p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}
float2 test_no_third_arg(float2 p0) {
return __builtin_hlsl_mad(p0, p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_mad(p0, p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}
float2 test_mad_no_second_arg(float2 p0) {
return mad(p0);
// expected-error@-1 {{no matching function for call to 'mad'}}
}
float2 test_mad_vector_size_mismatch(float3 p0, float2 p1) {
return mad(p0, p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float2 test_mad_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must have the same type}}
}
float test_mad_scalar_mismatch(float p0, half p1) {
return mad(p1, p0, p1);
// expected-error@-1 {{call to 'mad' is ambiguous}}
}
float2 test_mad_element_type_mismatch(half2 p0, float2 p1) {
return mad(p1, p0, p1);
// expected-error@-1 {{call to 'mad' is ambiguous}}
}
float2 test_builtin_mad_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float3 test_builtin_mad_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float4 test_builtin_mad_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float2 test_mad_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float3 test_mad_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float2 test_builtin_mad_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float builtin_bool_to_float_type_promotion(float p0, bool p1) {
return __builtin_hlsl_mad(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
return __builtin_hlsl_mad(p1, p0, p1);
// expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}
float builtin_mad_int_to_float_promotion(float p0, int p1) {
return __builtin_hlsl_mad(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
float2 test_no_second_arg(float2 p0) {
return __builtin_hlsl_mad(p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}
float2 test_no_third_arg(float2 p0) {
return __builtin_hlsl_mad(p0, p0);
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_mad(p0, p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}
float2 test_mad_no_second_arg(float2 p0) {
return mad(p0);
// expected-error@-1 {{no matching function for call to 'mad'}}
}
float2 test_mad_vector_size_mismatch(float3 p0, float2 p1) {
return mad(p0, p0, p1);
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
}
float2 test_mad_builtin_vector_size_mismatch(float3 p0, float2 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must have the same type}}
}
float test_mad_scalar_mismatch(float p0, half p1) {
return mad(p1, p0, p1);
// expected-error@-1 {{call to 'mad' is ambiguous}}
}
float2 test_mad_element_type_mismatch(half2 p0, float2 p1) {
return mad(p1, p0, p1);
// expected-error@-1 {{call to 'mad' is ambiguous}}
}
float2 test_builtin_mad_float2_splat(float p0, float2 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float3 test_builtin_mad_float3_splat(float p0, float3 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float4 test_builtin_mad_float4_splat(float p0, float4 p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float2 test_mad_float2_int_splat(float2 p0, int p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float3 test_mad_float3_int_splat(float3 p0, int p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float2 test_builtin_mad_int_vect_to_float_vec_promotion(int2 p0, float p1) {
return __builtin_hlsl_mad(p0, p1, p1);
// expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}}
}
float builtin_bool_to_float_type_promotion(float p0, bool p1) {
return __builtin_hlsl_mad(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}
float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
return __builtin_hlsl_mad(p1, p0, p1);
// expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}
float builtin_mad_int_to_float_promotion(float p0, int p1) {
return __builtin_hlsl_mad(p0, p0, p1);
// expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}

View File

@ -1,16 +1,16 @@
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -std=gnu++11 -o /dev/null -x objective-c++ -fblocks -ast-dump %s 2>&1 | FileCheck %s
// CHECK: -FunctionDecl {{.*}} test 'id ()'
// CHECK-NEXT: -CompoundStmt
// CHECK-NEXT: -ReturnStmt
// CHECK-NEXT: -ExprWithCleanups
// CHECK-NEXT: -cleanup Block
// CHECK-NEXT: -cleanup Block
@interface NSDictionary
+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
@end
id test() {
return @{@"a": [](){}, @"b": [](){}};
}
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -std=gnu++11 -o /dev/null -x objective-c++ -fblocks -ast-dump %s 2>&1 | FileCheck %s
// CHECK: -FunctionDecl {{.*}} test 'id ()'
// CHECK-NEXT: -CompoundStmt
// CHECK-NEXT: -ReturnStmt
// CHECK-NEXT: -ExprWithCleanups
// CHECK-NEXT: -cleanup Block
// CHECK-NEXT: -cleanup Block
@interface NSDictionary
+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
@end
id test() {
return @{@"a": [](){}, @"b": [](){}};
}

View File

@ -1,55 +1,55 @@
// RUN: %clang_cc1 -std=c++14 -verify -ast-dump %s | FileCheck %s
// expected-no-diagnostics
// CHECK: FunctionDecl {{.*}} used func 'void ()'
// CHECK-NEXT: TemplateArgument type 'int'
// CHECK: LambdaExpr {{.*}} '(lambda at
// CHECK: ParmVarDecl {{.*}} used f 'foo' cinit
// CHECK-NEXT: DeclRefExpr {{.*}} 'foo' EnumConstant {{.*}} 'a' 'foo'
namespace PR28795 {
template<typename T>
void func() {
enum class foo { a, b };
auto bar = [](foo f = foo::a) { return f; };
bar();
}
void foo() {
func<int>();
}
}
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct class2 definition
// CHECK: TemplateArgument type 'int'
// CHECK: LambdaExpr {{.*}} '(lambda at
// CHECK: ParmVarDecl {{.*}} used f 'foo' cinit
// CHECK-NEXT: DeclRefExpr {{.*}} 'foo' EnumConstant {{.*}} 'a' 'foo'
// Template struct case:
template <class T> struct class2 {
void bar() {
enum class foo { a, b };
[](foo f = foo::a) { return f; }();
}
};
template struct class2<int>;
// CHECK: FunctionTemplateDecl {{.*}} f1
// CHECK-NEXT: TemplateTypeParmDecl {{.*}} typename depth 0 index 0 T
// CHECK-NEXT: FunctionDecl {{.*}} f1 'void ()'
// CHECK: FunctionDecl {{.*}} f1 'void ()'
// CHECK-NEXT: TemplateArgument type 'int'
// CHECK: ParmVarDecl {{.*}} n 'foo' cinit
// CHECK-NEXT: DeclRefExpr {{.*}} 'foo' EnumConstant {{.*}} 'a' 'foo'
template<typename T>
void f1() {
enum class foo { a, b };
struct S {
int g1(foo n = foo::a);
};
}
template void f1<int>();
// RUN: %clang_cc1 -std=c++14 -verify -ast-dump %s | FileCheck %s
// expected-no-diagnostics
// CHECK: FunctionDecl {{.*}} used func 'void ()'
// CHECK-NEXT: TemplateArgument type 'int'
// CHECK: LambdaExpr {{.*}} '(lambda at
// CHECK: ParmVarDecl {{.*}} used f 'foo' cinit
// CHECK-NEXT: DeclRefExpr {{.*}} 'foo' EnumConstant {{.*}} 'a' 'foo'
namespace PR28795 {
template<typename T>
void func() {
enum class foo { a, b };
auto bar = [](foo f = foo::a) { return f; };
bar();
}
void foo() {
func<int>();
}
}
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct class2 definition
// CHECK: TemplateArgument type 'int'
// CHECK: LambdaExpr {{.*}} '(lambda at
// CHECK: ParmVarDecl {{.*}} used f 'foo' cinit
// CHECK-NEXT: DeclRefExpr {{.*}} 'foo' EnumConstant {{.*}} 'a' 'foo'
// Template struct case:
template <class T> struct class2 {
void bar() {
enum class foo { a, b };
[](foo f = foo::a) { return f; }();
}
};
template struct class2<int>;
// CHECK: FunctionTemplateDecl {{.*}} f1
// CHECK-NEXT: TemplateTypeParmDecl {{.*}} typename depth 0 index 0 T
// CHECK-NEXT: FunctionDecl {{.*}} f1 'void ()'
// CHECK: FunctionDecl {{.*}} f1 'void ()'
// CHECK-NEXT: TemplateArgument type 'int'
// CHECK: ParmVarDecl {{.*}} n 'foo' cinit
// CHECK-NEXT: DeclRefExpr {{.*}} 'foo' EnumConstant {{.*}} 'a' 'foo'
template<typename T>
void f1() {
enum class foo { a, b };
struct S {
int g1(foo n = foo::a);
};
}
template void f1<int>();