-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Hlsl asint16 intrinsic #131900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Hlsl asint16 intrinsic #131900
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1e34c54
Add codegen tests, Sema tests, SPIR-V backend test case, and apply cl…
metkarpoonam 08342e9
Apply clang formatting and address review comments
metkarpoonam 2d38c1e
Apply clang format to hlsl_intrinsics.h
metkarpoonam 6d40ffc
Apply clang-format on hlsl_intrinsic.h
metkarpoonam 7efe2f0
Modify asint16-error and added vector test cases to bitcast.ll
metkarpoonam 9501cd1
Remove asint16.ll
metkarpoonam 17e6db7
Remove vector int16 test case
metkarpoonam 999943e
Address review comment and fixed bitcast.ll test cases failure
metkarpoonam 16e48c1
Address review comment
metkarpoonam a908b64
Add missing result name of opBitcast
metkarpoonam 9352d4b
Add new line to asint16-errors.hlsl
metkarpoonam c52c19a
Update llvm/test/CodeGen/SPIRV/bitcast.ll
metkarpoonam fdb40ea
Address review comments
metkarpoonam e49c5fb
Small change
metkarpoonam f8f20b8
Fix codegen test failure
metkarpoonam d0dfbe1
Add Shadermodel 6.2 macro to hlsl_intrinsics.h
metkarpoonam c3ad75e
Merge branch 'main' into hlsl_asint16_intrinsic
metkarpoonam b578c42
Apply clang format on hlsl_intrinsics.h
metkarpoonam 9aefe01
Rearrange asint16 function in hlsl_intrinsics.h to maintain alphabeti…
metkarpoonam 9344014
Merge branch 'main' into hlsl_asint16_intrinsic
metkarpoonam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s | ||
|
||
//CHECK-LABEL: define {{.*}}test_ints | ||
//CHECK-SAME: {{.*}}(i16 {{.*}} [[VAL:%.*]]){{.*}} | ||
//CHECK-NOT: bitcast | ||
//CHECK: entry: | ||
//CHECK-NEXT: ret i16 [[VAL]] | ||
int16_t test_int(int16_t p0) | ||
{ | ||
return asint16(p0); | ||
} | ||
|
||
//CHECK-LABEL: define {{.*}}test_uint | ||
//CHECK-SAME: {{.*}}(i16 {{.*}} [[VAL:%.*]]){{.*}} | ||
//CHECK-NOT:bitcast | ||
//CHECK: entry: | ||
//CHECK-NEXT: ret i16 [[VAL]] | ||
int16_t test_uint(uint16_t p0) | ||
{ | ||
return asint16(p0); | ||
} | ||
|
||
//CHECK-LABEL: define {{.*}}test_half | ||
//CHECK-SAME: {{.*}}(half {{.*}} [[VAL:%.*]]){{.*}} | ||
//CHECK: [[RES:%.*]] = bitcast half [[VAL]] to i16 | ||
//CHECK-NEXT : ret i16 [[RES]] | ||
int16_t test_half(half p0) | ||
{ | ||
return asint16(p0); | ||
} | ||
|
||
//CHECK-LABEL: define {{.*}}test_vector_int | ||
//CHECK-SAME: {{.*}}(<4 x i16> {{.*}} [[VAL:%.*]]){{.*}} | ||
//CHECK-NOT: bitcast | ||
//CHECK: entry: | ||
//CHECK-NEXT: ret <4 x i16> [[VAL]] | ||
int16_t4 test_vector_int(int16_t4 p0) | ||
{ | ||
return asint16(p0); | ||
} | ||
|
||
//CHECK-LABEL: define {{.*}}test_vector_uint | ||
//CHECK-SAME: {{.*}}(<4 x i16> {{.*}} [[VAL:%.*]]){{.*}} | ||
//CHECK-NOT: bitcast | ||
//CHECK-NEXT: entry: | ||
//CHECK-NEXT: ret <4 x i16> [[VAL]] | ||
int16_t4 test_vector_uint(uint16_t4 p0) | ||
{ | ||
return asint16(p0); | ||
} | ||
|
||
//CHECK-LABEL: define {{.*}}fn | ||
//CHECK-SAME: {{.*}}(<4 x half> {{.*}} [[VAL:%.*]]){{.*}} | ||
//CHECK: [[RES:%.*]] = bitcast <4 x half> [[VAL]] to <4 x i16> | ||
//CHECK-NEXT: ret <4 x i16> [[RES]] | ||
int16_t4 fn(half4 p1) | ||
{ | ||
return asint16(p1); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -verify | ||
|
||
|
||
int16_t4 test_asint16_too_many_arg(uint16_t p0, uint16_t p1) | ||
{ | ||
return asint16(p0, p1); | ||
// expected-error@-1 {{no matching function for call to 'asint16'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires single argument 'V', but 2 arguments were provided}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires single argument 'F', but 2 arguments were provided}} | ||
} | ||
|
||
int16_t test_asint16_int(int p1) | ||
{ | ||
return asint16(p1); | ||
// expected-error@-1 {{no matching function for call to 'asint16'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: could not match 'vector<T, N>' against 'int'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = int]: no type named 'Type'}} | ||
} | ||
|
||
int16_t test_asint16_float(float p1) | ||
{ | ||
return asint16(p1); | ||
// expected-error@-1 {{no matching function for call to 'asint16'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: could not match 'vector<T, N>' against 'float'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float]: no type named 'Type'}} | ||
} | ||
|
||
int16_t4 test_asint16_vector_int(int4 p1) | ||
{ | ||
return asint16(p1); | ||
// expected-error@-1 {{no matching function for call to 'asint16'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = int, N = 4]: no type named 'Type'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = int4]: no type named 'Type'}} | ||
} | ||
|
||
int16_t4 test_asint16_vector_float(float4 p1) | ||
{ | ||
return asint16(p1); | ||
// expected-error@-1 {{no matching function for call to 'asint16'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float, N = 4]: no type named 'Type'}} | ||
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float4]: no type named 'Type'}} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.