Skip to content

Commit e8d3fe7

Browse files
authored
Merge branch 'main' into user/alsepkow/UpdateGitHubActions
2 parents 809d2ae + 3ddf29b commit e8d3fe7

6 files changed

Lines changed: 58 additions & 2 deletions

File tree

.github/workflows/clang-format-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020

2121
- name: Get changed files
2222
id: changed-files
23-
uses: tj-actions/changed-files@v41
23+
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
2424
with:
2525
separator: ","
26-
fetch_depth: 100 # Fetches only the last 100 commits
26+
skip_initial_fetch: true
2727

2828
- name: "Listed files"
2929
env:

tools/clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7549,6 +7549,8 @@ def err_hlsl_vector_element_index_out_of_bounds: Error<
75497549
"vector element index '%0' is out of bounds">;
75507550
def err_hlsl_vector_member_too_many_positions: Error<
75517551
"more than four positions are referenced in '%0'">;
7552+
def err_hlsl_vector_member_on_long_vector: Error<
7553+
"invalid swizzle '%0' on vector of over 4 elements.">;
75527554
def err_hlsl_missing_type_specifier : Error< // Patterened after err_missing_type_specifier
75537555
"HLSL requires a type specifier for all declarations">;
75547556
def err_hlsl_multiple_concrete_bases : Error<

tools/clang/lib/SPIRV/SpirvBuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,8 @@ SpirvInstruction *SpirvBuilder::createEmulatedBitFieldExtract(
994994
rightShift->setResultType(baseType);
995995
}
996996

997+
rightShift->setRValue(true);
998+
997999
return rightShift;
9981000
}
9991001

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8643,6 +8643,9 @@ ExprResult HLSLExternalSource::LookupVectorMemberExprForHLSL(
86438643
llvm_unreachable("Unknown VectorMemberAccessError value");
86448644
}
86458645

8646+
if (colCount > 4)
8647+
msg = diag::err_hlsl_vector_member_on_long_vector;
8648+
86468649
if (msg != 0) {
86478650
m_sema->Diag(MemberLoc, msg) << memberText;
86488651

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %dxc -T cs_6_2 -E main -spirv -fcgl -enable-16bit-types %s | FileCheck %s
2+
3+
struct S1
4+
{
5+
uint16_t a : 8;
6+
};
7+
8+
S1 foo()
9+
{
10+
return (S1)0;
11+
}
12+
13+
[numthreads(1, 1, 1)]
14+
void main() {
15+
uint16_t test = foo().a;
16+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Function_ushort %temp_var_S1 %int_0
17+
// CHECK: [[raw:%[0-9]+]] = OpLoad %ushort [[ptr]]
18+
// CHECK: [[tmp:%[0-9]+]] = OpShiftLeftLogical %ushort [[raw]] %uint_8
19+
// CHECK: [[out:%[0-9]+]] = OpShiftRightLogical %ushort [[tmp]] %uint_8
20+
// CHECK-NOT: OpLoad %ushort [[out]]
21+
// CHECK: OpStore %test [[out]]
22+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %dxc -Tlib_6_9 -verify %s -DTYPE=float
2+
// RUN: %dxc -Tlib_6_9 -verify %s -DTYPE=bool
3+
// RUN: %dxc -Tlib_6_9 -verify %s -DTYPE=uint64_t
4+
// RUN: %dxc -Tlib_6_9 -verify %s -DTYPE=double
5+
// RUN: %dxc -Tlib_6_9 -verify %s -enable-16bit-types -DTYPE=float16_t
6+
// RUN: %dxc -Tlib_6_9 -verify %s -enable-16bit-types -DTYPE=int16_t
7+
8+
export
9+
vector<double, 3> doit(vector<double, 5> vec5) {
10+
vec5.x = 1; // expected-error {{invalid swizzle 'x' on vector of over 4 elements.}}
11+
return vec5.xyw; // expected-error {{invalid swizzle 'xyw' on vector of over 4 elements.}}
12+
}
13+
14+
export
15+
TYPE arr_to_vec(TYPE arr[5]) {
16+
17+
TYPE val = (vector<TYPE, 6>(arr, 1)).x; // expected-error {{invalid swizzle 'x' on vector of over 4 elements.}}
18+
19+
TYPE val2 = ((vector<TYPE, 5>)arr).x; // expected-error {{invalid swizzle 'x' on vector of over 4 elements.}}
20+
21+
return val;
22+
}
23+
24+
export TYPE lv_ctor(TYPE s) {
25+
TYPE ret = (vector<TYPE,6>(1, 2, 3, 4, 5, s)).x; // expected-error {{invalid swizzle 'x' on vector of over 4 elements.}}
26+
return ret;
27+
}

0 commit comments

Comments
 (0)