Skip to content

Commit 697d8fb

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:5ab99bf1a757c5ad7115280f374d9af4f1b98bc9 into amd-gfx:02265b523516
Local branch amd-gfx 02265b5 Merged main:f58f92c2138ed0b3e802d0c45ba3652e72e208c4 into amd-gfx:b0ffbbce6c21 Remote branch main 5ab99bf [RISCV] Add scheduling model for Syntacore SCR4 and SCR5 (llvm#102909)
2 parents 02265b5 + 5ab99bf commit 697d8fb

File tree

226 files changed

+5236
-3764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+5236
-3764
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,4 @@ b32931c5b32eb0d2cf37d688b34f8548c9674c19
9292
64946fdaf9864d8279da1c30e4d7214fe13d1427
9393
b6262880b34629e9d7a72b5a42f315a3c9ed8139
9494
39c7dc7207e76e72da21cf4fedda21b5311bf62d
95+
e80bc777749331e9519575f416c342f7626dd14d

bolt/test/permission.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This test performs a logical AND operation on the results of the `stat -c %a
55
# %t.bolt` and `umask` commands (both results are displayed in octal), and
66
# checks whether the result is equal to 0.
7-
REQUIRES: system-linux
7+
REQUIRES: shell, system-linux
88

99
RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
1010
RUN: llvm-bolt %t -o %t.bolt

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4725,6 +4725,12 @@ def HLSLMad : LangBuiltin<"HLSL_LANG"> {
47254725
let Prototype = "void(...)";
47264726
}
47274727

4728+
def HLSLNormalize : LangBuiltin<"HLSL_LANG"> {
4729+
let Spellings = ["__builtin_hlsl_normalize"];
4730+
let Attributes = [NoThrow, Const];
4731+
let Prototype = "void(...)";
4732+
}
4733+
47284734
def HLSLRcp : LangBuiltin<"HLSL_LANG"> {
47294735
let Spellings = ["__builtin_hlsl_elementwise_rcp"];
47304736
let Attributes = [NoThrow, Const];

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ LANGOPT(CoroAlignedAllocation, 1, 0, "prefer Aligned Allocation according to P20
162162
LANGOPT(DllExportInlines , 1, 1, "dllexported classes dllexport inline methods")
163163
LANGOPT(RelaxedTemplateTemplateArgs, 1, 1, "C++17 relaxed matching of template template arguments")
164164
LANGOPT(ExperimentalLibrary, 1, 0, "enable unstable and experimental library features")
165+
LANGOPT(RetainSubstTemplateTypeParmTypeAstNodes, 1, 0, "retain SubstTemplateTypeParmType nodes in the AST's representation of alias template specializations")
165166

166167
LANGOPT(PointerAuthIntrinsics, 1, 0, "pointer authentication intrinsics")
167168
LANGOPT(PointerAuthCalls , 1, 0, "function pointer authentication")

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,12 @@ defm relaxed_template_template_args : BoolFOption<"relaxed-template-template-arg
34553455
PosFlag<SetTrue, [], [], "Enable">,
34563456
NegFlag<SetFalse, [], [CC1Option], "Disable">,
34573457
BothFlags<[], [ClangOption], " C++17 relaxed template template argument matching">>;
3458+
defm retain_subst_template_type_parm_type_ast_nodes : BoolFOption<"retain-subst-template-type-parm-type-ast-nodes",
3459+
LangOpts<"RetainSubstTemplateTypeParmTypeAstNodes">, DefaultFalse,
3460+
PosFlag<SetTrue, [], [CC1Option], "Enable">,
3461+
NegFlag<SetFalse, [], [], "Disable">,
3462+
BothFlags<[], [], " retain SubstTemplateTypeParmType nodes in the AST's representation"
3463+
" of alias template specializations">>;
34583464
defm sized_deallocation : BoolFOption<"sized-deallocation",
34593465
LangOpts<"SizedDeallocation">, Default<cpp14.KeyPath>,
34603466
PosFlag<SetTrue, [], [], "Enable C++14 sized global deallocation functions">,

clang/lib/AST/Interp/Interp.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,22 @@ inline bool SubPtr(InterpState &S, CodePtr OpPC) {
19871987
const Pointer &LHS = S.Stk.pop<Pointer>();
19881988
const Pointer &RHS = S.Stk.pop<Pointer>();
19891989

1990+
for (const Pointer &P : {LHS, RHS}) {
1991+
if (P.isZeroSizeArray()) {
1992+
QualType PtrT = P.getType();
1993+
while (auto *AT = dyn_cast<ArrayType>(PtrT))
1994+
PtrT = AT->getElementType();
1995+
1996+
QualType ArrayTy = S.getCtx().getConstantArrayType(
1997+
PtrT, APInt::getZero(1), nullptr, ArraySizeModifier::Normal, 0);
1998+
S.FFDiag(S.Current->getSource(OpPC),
1999+
diag::note_constexpr_pointer_subtraction_zero_size)
2000+
<< ArrayTy;
2001+
2002+
return false;
2003+
}
2004+
}
2005+
19902006
if (RHS.isZero()) {
19912007
S.Stk.push<T>(T::from(LHS.getIndex()));
19922008
return true;

clang/lib/AST/Interp/Pointer.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,11 @@ class Pointer {
613613
bool isElementPastEnd() const { return Offset == PastEndMark; }
614614

615615
/// Checks if the pointer is pointing to a zero-size array.
616-
bool isZeroSizeArray() const { return getFieldDesc()->isZeroSizeArray(); }
616+
bool isZeroSizeArray() const {
617+
if (const auto *Desc = getFieldDesc())
618+
return Desc->isZeroSizeArray();
619+
return false;
620+
}
617621

618622
/// Dereferences the pointer, if it's live.
619623
template <typename T> T &deref() const {

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18584,6 +18584,17 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
1858418584
CGM.getHLSLRuntime().getLengthIntrinsic(), ArrayRef<Value *>{X},
1858518585
nullptr, "hlsl.length");
1858618586
}
18587+
case Builtin::BI__builtin_hlsl_normalize: {
18588+
Value *X = EmitScalarExpr(E->getArg(0));
18589+
18590+
assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
18591+
"normalize operand must have a float representation");
18592+
18593+
return Builder.CreateIntrinsic(
18594+
/*ReturnType=*/X->getType(),
18595+
CGM.getHLSLRuntime().getNormalizeIntrinsic(), ArrayRef<Value *>{X},
18596+
nullptr, "hlsl.normalize");
18597+
}
1858718598
case Builtin::BI__builtin_hlsl_elementwise_frac: {
1858818599
Value *Op0 = EmitScalarExpr(E->getArg(0));
1858918600
if (!E->getArg(0)->getType()->hasFloatingRepresentation())

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,14 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
412412
B.CreateRetVoid();
413413
}
414414

415+
void CGHLSLRuntime::setHLSLFunctionAttributes(const FunctionDecl *FD,
416+
llvm::Function *Fn) {
417+
if (FD->isInExportDeclContext()) {
418+
const StringRef ExportAttrKindStr = "hlsl.export";
419+
Fn->addFnAttr(ExportAttrKindStr);
420+
}
421+
}
422+
415423
static void gatherFunctions(SmallVectorImpl<Function *> &Fns, llvm::Module &M,
416424
bool CtorOrDtor) {
417425
const auto *GV =

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class CGHLSLRuntime {
7777
GENERATE_HLSL_INTRINSIC_FUNCTION(Frac, frac)
7878
GENERATE_HLSL_INTRINSIC_FUNCTION(Length, length)
7979
GENERATE_HLSL_INTRINSIC_FUNCTION(Lerp, lerp)
80+
GENERATE_HLSL_INTRINSIC_FUNCTION(Normalize, normalize)
8081
GENERATE_HLSL_INTRINSIC_FUNCTION(Rsqrt, rsqrt)
8182
GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
8283

@@ -124,7 +125,7 @@ class CGHLSLRuntime {
124125
void setHLSLEntryAttributes(const FunctionDecl *FD, llvm::Function *Fn);
125126

126127
void emitEntryFunction(const FunctionDecl *FD, llvm::Function *Fn);
127-
void setHLSLFunctionAttributes(llvm::Function *, const FunctionDecl *);
128+
void setHLSLFunctionAttributes(const FunctionDecl *FD, llvm::Function *Fn);
128129

129130
private:
130131
void addBufferResourceAnnotation(llvm::GlobalVariable *GV,

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,9 +1228,13 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
12281228
if (getLangOpts().OpenMP && CurCodeDecl)
12291229
CGM.getOpenMPRuntime().emitFunctionProlog(*this, CurCodeDecl);
12301230

1231-
// Handle emitting HLSL entry functions.
1232-
if (D && D->hasAttr<HLSLShaderAttr>())
1233-
CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
1231+
if (FD && getLangOpts().HLSL) {
1232+
// Handle emitting HLSL entry functions.
1233+
if (FD->hasAttr<HLSLShaderAttr>()) {
1234+
CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
1235+
}
1236+
CGM.getHLSLRuntime().setHLSLFunctionAttributes(FD, Fn);
1237+
}
12341238

12351239
EmitFunctionProlog(*CurFnInfo, CurFn, Args);
12361240

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,9 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
507507
if (!Line->InMacroBody && !Style.isTableGen()) {
508508
// Skip PPDirective lines and comments.
509509
while (NextTok->is(tok::hash)) {
510+
NextTok = Tokens->getNextToken();
511+
if (NextTok->is(tok::pp_not_keyword))
512+
break;
510513
do {
511514
NextTok = Tokens->getNextToken();
512515
} while (NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof));

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,38 @@ double3 min(double3, double3);
13521352
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
13531353
double4 min(double4, double4);
13541354

1355+
//===----------------------------------------------------------------------===//
1356+
// normalize builtins
1357+
//===----------------------------------------------------------------------===//
1358+
1359+
/// \fn T normalize(T x)
1360+
/// \brief Returns the normalized unit vector of the specified floating-point
1361+
/// vector. \param x [in] The vector of floats.
1362+
///
1363+
/// Normalize is based on the following formula: x / length(x).
1364+
1365+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1366+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1367+
half normalize(half);
1368+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1369+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1370+
half2 normalize(half2);
1371+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1372+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1373+
half3 normalize(half3);
1374+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1375+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1376+
half4 normalize(half4);
1377+
1378+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1379+
float normalize(float);
1380+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1381+
float2 normalize(float2);
1382+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1383+
float3 normalize(float3);
1384+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1385+
float4 normalize(float4);
1386+
13551387
//===----------------------------------------------------------------------===//
13561388
// pow builtins
13571389
//===----------------------------------------------------------------------===//

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,18 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
11081108
return true;
11091109
break;
11101110
}
1111+
case Builtin::BI__builtin_hlsl_normalize: {
1112+
if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
1113+
return true;
1114+
if (SemaRef.checkArgCount(TheCall, 1))
1115+
return true;
1116+
1117+
ExprResult A = TheCall->getArg(0);
1118+
QualType ArgTyA = A.get()->getType();
1119+
// return type is the same as the input type
1120+
TheCall->setType(ArgTyA);
1121+
break;
1122+
}
11111123
// Note these are llvm builtins that we want to catch invalid intrinsic
11121124
// generation. Normal handling of these builitns will occur elsewhere.
11131125
case Builtin::BI__builtin_elementwise_bitreverse: {

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,10 +3332,16 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
33323332
if (Pattern->isInvalidDecl())
33333333
return QualType();
33343334

3335-
// Only substitute for the innermost template argument list.
3335+
// Only substitute for the innermost template argument list. NOTE: Some
3336+
// external resugarers rely on leaving a Subst* node here. Make the
3337+
// substitution non-final in that case. Note that these external resugarers
3338+
// will still miss some information in this representation, because we don't
3339+
// provide enough context in the Subst* nodes in order to tell different
3340+
// template type alias specializations apart.
33363341
MultiLevelTemplateArgumentList TemplateArgLists;
3337-
TemplateArgLists.addOuterTemplateArguments(Template, SugaredConverted,
3338-
/*Final=*/true);
3342+
TemplateArgLists.addOuterTemplateArguments(
3343+
Template, SugaredConverted,
3344+
/*Final=*/!getLangOpts().RetainSubstTemplateTypeParmTypeAstNodes);
33393345
TemplateArgLists.addOuterRetainedLevels(
33403346
AliasTemplate->getTemplateParameters()->getDepth());
33413347

clang/test/AST/Interp/arrays.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,3 +632,16 @@ constexpr int fail(const int &p) {
632632
}
633633
static_assert(fail(*(&(&(*(*&(&zs[2] - 1)[0] + 2 - 2))[2])[-1][2] - 2)) == 11, ""); // both-error {{not an integral constant expression}} \
634634
// both-note {{in call to}}
635+
636+
namespace ZeroSizeTypes {
637+
constexpr int (*p1)[0] = 0, (*p2)[0] = 0;
638+
constexpr int k = p2 - p1; // both-error {{constexpr variable 'k' must be initialized by a constant expression}} \
639+
// both-note {{subtraction of pointers to type 'int[0]' of zero size}} \
640+
// both-warning {{subtraction of pointers to type 'int[0]' of zero size has undefined behavior}}
641+
642+
int arr[5][0];
643+
constexpr int f() { // both-error {{never produces a constant expression}}
644+
return &arr[3] - &arr[0]; // both-note {{subtraction of pointers to type 'int[0]' of zero size}} \
645+
// both-warning {{subtraction of pointers to type 'int[0]' of zero size has undefined behavior}}
646+
}
647+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %clang_cc1 -fsyntax-only -fretain-subst-template-type-parm-type-ast-nodes -ast-dump -ast-dump-filter=dump %s | FileCheck -strict-whitespace %s
2+
3+
namespace t1 {
4+
template<class T> using X = T;
5+
using dump = X<int>;
6+
7+
// CHECK-LABEL: Dumping t1::dump:
8+
// CHECK-NEXT: TypeAliasDecl
9+
// CHECK-NEXT: `-ElaboratedType
10+
// CHECK-NEXT: `-TemplateSpecializationType
11+
// CHECK-NEXT: |-name: 'X':'t1::X' qualified
12+
// CHECK-NEXT: | `-TypeAliasTemplateDecl
13+
// CHECK-NEXT: |-TemplateArgument
14+
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
15+
// CHECK-NEXT: `-SubstTemplateTypeParmType 0x{{[0-9a-f]+}} 'int' sugar class depth 0 index 0 T
16+
// CHECK-NEXT: |-TypeAliasTemplate {{.+}} 'X'
17+
// CHECK-NEXT: `-BuiltinType {{.+}} 'int'
18+
} // namespace t1
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
2+
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
3+
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
4+
// RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_HALF
5+
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
6+
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
7+
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,DXIL_CHECK,NO_HALF,DXIL_NO_HALF
8+
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
9+
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
10+
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
11+
// RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK
12+
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
13+
// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
14+
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_NO_HALF,SPIR_CHECK
15+
16+
// DXIL_NATIVE_HALF: define noundef half @
17+
// SPIR_NATIVE_HALF: define spir_func noundef half @
18+
// DXIL_NATIVE_HALF: call half @llvm.dx.normalize.f16(half
19+
// SPIR_NATIVE_HALF: call half @llvm.spv.normalize.f16(half
20+
// DXIL_NO_HALF: call float @llvm.dx.normalize.f32(float
21+
// SPIR_NO_HALF: call float @llvm.spv.normalize.f32(float
22+
// NATIVE_HALF: ret half
23+
// NO_HALF: ret float
24+
half test_normalize_half(half p0)
25+
{
26+
return normalize(p0);
27+
}
28+
// DXIL_NATIVE_HALF: define noundef <2 x half> @
29+
// SPIR_NATIVE_HALF: define spir_func noundef <2 x half> @
30+
// DXIL_NATIVE_HALF: call <2 x half> @llvm.dx.normalize.v2f16(<2 x half>
31+
// SPIR_NATIVE_HALF: call <2 x half> @llvm.spv.normalize.v2f16(<2 x half>
32+
// DXIL_NO_HALF: call <2 x float> @llvm.dx.normalize.v2f32(<2 x float>
33+
// SPIR_NO_HALF: call <2 x float> @llvm.spv.normalize.v2f32(<2 x float>
34+
// NATIVE_HALF: ret <2 x half> %hlsl.normalize
35+
// NO_HALF: ret <2 x float> %hlsl.normalize
36+
half2 test_normalize_half2(half2 p0)
37+
{
38+
return normalize(p0);
39+
}
40+
// DXIL_NATIVE_HALF: define noundef <3 x half> @
41+
// SPIR_NATIVE_HALF: define spir_func noundef <3 x half> @
42+
// DXIL_NATIVE_HALF: call <3 x half> @llvm.dx.normalize.v3f16(<3 x half>
43+
// SPIR_NATIVE_HALF: call <3 x half> @llvm.spv.normalize.v3f16(<3 x half>
44+
// DXIL_NO_HALF: call <3 x float> @llvm.dx.normalize.v3f32(<3 x float>
45+
// SPIR_NO_HALF: call <3 x float> @llvm.spv.normalize.v3f32(<3 x float>
46+
// NATIVE_HALF: ret <3 x half> %hlsl.normalize
47+
// NO_HALF: ret <3 x float> %hlsl.normalize
48+
half3 test_normalize_half3(half3 p0)
49+
{
50+
return normalize(p0);
51+
}
52+
// DXIL_NATIVE_HALF: define noundef <4 x half> @
53+
// SPIR_NATIVE_HALF: define spir_func noundef <4 x half> @
54+
// DXIL_NATIVE_HALF: call <4 x half> @llvm.dx.normalize.v4f16(<4 x half>
55+
// SPIR_NATIVE_HALF: call <4 x half> @llvm.spv.normalize.v4f16(<4 x half>
56+
// DXIL_NO_HALF: call <4 x float> @llvm.dx.normalize.v4f32(<4 x float>
57+
// SPIR_NO_HALF: call <4 x float> @llvm.spv.normalize.v4f32(<4 x float>
58+
// NATIVE_HALF: ret <4 x half> %hlsl.normalize
59+
// NO_HALF: ret <4 x float> %hlsl.normalize
60+
half4 test_normalize_half4(half4 p0)
61+
{
62+
return normalize(p0);
63+
}
64+
65+
// DXIL_CHECK: define noundef float @
66+
// SPIR_CHECK: define spir_func noundef float @
67+
// DXIL_CHECK: call float @llvm.dx.normalize.f32(float
68+
// SPIR_CHECK: call float @llvm.spv.normalize.f32(float
69+
// CHECK: ret float
70+
float test_normalize_float(float p0)
71+
{
72+
return normalize(p0);
73+
}
74+
// DXIL_CHECK: define noundef <2 x float> @
75+
// SPIR_CHECK: define spir_func noundef <2 x float> @
76+
// DXIL_CHECK: %hlsl.normalize = call <2 x float> @llvm.dx.normalize.v2f32(
77+
// SPIR_CHECK: %hlsl.normalize = call <2 x float> @llvm.spv.normalize.v2f32(<2 x float>
78+
// CHECK: ret <2 x float> %hlsl.normalize
79+
float2 test_normalize_float2(float2 p0)
80+
{
81+
return normalize(p0);
82+
}
83+
// DXIL_CHECK: define noundef <3 x float> @
84+
// SPIR_CHECK: define spir_func noundef <3 x float> @
85+
// DXIL_CHECK: %hlsl.normalize = call <3 x float> @llvm.dx.normalize.v3f32(
86+
// SPIR_CHECK: %hlsl.normalize = call <3 x float> @llvm.spv.normalize.v3f32(<3 x float>
87+
// CHECK: ret <3 x float> %hlsl.normalize
88+
float3 test_normalize_float3(float3 p0)
89+
{
90+
return normalize(p0);
91+
}
92+
// DXIL_CHECK: define noundef <4 x float> @
93+
// SPIR_CHECK: define spir_func noundef <4 x float> @
94+
// DXIL_CHECK: %hlsl.normalize = call <4 x float> @llvm.dx.normalize.v4f32(
95+
// SPIR_CHECK: %hlsl.normalize = call <4 x float> @llvm.spv.normalize.v4f32(
96+
// CHECK: ret <4 x float> %hlsl.normalize
97+
float4 test_length_float4(float4 p0)
98+
{
99+
return normalize(p0);
100+
}

0 commit comments

Comments
 (0)