| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,64 +1,64 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump %s | FileCheck %s | ||
|
|
||
|
|
||
| // This test tests two different AST generations. The "EMPTY" test mode verifies | ||
| // the AST generated by forward declaration of the HLSL types which happens on | ||
| // initializing the HLSL external AST with an AST Context. | ||
|
|
||
| // The non-empty mode has a use that requires the StructuredBuffer type be complete, | ||
| // which results in the AST being populated by the external AST source. That | ||
| // case covers the full implementation of the template declaration and the | ||
| // instantiated specialization. | ||
|
|
||
| // EMPTY: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit StructuredBuffer | ||
| // EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type | ||
| // EMPTY-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class StructuredBuffer | ||
| // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final | ||
|
|
||
| // There should be no more occurrances of StructuredBuffer | ||
| // EMPTY-NOT: StructuredBuffer | ||
|
|
||
| #ifndef EMPTY | ||
|
|
||
| StructuredBuffer<float> Buffer; | ||
|
|
||
| #endif | ||
|
|
||
| // CHECK: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit StructuredBuffer | ||
| // CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type | ||
| // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class StructuredBuffer definition | ||
|
|
||
| // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final | ||
| // CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]] | ||
| // CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit TypedBuffer | ||
|
|
||
| // CHECK: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> operator[] 'element_type &const (unsigned int) const' | ||
| // CHECK-NEXT: ParmVarDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> Idx 'unsigned int' | ||
| // CHECK-NEXT: CompoundStmt 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> | ||
| // CHECK-NEXT: ReturnStmt 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> | ||
| // CHECK-NEXT: MemberExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'element_type' lvalue .e 0x{{[0-9A-Fa-f]+}} | ||
| // CHECK-NEXT: CXXThisExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'const StructuredBuffer<element_type>' lvalue implicit this | ||
| // CHECK-NEXT: AlwaysInlineAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit always_inline | ||
|
|
||
| // CHECK-NEXT: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> operator[] 'element_type &(unsigned int)' | ||
| // CHECK-NEXT: ParmVarDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> Idx 'unsigned int' | ||
| // CHECK-NEXT: CompoundStmt 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> | ||
| // CHECK-NEXT: ReturnStmt 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> | ||
| // CHECK-NEXT: MemberExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'element_type' lvalue .e 0x{{[0-9A-Fa-f]+}} | ||
| // CHECK-NEXT: CXXThisExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'StructuredBuffer<element_type>' lvalue implicit this | ||
| // CHECK-NEXT: AlwaysInlineAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit always_inline | ||
|
|
||
| // CHECK: ClassTemplateSpecializationDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class StructuredBuffer definition | ||
|
|
||
| // CHECK: TemplateArgument type 'float' | ||
| // CHECK-NEXT: BuiltinType 0x{{[0-9A-Fa-f]+}} 'float' | ||
| // CHECK-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final | ||
| // CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(float)]] | ||
| // CHECK-NEXT: HLSLResourceAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit TypedBuffer |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| // RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s | ||
| // expected-no-diagnostics | ||
|
|
||
| /* WG14 N3262: Yes | ||
| * Usability of a byte-wise copy of va_list | ||
| * | ||
| * NB: Clang explicitly documents this as being undefined behavior. A | ||
| * diagnostic is produced for some targets but not for others for assignment or | ||
| * initialization, but no diagnostic is possible to produce for use with memcpy | ||
| * in the general case, nor with a manual bytewise copy via a for loop. | ||
| * | ||
| * Therefore, nothing is tested in this file; it serves as a reminder that we | ||
| * validated our documentation against the paper. See | ||
| * clang/docs/LanguageExtensions.rst for more details. | ||
| * | ||
| * FIXME: it would be nice to add ubsan support for recognizing when an invalid | ||
| * copy is made and diagnosing on copy (or on use of the copied va_list). | ||
| */ | ||
|
|
||
| int main() {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| // RUN: %clang_cc1 -verify -std=c23 -Wall -pedantic %s | ||
| // RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s | ||
|
|
||
| /* WG14 N3274: Yes | ||
| * Remove imaginary types | ||
| */ | ||
|
|
||
| // Clang has never supported _Imaginary. | ||
| #ifdef __STDC_IEC_559_COMPLEX__ | ||
| #error "When did this happen?" | ||
| #endif | ||
|
|
||
| _Imaginary float i; // expected-error {{imaginary types are not supported}} | ||
|
|
||
| // _Imaginary is a keyword in older language modes, but doesn't need to be one | ||
| // in C2y or later. However, to improve diagnostic behavior, we retain it as a | ||
| // keyword in all language modes -- it is not available as an identifier. | ||
| static_assert(!__is_identifier(_Imaginary)); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s | ||
|
|
||
| StructuredBuffer<float> Buffer1; | ||
| StructuredBuffer<vector<float, 4> > BufferArray[4]; | ||
|
|
||
| StructuredBuffer<float> Buffer2 : register(u3); | ||
| StructuredBuffer<vector<float, 4> > BufferArray2[4] : register(u4); | ||
|
|
||
| StructuredBuffer<float> Buffer3 : register(u3, space1); | ||
| StructuredBuffer<vector<float, 4> > BufferArray3[4] : register(u4, space1); | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| } | ||
|
|
||
| // CHECK: !hlsl.uavs = !{![[Single:[0-9]+]], ![[Array:[0-9]+]], ![[SingleAllocated:[0-9]+]], ![[ArrayAllocated:[0-9]+]], ![[SingleSpace:[0-9]+]], ![[ArraySpace:[0-9]+]]} | ||
| // CHECK-DAG: ![[Single]] = !{ptr @Buffer1, i32 10, i32 9, i1 false, i32 -1, i32 0} | ||
| // CHECK-DAG: ![[Array]] = !{ptr @BufferArray, i32 10, i32 9, i1 false, i32 -1, i32 0} | ||
| // CHECK-DAG: ![[SingleAllocated]] = !{ptr @Buffer2, i32 10, i32 9, i1 false, i32 3, i32 0} | ||
| // CHECK-DAG: ![[ArrayAllocated]] = !{ptr @BufferArray2, i32 10, i32 9, i1 false, i32 4, i32 0} | ||
| // CHECK-DAG: ![[SingleSpace]] = !{ptr @Buffer3, i32 10, i32 9, i1 false, i32 3, i32 1} | ||
| // CHECK-DAG: ![[ArraySpace]] = !{ptr @BufferArray3, i32 10, i32 9, i1 false, i32 4, i32 1} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,70 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s | ||
|
|
||
| // NOTE: The number in type name and whether the struct is packed or not will mostly | ||
| // likely change once subscript operators are properly implemented (llvm/llvm-project#95956) | ||
| // and theinterim field of the contained type is removed. | ||
|
|
||
| // CHECK: %"class.hlsl::StructuredBuffer" = type <{ target("dx.RawBuffer", i16, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.0" = type <{ target("dx.RawBuffer", i16, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.2" = type { target("dx.RawBuffer", i32, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.3" = type { target("dx.RawBuffer", i32, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.4" = type { target("dx.RawBuffer", i64, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.5" = type { target("dx.RawBuffer", i64, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.6" = type <{ target("dx.RawBuffer", half, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.8" = type { target("dx.RawBuffer", float, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.9" = type { target("dx.RawBuffer", double, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.10" = type { target("dx.RawBuffer", <4 x i16>, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.11" = type { target("dx.RawBuffer", <3 x i32>, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.12" = type { target("dx.RawBuffer", <2 x half>, 1, 0) | ||
| // CHECK: %"class.hlsl::StructuredBuffer.13" = type { target("dx.RawBuffer", <3 x float>, 1, 0) | ||
|
|
||
| StructuredBuffer<int16_t> BufI16; | ||
| StructuredBuffer<uint16_t> BufU16; | ||
| StructuredBuffer<int> BufI32; | ||
| StructuredBuffer<uint> BufU32; | ||
| StructuredBuffer<int64_t> BufI64; | ||
| StructuredBuffer<uint64_t> BufU64; | ||
| StructuredBuffer<half> BufF16; | ||
| StructuredBuffer<float> BufF32; | ||
| StructuredBuffer<double> BufF64; | ||
| StructuredBuffer< vector<int16_t, 4> > BufI16x4; | ||
| StructuredBuffer< vector<uint, 3> > BufU32x3; | ||
| StructuredBuffer<half2> BufF16x2; | ||
| StructuredBuffer<float3> BufF32x3; | ||
| // TODO: StructuredBuffer<snorm half> BufSNormF16; -> 11 | ||
| // TODO: StructuredBuffer<unorm half> BufUNormF16; -> 12 | ||
| // TODO: StructuredBuffer<snorm float> BufSNormF32; -> 13 | ||
| // TODO: StructuredBuffer<unorm float> BufUNormF32; -> 14 | ||
| // TODO: StructuredBuffer<snorm double> BufSNormF64; -> 15 | ||
| // TODO: StructuredBuffer<unorm double> BufUNormF64; -> 16 | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main(int GI : SV_GroupIndex) { | ||
| BufI16[GI] = 0; | ||
| BufU16[GI] = 0; | ||
| BufI32[GI] = 0; | ||
| BufU32[GI] = 0; | ||
| BufI64[GI] = 0; | ||
| BufU64[GI] = 0; | ||
| BufF16[GI] = 0; | ||
| BufF32[GI] = 0; | ||
| BufF64[GI] = 0; | ||
| BufI16x4[GI] = 0; | ||
| BufU32x3[GI] = 0; | ||
| BufF16x2[GI] = 0; | ||
| BufF32x3[GI] = 0; | ||
| } | ||
|
|
||
| // CHECK: !{{[0-9]+}} = !{ptr @BufI16, i32 10, i32 2, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufU16, i32 10, i32 3, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufI32, i32 10, i32 4, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufU32, i32 10, i32 5, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufI64, i32 10, i32 6, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufU64, i32 10, i32 7, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufF16, i32 10, i32 8, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufF32, i32 10, i32 9, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufF64, i32 10, i32 10, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufI16x4, i32 10, i32 2, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufU32x3, i32 10, i32 5, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufF16x2, i32 10, i32 8, | ||
| // CHECK: !{{[0-9]+}} = !{ptr @BufF32x3, i32 10, i32 9, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -o - -O0 %s | FileCheck %s | ||
|
|
||
| StructuredBuffer<int> In; | ||
| StructuredBuffer<int> Out; | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main(unsigned GI : SV_GroupIndex) { | ||
| Out[GI] = In[GI]; | ||
| } | ||
|
|
||
| // Even at -O0 the subscript operators get inlined. The -O0 IR is a bit messy | ||
| // and confusing to follow so the match here is pretty weak. | ||
|
|
||
| // CHECK: define void @main() | ||
| // Verify inlining leaves only calls to "llvm." intrinsics | ||
| // CHECK-NOT: call {{[^@]*}} @{{[^l][^l][^v][^m][^\.]}} | ||
| // CHECK: ret void |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,59 @@ | ||
| // 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,NATIVE_HALF | ||
| // 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 | ||
|
|
||
| // CHECK-LABEL: test_atan2_half | ||
| // NATIVE_HALF: call half @llvm.atan2.f16 | ||
| // NO_HALF: call float @llvm.atan2.f32 | ||
| half test_atan2_half (half p0, half p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_half2 | ||
| // NATIVE_HALF: call <2 x half> @llvm.atan2.v2f16 | ||
| // NO_HALF: call <2 x float> @llvm.atan2.v2f32 | ||
| half2 test_atan2_half2 (half2 p0, half2 p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_half3 | ||
| // NATIVE_HALF: call <3 x half> @llvm.atan2.v3f16 | ||
| // NO_HALF: call <3 x float> @llvm.atan2.v3f32 | ||
| half3 test_atan2_half3 (half3 p0, half3 p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_half4 | ||
| // NATIVE_HALF: call <4 x half> @llvm.atan2.v4f16 | ||
| // NO_HALF: call <4 x float> @llvm.atan2.v4f32 | ||
| half4 test_atan2_half4 (half4 p0, half4 p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_float | ||
| // CHECK: call float @llvm.atan2.f32 | ||
| float test_atan2_float (float p0, float p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_float2 | ||
| // CHECK: call <2 x float> @llvm.atan2.v2f32 | ||
| float2 test_atan2_float2 (float2 p0, float2 p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_float3 | ||
| // CHECK: call <3 x float> @llvm.atan2.v3f32 | ||
| float3 test_atan2_float3 (float3 p0, float3 p1) { | ||
| return atan2(p0, p1); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_atan2_float4 | ||
| // CHECK: call <4 x float> @llvm.atan2.v4f32 | ||
| float4 test_atan2_float4 (float4 p0, float4 p1) { | ||
| return atan2(p0, p1); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,37 @@ | ||
| // 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,NATIVE_HALF \ | ||
| // RUN: -DFNATTRS=noundef -DTARGET=dx | ||
| // 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,NO_HALF \ | ||
| // RUN: -DFNATTRS=noundef -DTARGET=dx | ||
| // 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 \ | ||
| // RUN: -DFNATTRS="spir_func noundef" -DTARGET=spv | ||
| // 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 \ | ||
| // RUN: -DFNATTRS="spir_func noundef" -DTARGET=spv | ||
|
|
||
| // NATIVE_HALF: define [[FNATTRS]] <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.[[TARGET]].cross.v3f16(<3 x half> | ||
| // NATIVE_HALF: ret <3 x half> %hlsl.cross | ||
| // NO_HALF: define [[FNATTRS]] <3 x float> @ | ||
| // NO_HALF: call <3 x float> @llvm.[[TARGET]].cross.v3f32(<3 x float> | ||
| // NO_HALF: ret <3 x float> %hlsl.cross | ||
| half3 test_cross_half3(half3 p0, half3 p1) | ||
| { | ||
| return cross(p0, p1); | ||
| } | ||
|
|
||
| // CHECK: define [[FNATTRS]] <3 x float> @ | ||
| // CHECK: %hlsl.cross = call <3 x float> @llvm.[[TARGET]].cross.v3f32( | ||
| // CHECK: ret <3 x float> %hlsl.cross | ||
| float3 test_cross_float3(float3 p0, float3 p1) | ||
| { | ||
| return cross(p0, p1); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,73 +1,73 @@ | ||
| // 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,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,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.fabs.f16(half | ||
| // NO_HALF: call float @llvm.fabs.f32(float | ||
| // NATIVE_HALF: ret half | ||
| // NO_HALF: ret float | ||
| half test_length_half(half p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: %hlsl.length = call half @llvm.dx.length.v2f16 | ||
| // NO_HALF: %hlsl.length = call float @llvm.dx.length.v2f32( | ||
| // NATIVE_HALF: ret half %hlsl.length | ||
| // NO_HALF: ret float %hlsl.length | ||
| half test_length_half2(half2 p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: %hlsl.length = call half @llvm.dx.length.v3f16 | ||
| // NO_HALF: %hlsl.length = call float @llvm.dx.length.v3f32( | ||
| // NATIVE_HALF: ret half %hlsl.length | ||
| // NO_HALF: ret float %hlsl.length | ||
| half test_length_half3(half3 p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: %hlsl.length = call half @llvm.dx.length.v4f16 | ||
| // NO_HALF: %hlsl.length = call float @llvm.dx.length.v4f32( | ||
| // NATIVE_HALF: ret half %hlsl.length | ||
| // NO_HALF: ret float %hlsl.length | ||
| half test_length_half4(half4 p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
|
|
||
| // CHECK: define noundef float @ | ||
| // CHECK: call float @llvm.fabs.f32(float | ||
| // CHECK: ret float | ||
| float test_length_float(float p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
| // CHECK: define noundef float @ | ||
| // CHECK: %hlsl.length = call float @llvm.dx.length.v2f32( | ||
| // CHECK: ret float %hlsl.length | ||
| float test_length_float2(float2 p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
| // CHECK: define noundef float @ | ||
| // CHECK: %hlsl.length = call float @llvm.dx.length.v3f32( | ||
| // CHECK: ret float %hlsl.length | ||
| float test_length_float3(float3 p0) | ||
| { | ||
| return length(p0); | ||
| } | ||
| // CHECK: define noundef float @ | ||
| // CHECK: %hlsl.length = call float @llvm.dx.length.v4f32( | ||
| // CHECK: ret float %hlsl.length | ||
| float test_length_float4(float4 p0) | ||
| { | ||
| return length(p0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,85 +1,85 @@ | ||
| // 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,NATIVE_HALF \ | ||
| // RUN: -DFNATTRS=noundef -DTARGET=dx | ||
| // 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,NO_HALF \ | ||
| // RUN: -DFNATTRS=noundef -DTARGET=dx | ||
| // 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 \ | ||
| // RUN: -DFNATTRS="spir_func noundef" -DTARGET=spv | ||
| // 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 \ | ||
| // RUN: -DFNATTRS="spir_func noundef" -DTARGET=spv | ||
|
|
||
| // NATIVE_HALF: define [[FNATTRS]] half @ | ||
| // NATIVE_HALF: call half @llvm.[[TARGET]].normalize.f16(half | ||
| // NO_HALF: call float @llvm.[[TARGET]].normalize.f32(float | ||
| // NATIVE_HALF: ret half | ||
| // NO_HALF: ret float | ||
| half test_normalize_half(half p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
| // NATIVE_HALF: define [[FNATTRS]] <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.[[TARGET]].normalize.v2f16(<2 x half> | ||
| // NO_HALF: call <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> | ||
| // NATIVE_HALF: ret <2 x half> %hlsl.normalize | ||
| // NO_HALF: ret <2 x float> %hlsl.normalize | ||
| half2 test_normalize_half2(half2 p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
| // NATIVE_HALF: define [[FNATTRS]] <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.[[TARGET]].normalize.v3f16(<3 x half> | ||
| // NO_HALF: call <3 x float> @llvm.[[TARGET]].normalize.v3f32(<3 x float> | ||
| // NATIVE_HALF: ret <3 x half> %hlsl.normalize | ||
| // NO_HALF: ret <3 x float> %hlsl.normalize | ||
| half3 test_normalize_half3(half3 p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
| // NATIVE_HALF: define [[FNATTRS]] <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.[[TARGET]].normalize.v4f16(<4 x half> | ||
| // NO_HALF: call <4 x float> @llvm.[[TARGET]].normalize.v4f32(<4 x float> | ||
| // NATIVE_HALF: ret <4 x half> %hlsl.normalize | ||
| // NO_HALF: ret <4 x float> %hlsl.normalize | ||
| half4 test_normalize_half4(half4 p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
|
|
||
| // CHECK: define [[FNATTRS]] float @ | ||
| // CHECK: call float @llvm.[[TARGET]].normalize.f32(float | ||
| // CHECK: ret float | ||
| float test_normalize_float(float p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
| // CHECK: define [[FNATTRS]] <2 x float> @ | ||
| // CHECK: %hlsl.normalize = call <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> | ||
|
|
||
| // CHECK: ret <2 x float> %hlsl.normalize | ||
| float2 test_normalize_float2(float2 p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
| // CHECK: define [[FNATTRS]] <3 x float> @ | ||
| // CHECK: %hlsl.normalize = call <3 x float> @llvm.[[TARGET]].normalize.v3f32( | ||
| // CHECK: ret <3 x float> %hlsl.normalize | ||
| float3 test_normalize_float3(float3 p0) | ||
| { | ||
| return normalize(p0); | ||
| } | ||
| // CHECK: define [[FNATTRS]] <4 x float> @ | ||
| // CHECK: %hlsl.normalize = call <4 x float> @llvm.[[TARGET]].normalize.v4f32( | ||
| // CHECK: ret <4 x float> %hlsl.normalize | ||
| float4 test_length_float4(float4 p0) | ||
| { | ||
| return normalize(p0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,84 +1,84 @@ | ||
| // 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,NATIVE_HALF \ | ||
| // RUN: -DFNATTRS=noundef -DTARGET=dx | ||
| // 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,NO_HALF \ | ||
| // RUN: -DFNATTRS=noundef -DTARGET=dx | ||
| // 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 \ | ||
| // RUN: -DFNATTRS="spir_func noundef" -DTARGET=spv | ||
| // 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 \ | ||
| // RUN: -DFNATTRS="spir_func noundef" -DTARGET=spv | ||
|
|
||
| // NATIVE_HALF: define [[FNATTRS]] half @ | ||
| // NATIVE_HALF: call half @llvm.[[TARGET]].step.f16(half | ||
| // NO_HALF: call float @llvm.[[TARGET]].step.f32(float | ||
| // NATIVE_HALF: ret half | ||
| // NO_HALF: ret float | ||
| half test_step_half(half p0, half p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
| // NATIVE_HALF: define [[FNATTRS]] <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.[[TARGET]].step.v2f16(<2 x half> | ||
| // NO_HALF: call <2 x float> @llvm.[[TARGET]].step.v2f32(<2 x float> | ||
| // NATIVE_HALF: ret <2 x half> %hlsl.step | ||
| // NO_HALF: ret <2 x float> %hlsl.step | ||
| half2 test_step_half2(half2 p0, half2 p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
| // NATIVE_HALF: define [[FNATTRS]] <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.[[TARGET]].step.v3f16(<3 x half> | ||
| // NO_HALF: call <3 x float> @llvm.[[TARGET]].step.v3f32(<3 x float> | ||
| // NATIVE_HALF: ret <3 x half> %hlsl.step | ||
| // NO_HALF: ret <3 x float> %hlsl.step | ||
| half3 test_step_half3(half3 p0, half3 p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
| // NATIVE_HALF: define [[FNATTRS]] <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.[[TARGET]].step.v4f16(<4 x half> | ||
| // NO_HALF: call <4 x float> @llvm.[[TARGET]].step.v4f32(<4 x float> | ||
| // NATIVE_HALF: ret <4 x half> %hlsl.step | ||
| // NO_HALF: ret <4 x float> %hlsl.step | ||
| half4 test_step_half4(half4 p0, half4 p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
|
|
||
| // CHECK: define [[FNATTRS]] float @ | ||
| // CHECK: call float @llvm.[[TARGET]].step.f32(float | ||
| // CHECK: ret float | ||
| float test_step_float(float p0, float p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
| // CHECK: define [[FNATTRS]] <2 x float> @ | ||
| // CHECK: %hlsl.step = call <2 x float> @llvm.[[TARGET]].step.v2f32( | ||
| // CHECK: ret <2 x float> %hlsl.step | ||
| float2 test_step_float2(float2 p0, float2 p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
| // CHECK: define [[FNATTRS]] <3 x float> @ | ||
| // CHECK: %hlsl.step = call <3 x float> @llvm.[[TARGET]].step.v3f32( | ||
| // CHECK: ret <3 x float> %hlsl.step | ||
| float3 test_step_float3(float3 p0, float3 p1) | ||
| { | ||
| return step(p0, p1); | ||
| } | ||
| // CHECK: define [[FNATTRS]] <4 x float> @ | ||
| // CHECK: %hlsl.step = call <4 x float> @llvm.[[TARGET]].step.v4f32( | ||
| // CHECK: ret <4 x float> %hlsl.step | ||
| float4 test_step_float4(float4 p0, float4 p1) | ||
| { | ||
| return step(p0, p1); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| ! RUN: %clang --driver-mode=flang --target=x86_64-pc-windows-msvc -### %s -Ltest 2>&1 | FileCheck %s | ||
| ! | ||
| ! Test that user provided paths come before the Flang runtimes | ||
| ! CHECK: "-libpath:test" | ||
| ! CHECK: "-libpath:{{.*(\\|/)}}lib" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| // RUN: %clang_cc1 -pedantic -Wunused-label -fno-diagnostics-show-line-numbers -x c %s 2>&1 | FileCheck %s -strict-whitespace | ||
|
|
||
| // This file intentionally uses a CRLF newline style | ||
| // CHECK: warning: unused label 'ddd' | ||
| // CHECK-NEXT: {{^ ddd:}} | ||
| // CHECK-NEXT: {{^ \^~~~$}} | ||
| // CHECK-NOT: {{^ ;}} | ||
| void f(void) { | ||
| ddd: | ||
| ; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| // RUN: %clang_cc1 -E -frewrite-includes %s | %clang_cc1 - | ||
| // expected-no-diagnostics | ||
| // Note: This source file has CRLF line endings. | ||
| // This test validates that -frewrite-includes translates the end of line (EOL) | ||
| // form used in header files to the EOL form used in the the primary source | ||
| // file when the files use different EOL forms. | ||
| #include "rewrite-includes-mixed-eol-crlf.h" | ||
| #include "rewrite-includes-mixed-eol-lf.h" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| // Note: This header file has CRLF line endings. | ||
| // The indentation in some of the conditional inclusion directives below is | ||
| // intentional and is required for this test to function as a regression test | ||
| // for GH59736. | ||
| _Static_assert(__LINE__ == 5, ""); | ||
| #if 1 | ||
| _Static_assert(__LINE__ == 7, ""); | ||
| #if 1 | ||
| _Static_assert(__LINE__ == 9, ""); | ||
| #endif | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| // RUN: %clang_cc1 %s -E -o - -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s | ||
| #include <noline.h> | ||
| #include <line-directive-in-system.h> | ||
|
|
||
| #include "line-directive.h" | ||
|
|
||
| // This tests that the line numbers for the current file are correctly outputted | ||
| // for the include-file-completed test case. This file should be CRLF. | ||
|
|
||
| // CHECK: # 1 "{{.*}}system-header-line-directive-ms-lineendings.c" 2 | ||
| // CHECK: # 1 "{{.*}}noline.h" 1 3 | ||
| // CHECK: foo(void); | ||
| // CHECK: # 3 "{{.*}}system-header-line-directive-ms-lineendings.c" 2 | ||
| // CHECK: # 1 "{{.*}}line-directive-in-system.h" 1 3 | ||
| // The "3" below indicates that "foo.h" is considered a system header. | ||
| // CHECK: # 1 "foo.h" 3 | ||
| // CHECK: foo(void); | ||
| // CHECK: # 4 "{{.*}}system-header-line-directive-ms-lineendings.c" 2 | ||
| // CHECK: # 1 "{{.*}}line-directive.h" 1 | ||
| // CHECK: # 10 "foo.h"{{$}} | ||
| // CHECK: # 6 "{{.*}}system-header-line-directive-ms-lineendings.c" 2 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,31 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -ast-dump -x hlsl -o - %s | FileCheck %s | ||
|
|
||
|
|
||
| struct MyBitFields { | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:9:3, col:25> col:16 referenced field1 'unsigned int' | ||
| // CHECK:-ConstantExpr 0x{{[0-9a-f]+}} <col:25> 'int' | ||
| // CHECK:-value: Int 3 | ||
| // CHECK:-IntegerLiteral 0x{{[0-9a-f]+}} <col:25> 'int' 3 | ||
| unsigned int field1 : 3; // 3 bits for field1 | ||
|
|
||
| // CHECK:FieldDecl 0x{{[0-9a-f]+}} <line:15:3, col:25> col:16 referenced field2 'unsigned int' | ||
| // CHECK:-ConstantExpr 0x{{[0-9a-f]+}} <col:25> 'int' | ||
| // CHECK:-value: Int 4 | ||
| // CHECK:-IntegerLiteral 0x{{[0-9a-f]+}} <col:25> 'int' 4 | ||
| unsigned int field2 : 4; // 4 bits for field2 | ||
|
|
||
| // CHECK:FieldDecl 0x{{[0-9a-f]+}} <line:21:3, col:16> col:7 field3 'int' | ||
| // CHECK:-ConstantExpr 0x{{[0-9a-f]+}} <col:16> 'int' | ||
| // CHECK:-value: Int 5 | ||
| // CHECK:-IntegerLiteral 0x{{[0-9a-f]+}} <col:16> 'int' 5 | ||
| int field3 : 5; // 5 bits for field3 (signed) | ||
| }; | ||
|
|
||
|
|
||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| MyBitFields m; | ||
| m.field1 = 4; | ||
| m.field2 = m.field1*2; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s | ||
|
|
||
| // tests that hlsl annotations are properly parsed when applied on field decls, | ||
| // and that the annotation gets properly placed on the AST. | ||
|
|
||
| struct Eg9{ | ||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:1, col:8> col:8 implicit struct Eg9 | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:10:3, col:16> col:16 referenced a 'unsigned int' | ||
| // CHECK: -HLSLSV_DispatchThreadIDAttr 0x{{[0-9a-f]+}} <col:20> | ||
| unsigned int a : SV_DispatchThreadID; | ||
| }; | ||
| Eg9 e9; | ||
|
|
||
|
|
||
| RWBuffer<int> In : register(u1); | ||
|
|
||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| In[0] = e9.a; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,25 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -x hlsl -ast-dump -o - %s | FileCheck %s | ||
|
|
||
| typedef vector<float, 4> float4; | ||
|
|
||
| // CHECK: -TypeAliasDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 4]]:1, col:83> | ||
| // CHECK: -HLSLAttributedResourceType 0x{{[0-9a-f]+}} '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(int)]] | ||
| using ResourceIntAliasT = __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(int)]]; | ||
| ResourceIntAliasT h1; | ||
|
|
||
| // CHECK: -VarDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 3]]:1, col:82> col:82 h2 '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(float4)]] | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float4)]] h2; | ||
|
|
||
| // CHECK: ClassTemplateDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 6]]:1, line:[[# @LINE + 8]]:1> line:[[# @LINE + 6]]:30 S | ||
| // CHECK: TemplateTypeParmDecl 0x{{[0-9a-f]+}} <col:11, col:20> col:20 referenced typename depth 0 index 0 T | ||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:23, line:[[# @LINE + 6]]:1> line:[[# @LINE + 4]]:30 struct S definition | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 4]]:3, col:79> col:79 h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(T)]] | ||
| template <typename T> struct S { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(T)]] h; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,28 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -x hlsl -o - %s -verify | ||
|
|
||
| typedef vector<float, 4> float4; | ||
|
|
||
| // expected-error@+1{{'contained_type' attribute cannot be applied to a declaration}} | ||
| [[hlsl::contained_type(float4)]] __hlsl_resource_t h1; | ||
|
|
||
| // expected-error@+1{{'contained_type' attribute takes one argument}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type()]] h3; | ||
|
|
||
| // expected-error@+1{{expected a type}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(0)]] h4; | ||
|
|
||
| // expected-error@+1{{unknown type name 'a'}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(a)]] h5; | ||
|
|
||
| // expected-error@+1{{expected a type}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type("b", c)]] h6; | ||
|
|
||
| // expected-warning@+1{{attribute 'contained_type' is already applied}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]] [[hlsl::contained_type(float)]] h7; | ||
|
|
||
| // expected-warning@+1{{attribute 'contained_type' is already applied with different arguments}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]] [[hlsl::contained_type(int)]] h8; | ||
|
|
||
| // expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| // expected-error@+1{{attribute 'contained_type' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| float [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]] res5; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s | ||
|
|
||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} {{.*}} struct MyBuffer definition | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 4]]:3, col:68> col:68 h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::is_rov]] | ||
| struct MyBuffer { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] h; | ||
| }; | ||
|
|
||
| // CHECK: VarDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 3]]:1, col:66> col:66 res '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(SRV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::is_rov]] | ||
| __hlsl_resource_t [[hlsl::is_rov]] [[hlsl::resource_class(SRV)]] res; | ||
|
|
||
| // CHECK: FunctionDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 4]]:1, line:[[# @LINE + 6]]:1> line:[[# @LINE + 4]]:6 f 'void () | ||
| // CHECK: VarDecl 0x{{[0-9a-f]+}} <col:3, col:72> col:72 r '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(Sampler)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::is_rov]] | ||
| void f() { | ||
| __hlsl_resource_t [[hlsl::resource_class(Sampler)]] [[hlsl::is_rov]] r; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify | ||
|
|
||
| // expected-error@+1{{'is_rov' attribute cannot be applied to a declaration}} | ||
| [[hlsl::is_rov]] __hlsl_resource_t res0; | ||
|
|
||
| // expected-error@+1{{HLSL resource needs to have [[hlsl::resource_class()]] attribute}} | ||
| __hlsl_resource_t [[hlsl::is_rov]] res1; | ||
|
|
||
| // expected-error@+1{{'is_rov' attribute takes no arguments}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov(3)]] res2; | ||
|
|
||
| // expected-error@+1{{use of undeclared identifier 'gibberish'}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov(gibberish)]] res3; | ||
|
|
||
| // expected-warning@+1{{attribute 'is_rov' is already applied}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] [[hlsl::is_rov]] res4; | ||
|
|
||
| // expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| // expected-error@+1{{attribute 'is_rov' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| float [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] res5; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s | ||
|
|
||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} {{.*}} struct MyBuffer definition | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 4]]:3, col:72> col:72 h1 '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] | ||
| struct MyBuffer { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] h1; | ||
| }; | ||
|
|
||
| // CHECK: VarDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 3]]:1, col:70> col:70 h2 '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(SRV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] | ||
| __hlsl_resource_t [[hlsl::raw_buffer]] [[hlsl::resource_class(SRV)]] h2; | ||
|
|
||
| // CHECK: FunctionDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 4]]:1, line:[[# @LINE + 6]]:1> line:[[# @LINE + 4]]:6 f 'void () | ||
| // CHECK: VarDecl 0x{{[0-9a-f]+}} <col:3, col:72> col:72 h3 '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] | ||
| void f() { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] h3; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify | ||
|
|
||
| // expected-error@+1{{'raw_buffer' attribute cannot be applied to a declaration}} | ||
| [[hlsl::raw_buffer]] __hlsl_resource_t res0; | ||
|
|
||
| // expected-error@+1{{'raw_buffer' attribute takes no arguments}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer(3)]] res2; | ||
|
|
||
| // expected-error@+1{{use of undeclared identifier 'gibberish'}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer(gibberish)]] res3; | ||
|
|
||
| // expected-warning@+1{{attribute 'raw_buffer' is already applied}} | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] [[hlsl::raw_buffer]] res4; | ||
|
|
||
| // expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| // expected-error@+1{{attribute 'raw_buffer' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| float [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] res5; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,37 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s | ||
|
|
||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} {{.*}} struct MyBuffer definition | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 3]]:3, col:51> col:51 h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| struct MyBuffer { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] h; | ||
| }; | ||
|
|
||
| // CHECK: VarDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 2]]:1, col:49> col:49 res '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(SRV)]] | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV)]] res; | ||
|
|
||
| // CHECK: FunctionDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 3]]:1, line:[[# @LINE + 5]]:1> line:[[# @LINE + 3]]:6 f 'void () | ||
| // CHECK: VarDecl 0x{{[0-9a-f]+}} <col:3, col:55> col:55 r '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(Sampler)]] | ||
| void f() { | ||
| __hlsl_resource_t [[hlsl::resource_class(Sampler)]] r; | ||
| } | ||
|
|
||
| // CHECK: ClassTemplateDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 6]]:1, line:[[# @LINE + 8]]:1> line:[[# @LINE + 6]]:29 MyBuffer2 | ||
| // CHECK: TemplateTypeParmDecl 0x{{[0-9a-f]+}} <col:10, col:19> col:19 typename depth 0 index 0 T | ||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:22, line:[[# @LINE + 6]]:1> line:[[# @LINE + 4]]:29 struct MyBuffer2 definition | ||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:22, col:29> col:29 implicit struct MyBuffer2 | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:[[# @LINE + 3]]:3, col:51> col:51 h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| template<typename T> struct MyBuffer2 { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] h; | ||
| }; | ||
|
|
||
| // CHECK: ClassTemplateSpecializationDecl 0x{{[0-9a-f]+}} <line:[[# @LINE - 4]]:1, line:[[# @LINE - 2]]:1> line:[[# @LINE - 4]]:29 struct MyBuffer2 definition implicit_instantiation | ||
| // CHECK: TemplateArgument type 'float' | ||
| // CHECK: BuiltinType 0x{{[0-9a-f]+}} 'float' | ||
| // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} <col:22, col:29> col:29 implicit struct MyBuffer2 | ||
| // CHECK: FieldDecl 0x{{[0-9a-f]+}} <line:[[# @LINE - 7]]:3, col:51> col:51 h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| MyBuffer2<float> myBuffer2; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify | ||
|
|
||
| // expected-error@+1{{'resource_class' attribute cannot be applied to a declaration}} | ||
| [[hlsl::resource_class(UAV)]] __hlsl_resource_t e0; | ||
|
|
||
| // expected-error@+1{{'resource_class' attribute takes one argument}} | ||
| __hlsl_resource_t [[hlsl::resource_class()]] e1; | ||
|
|
||
| // expected-warning@+1{{ResourceClass attribute argument not supported: gibberish}} | ||
| __hlsl_resource_t [[hlsl::resource_class(gibberish)]] e2; | ||
|
|
||
| // expected-warning@+1{{attribute 'resource_class' is already applied with different arguments}} | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV)]] [[hlsl::resource_class(UAV)]] e3; | ||
|
|
||
| // expected-warning@+1{{attribute 'resource_class' is already applied}} | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV)]] [[hlsl::resource_class(SRV)]] e4; | ||
|
|
||
| // expected-error@+1{{'resource_class' attribute takes one argument}} | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV, "aa")]] e5; | ||
|
|
||
| // expected-error@+1{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} | ||
| float [[hlsl::resource_class(UAV)]] e6; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -ast-dump -o - %s | FileCheck %s | ||
|
|
||
| // CHECK: -ClassTemplateSpecializationDecl 0x{{[0-9a-f]+}} <<invalid sloc>> <invalid sloc> class RWBuffer definition implicit_instantiation | ||
| // CHECK: -TemplateArgument type 'float' | ||
| // CHECK: `-BuiltinType 0x{{[0-9a-f]+}} 'float' | ||
| // CHECK: -FieldDecl 0x{{[0-9a-f]+}} <<invalid sloc>> <invalid sloc> implicit h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(float)]] | ||
| // CHECK: -HLSLResourceAttr 0x{{[0-9a-f]+}} <<invalid sloc>> Implicit TypedBuffer | ||
| RWBuffer<float> Buffer1; | ||
|
|
||
| // CHECK: -ClassTemplateSpecializationDecl 0x{{[0-9a-f]+}} <<invalid sloc>> <invalid sloc> class RasterizerOrderedBuffer definition implicit_instantiation | ||
| // CHECK: -TemplateArgument type 'vector<float, 4>' | ||
| // CHECK: `-ExtVectorType 0x{{[0-9a-f]+}} 'vector<float, 4>' 4 | ||
| // CHECK: `-BuiltinType 0x{{[0-9a-f]+}} 'float' | ||
| // CHECK: -FieldDecl 0x{{[0-9a-f]+}} <<invalid sloc>> <invalid sloc> implicit h '__hlsl_resource_t | ||
| // CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::is_rov]] | ||
| // CHECK-SAME{LITERAL}: [[hlsl::contained_type(vector<float, 4>)]] | ||
| // CHECK: -HLSLResourceAttr 0x{{[0-9a-f]+}} <<invalid sloc>> Implicit TypedBuffer | ||
| RasterizerOrderedBuffer<vector<float, 4> > BufferArray3[4]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,65 @@ | ||
| // 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_asin_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_asin(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| svfloat32_t test_acos_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_acos(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| svfloat32_t test_atan_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_atan(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| svfloat32_t test_atan2_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_atan2(v, v); | ||
| // expected-error@-1 {{1st argument must be a floating point type}} | ||
| } | ||
|
|
||
| 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}} | ||
| } | ||
|
|
||
| svfloat32_t test_tan_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_tan(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| svfloat32_t test_sinh_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_sinh(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| svfloat32_t test_cosh_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_cosh(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| svfloat32_t test_tanh_vv_i8mf8(svfloat32_t v) { | ||
|
|
||
| return __builtin_elementwise_tanh(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,67 @@ | ||
| // 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_asin_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_asin(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_acos_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_acos(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_atan_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_atan(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_atan2_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_atan2(v, v); | ||
| // expected-error@-1 {{1st argument must be a floating point type}} | ||
| } | ||
|
|
||
| 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}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_tan_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_tan(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_sinh_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_sinh(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_cosh_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_cosh(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
||
| vfloat32mf2_t test_tanh_vv_i8mf8(vfloat32mf2_t v) { | ||
|
|
||
| return __builtin_elementwise_tanh(v); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,119 +1,119 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \ | ||
| // RUN: -fsyntax-only -verify %s | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.5))) | ||
| float fx(float); // #fx | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.6))) | ||
| half fx(half); // #fx_half | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = compute))) | ||
| float fy(float); // #fy | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = mesh))) | ||
| float fz(float); // #fz | ||
|
|
||
| float also_alive(float f) { | ||
| // expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} | ||
| float A = fx(f); // #also_alive_fx_call | ||
| // expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float B = fy(f); // #also_alive_fy_call | ||
| // expected-error@#also_alive_fz_call {{'fz' is unavailable}} | ||
| // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float C = fz(f); // #also_alive_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| float alive(float f) { | ||
| // expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} | ||
| float A = fx(f); // #alive_fx_call | ||
| // expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float B = fy(f); // #alive_fy_call | ||
| // expected-error@#alive_fz_call {{'fz' is unavailable}} | ||
| // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float C = fz(f); // #alive_fz_call | ||
|
|
||
| return also_alive(f); | ||
| } | ||
|
|
||
| float also_dead(float f) { | ||
| // unreachable code - no errors expected | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float C = fz(f); | ||
| return 0; | ||
| } | ||
|
|
||
| float dead(float f) { | ||
| // unreachable code - no errors expected | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float C = fz(f); | ||
|
|
||
| return also_dead(f); | ||
| } | ||
|
|
||
| template<typename T> | ||
| T aliveTemp(T f) { | ||
| // expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} | ||
| float A = fx(f); // #aliveTemp_fx_call | ||
| // expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float B = fy(f); // #aliveTemp_fy_call | ||
| // expected-error@#aliveTemp_fz_call {{'fz' is unavailable}} | ||
| // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float C = fz(f); // #aliveTemp_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| template<typename T> T aliveTemp2(T f) { | ||
| // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}} | ||
| // expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}} | ||
| // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} | ||
| return fx(f); // #aliveTemp2_fx_call | ||
| } | ||
|
|
||
| half test(half x) { | ||
| return aliveTemp2(x); | ||
| } | ||
|
|
||
| float test(float x) { | ||
| return aliveTemp2(x); | ||
| } | ||
|
|
||
| class MyClass | ||
| { | ||
| float F; | ||
| float makeF() { | ||
| // expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} | ||
| float A = fx(F); // #MyClass_makeF_fx_call | ||
| // expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float B = fy(F); // #MyClass_makeF_fy_call | ||
| // expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}} | ||
| // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} | ||
| float C = fz(F); // #MyClass_makeF_fz_call | ||
| return 0; | ||
| } | ||
| }; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| float main() { | ||
| float f = 3; | ||
| MyClass C = { 1.0f }; | ||
| float a = alive(f); | ||
| float b = aliveTemp<float>(f); // #aliveTemp_inst | ||
| float c = C.makeF(); | ||
| float d = test((float)1.0); | ||
| float e = test((half)1.0); | ||
| return a * b * c; | ||
| } |