-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Implement the and
HLSL Function
#125604
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I'll implement it! |
Addresses #125604 - Implements `and` as an HLSL builtin function - The `and` HLSL builtin function gets lowered to the the LLVM `and` instruction
@llvm/issue-subscribers-clang-codegen Author: Farzon Lotfi (farzonl)
- [ ] Implement the `and` api in `hlsl_intrinsics.h`
~~- [ ] Investigate to see if we can use `__builtin_reduce_and`~~
- [ ] If a clang builtin is needed add sema checks for `and` to `CheckHLSLBuiltinFunctionCall` in `SemaHLSL.cpp`
- [ ] If codegen is needed, add codegen for `and` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/and.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/and-errors.hlsl`
DirectXThere were no DXIL opcodes found for SPIR-VThere were no SPIR-V opcodes found for Test Case(s)Example 1//dxc and_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export bool4 fn(bool4 p1, bool4 p2) {
return and(p1, p2);
} HLSL:Logically Syntaxbool<> and(bool<> x, bool<> y); Type Description
Minimum Shader ModelThis function is supported in the following shader models.
Shader StagesAll Shader Stages RemarksIn HLSL 2021 int3 X = {1, 1, 1};
int3 Y = {0, 0, 0};
bool3 Cond = X && Y; See also |
@llvm/issue-subscribers-clang-frontend Author: Farzon Lotfi (farzonl)
- [ ] Implement the `and` api in `hlsl_intrinsics.h`
~~- [ ] Investigate to see if we can use `__builtin_reduce_and`~~
- [ ] If a clang builtin is needed add sema checks for `and` to `CheckHLSLBuiltinFunctionCall` in `SemaHLSL.cpp`
- [ ] If codegen is needed, add codegen for `and` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/and.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/and-errors.hlsl`
DirectXThere were no DXIL opcodes found for SPIR-VThere were no SPIR-V opcodes found for Test Case(s)Example 1//dxc and_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export bool4 fn(bool4 p1, bool4 p2) {
return and(p1, p2);
} HLSL:Logically Syntaxbool<> and(bool<> x, bool<> y); Type Description
Minimum Shader ModelThis function is supported in the following shader models.
Shader StagesAll Shader Stages RemarksIn HLSL 2021 int3 X = {1, 1, 1};
int3 Y = {0, 0, 0};
bool3 Cond = X && Y; See also |
and
api inhlsl_intrinsics.h
- [ ] Investigate to see if we can use__builtin_reduce_and
and
toCheckHLSLBuiltinFunctionCall
inSemaHLSL.cpp
and
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/and.hlsl
clang/test/SemaHLSL/BuiltIns/and-errors.hlsl
DirectX
There were no DXIL opcodes found for
and
.SPIR-V
There were no SPIR-V opcodes found for
and
.Test Case(s)
Example 1
HLSL:
Logically
and
s a vector and produces a bool vector outputSyntax
bool<> and(bool<> x, bool<> y);
Type Description
Minimum Shader Model
This function is supported in the following shader models.
Shader Stages
All Shader Stages
Remarks
In HLSL 2021
and(X, Y);
is a replacement forSee also
The text was updated successfully, but these errors were encountered: