[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-18 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,22 @@ +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not %if spirv-tools %{ llc -O0 -

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,22 @@ +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not %if spirv-tools %{ llc -O0 -

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -3030,6 +3031,15 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, return selectExtInst(ResVReg, ResType, I, CL::fract, GL::Fract); case Intrinsic::spv_normalize: return selectExtInst(ResVReg, ResType, I, CL::normalize, GL::Normalize); + case In

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 22d4ff155aadf0f098dd5dc48d9038da15108937 782e1a28d4f8ddbeb92a9c57b3f071ba837ce129 --e

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron updated https://github.com/llvm/llvm-project/pull/122992 >From 7ddd5b264731ef375d99d012d9fbfd54c744e5b2 Mon Sep 17 00:00:00 2001 From: Icohedron Date: Mon, 13 Jan 2025 21:23:31 + Subject: [PATCH 1/5] Implement `reflect` HLSL function --- clang/include/clang/Ba

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
farzonl wrote: > Will a follow-up issue be created to move the useful `Sema` helpers into a > common file? I'm fine if you want to do this as a follow up. https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@list

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
farzonl wrote: > This pr LGTM once the graceful exit comment is handled. > > With respect to [this > comment](https://github.com/llvm/llvm-project/pull/122992#discussion_r1917127000). > Is the final solution to just gracefully exit or is this an intermediate > step and an issue will be used t

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,32 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 + +// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s farzonl wrote: The clang codgen tests should be suf

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Finn Plummer via cfe-commits
https://github.com/inbelic approved this pull request. This pr LGTM once the graceful exit comment is handled. With respect to [this comment](https://github.com/llvm/llvm-project/pull/122992#discussion_r1917127000). Is the final solution to just gracefully exit or is this an intermediate step

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Finn Plummer via cfe-commits
@@ -0,0 +1,32 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 + +// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s inbelic wrote: Do we also want to test a DirectX ta

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Finn Plummer via cfe-commits
https://github.com/inbelic edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Farzon Lotfi via cfe-commits
@@ -2944,6 +2944,10 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, return selectExtInst(ResVReg, ResType, I, CL::fract, GL::Fract); case Intrinsic::spv_normalize: return selectExtInst(ResVReg, ResType, I, CL::normalize, GL::Normalize); + case In

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron ready_for_review https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron updated https://github.com/llvm/llvm-project/pull/122992 >From 3f3b8c75c14bb9b3ed611c9cddec49d0e9339705 Mon Sep 17 00:00:00 2001 From: Icohedron Date: Mon, 13 Jan 2025 21:23:31 + Subject: [PATCH 1/4] Implement `reflect` HLSL function --- clang/include/clang/Ba

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-16 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron updated https://github.com/llvm/llvm-project/pull/122992 >From 3f3b8c75c14bb9b3ed611c9cddec49d0e9339705 Mon Sep 17 00:00:00 2001 From: Icohedron Date: Mon, 13 Jan 2025 21:23:31 + Subject: [PATCH 1/3] Implement `reflect` HLSL function --- clang/include/clang/Ba

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Finn Plummer via cfe-commits
@@ -51,6 +51,38 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_reflect: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; + +ExprResult A = TheCall->getArg(0)

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,33 @@ +; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s farzonl wrote: This won't be a problem for opencl because they don't have a reflect api to trigger this crash. This could be a problem if folks try to target spirv32/spirv64

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -51,6 +51,38 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_reflect: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; + +ExprResult A = TheCall->getArg(0)

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Deric Cheung via cfe-commits
@@ -0,0 +1,33 @@ +; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s Icohedron wrote: Changing the triple to `-mtriple=spirv32-unknown-unknown` does indeed cause the test to fail at instruction selection ``` FAIL: LLVM ::

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify + +float test_no_second_arg(float2 p0) { + return reflect(p0); + // expected-error@-1 {{no matching function

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Finn Plummer via cfe-commits
@@ -51,6 +51,38 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_reflect: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; + +ExprResult A = TheCall->getArg(0)

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Finn Plummer via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify + +float test_no_second_arg(float2 p0) { + return reflect(p0); + // expected-error@-1 {{no matching function

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Finn Plummer via cfe-commits
@@ -0,0 +1,33 @@ +; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s inbelic wrote: Out of curiousity, what happens when we use the triple `-mtriple=spirv32-unknown-unknown`? This should change the environment to be `OpenCL`, will it fail beca

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Finn Plummer via cfe-commits
@@ -51,6 +51,38 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_reflect: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; + +ExprResult A = TheCall->getArg(0)

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Deric Cheung via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Deric Cheung via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Deric Cheung via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron converted_to_draft https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-15 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,195 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-14 Thread Deric Cheung via cfe-commits
https://github.com/Icohedron edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits