[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-18 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-17 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/108121 >From ebb4078d485559f70d79d3b10dc9f4ce401a3261 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Sep 2024 21:03:05 + Subject: [PATCH 1/3] implement elementwise popcount to implement countbits --- clang

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-17 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon approved this pull request. LGTM after @farzonl minors have been addressed - once this is committed I'm intending to use `__builtin_elementwise_popcount` to simplify a number of C++ target intrinsics that do the same thing. https://github.com/llvm/llvm-project/pull/1

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl approved this pull request. https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -finclude-default-header +// -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only +// -disable-llvm-passes -verify + + +double test_int_builtin(double p0) { + return countbits(p0); + // expected-error@-1 {{call to 'cou

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -finclude-default-header +// -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only +// -disable-llvm-passes -verify + + +double test_int_builtin(double p0) { + return countbits(p0); + // expected-error@-1 {{call to 'cou

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,28 @@ +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; Make sure dxil operation function calls for countbits are generated for all integer types. + +define noundef i16 @test_countbits_short(i16 noundef %a) { +entry: +; CHECK

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,21 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; CHECK: OpMemoryModel Logical GLSL450 + +define noundef i32 @co

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,28 @@ +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; Make sure dxil operation function calls for countbits are generated for all integer types. + +define noundef i16 @test_countbits_short(i16 noundef %a) { +entry: +; CHECK

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,28 @@ +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s farzonl wrote: so I don't have to clean this up later can you change this to ```suggestion ; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shader

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,80 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s + +#ifdef __HLSL_ENABLE_16_BIT +// CHECK: define nound

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/108121 >From 4a892930ab4d97b5621d8066b23c48c7278d14e0 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Sep 2024 21:03:05 + Subject: [PATCH 1/2] implement elementwise popcount to implement countbits --- clang

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Damyan Pepper via cfe-commits
damyanp wrote: Seems that this change is doing a bit more than just adding a new version of popcount. Can the description be updated appropriately please? https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-12 Thread Simon Pilgrim via cfe-commits
@@ -505,6 +505,27 @@ void test_builtin_elementwise_log2(int i, float f, double d, float4 v, int3 iv, // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}} } +void test_builtin_elementwise_popcount(int i, f

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
farzonl wrote: Code looks fine, I need to see more tests before I can sign off. https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
farzonl wrote: Also we probably still want a `clang/test/SemaHLSL/BuiltIns/countbits-errors.hlsl` to check the errors for float representations. https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
farzonl wrote: I don't see a `clang/test/CodeGenHLSL/builtins/countbits.hlsl` https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
@@ -1522,6 +1522,14 @@ bool CheckUnsignedIntRepresentation(Sema *S, CallExpr *TheCall) { checkAllUnsignedTypes); } +bool CheckIntRepresentation(Sema *S, CallExpr *TheCall) { farzonl wrote: It doesn't seem like this function

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon commented: Please can you fix the clang-format warnings? https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Simon Pilgrim via cfe-commits
RKSimon wrote: I'd recommend you add it to the "C++ Language Changes" section. https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Xiang Li via cfe-commits
python3kgae wrote: > > > This pull request is missing the appropriate text in 'ReleaseNotes.rst'. > > > I am looking for advice on what is appropriate to put in that file, and > > > where. > > > > > > Here's a PR with ReleaseNotes.rst change > > [57f879c#diff-ec770381d76c859f5f572db789175fe4

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Sarah Spall via cfe-commits
spall wrote: > > This pull request is missing the appropriate text in 'ReleaseNotes.rst'. I > > am looking for advice on what is appropriate to put in that file, and where. > > Here's a PR with ReleaseNotes.rst change > [57f879c#diff-ec770381d76c859f5f572db789175fe44410a72608f58ad5dbb14335ba56

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,31 @@ +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; Make sure dxil operation function calls for countbits are generated for all integer types. + +; Function Attrs: nounwind +define noundef i16 @test_countbits_short(i16 no

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,31 @@ +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; Make sure dxil operation function calls for countbits are generated for all integer types. + +; Function Attrs: nounwind +define noundef i16 @test_countbits_short(i16 no

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,10 @@ +; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s + +; DXIL operation ctpop does not support double overload type +; CHECK: invalid intrinsic signature + +define noundef double @countbits_double(double noundef %a) {

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Xiang Li via cfe-commits
python3kgae wrote: > This pull request is missing the appropriate text in 'ReleaseNotes.rst'. I am > looking for advice on what is appropriate to put in that file, and where. Here's a PR with ReleaseNotes.rst change https://github.com/llvm/llvm-project/commit/57f879cdd4c63189c569bdc1ce4e87e734

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-10 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 109cd11dc4aea6b3596f8b2cb5a719f35b190cfa 365886deae6e35ee2761c2fae2a28caa0e214880 --e

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-10 Thread Sarah Spall via cfe-commits
spall wrote: This pull request is missing the appropriate text in 'ReleaseNotes.rst'. I am looking for advice on what is appropriate to put in that file, and where. https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-comm

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-10 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Sarah Spall (spall) Changes Implement elementwise popcount to support HLSL function 'countbits'. Closes #99094 --- Full diff: https://github.com/llvm/llvm-project/pull/108121.diff 13 Files Affected: - (modified) clang/docs/LanguageExt

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-10 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/108121 Implement elementwise popcount to support HLSL function 'countbits'. Closes #99094 >From 365886deae6e35ee2761c2fae2a28caa0e214880 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Sep 2024 21:03:05 +