linuxrocks123 wrote:
@arsenm okay, comments dealt with. If you'd like to preserve the global isel
error, I should revert or partially revert the last commit. Otherwise, LGTM?
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing l
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From 96825875e1c8bad9a9b3b28fe943a5469f94c575 Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 01/13] Initial work
---
clang/include/clang/Basic/Built
@@ -0,0 +1,96 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps i32 @bcnt032_not_for_vregs(i64 %val) {
+; CHECK-LABEL: bcnt032_not_for_vregs:
+;
@@ -0,0 +1,96 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps i32 @bcnt032_not_for_vregs(i64 %val) {
linuxrocks123 wrote:
Don
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
linuxrocks123 wrote:
@arsenm
```LLVM ERROR: unable to map instruction: %8:sreg_32
@@ -0,0 +1,96 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps i32 @bcnt032_not_for_vregs(i64 %val) {
linuxrocks123 wrote:
Don
linuxrocks123 wrote:
@arsenm just saw your testcase comments. One sec.
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
linuxrocks123 wrote:
@arsenm LGTM?
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From 96825875e1c8bad9a9b3b28fe943a5469f94c575 Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 01/12] Initial work
---
clang/include/clang/Basic/Built
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps void @bcnt032_not_for_vregs(ptr addrspace(1) %out, ptr
addrspace(1) %in) {
+; C
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps void @bcnt032_not_for_vregs(ptr addrspace(1) %out, ptr
addrspace(1) %in) {
+; C
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 01/12] Initial work
---
clang/include/clang/Basic/Built
@@ -1884,6 +1886,13 @@ def : GCNPat <
(S_MOV_B32 (i32 0)), sub1))
>;
+def : GCNPat <
+ (i64 (UniformBinFrag 64, (ctpop i64:$src))),
+(i64 (REG_SEQUENCE SReg_64,
+ (i32 (COPY_TO_REGCLASS (S_BCNT0_I32_B64 $src), SReg_32)), sub0,
linuxrocks123 wrot
@@ -1884,6 +1886,13 @@ def : GCNPat <
(S_MOV_B32 (i32 0)), sub1))
>;
+def : GCNPat <
+ (i64 (UniformBinFrag 64, (ctpop i64:$src))),
+(i64 (REG_SEQUENCE SReg_64,
+ (i32 (COPY_TO_REGCLASS (S_BCNT0_I32_B64 $src), SReg_32)), sub0,
linuxrocks123 wrot
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps void @bcnt032_not_for_vregs(ptr addrspace(1) %out, ptr
addrspace(1) %in) {
+; C
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 01/11] Initial work
---
clang/include/clang/Basic/Built
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
+
+define amdgpu_ps void @bcnt032_not_for_vregs(ptr addrspace(1) %out, ptr
addrspace(1) %in) {
+; C
@@ -0,0 +1,110 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s
linuxrocks123 wrote:
@jayfoad, the negative tests crash Global ISel, so I can't ad
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 01/10] Initial work
---
clang/include/clang/Basic/Built
@@ -625,3 +622,111 @@ if:
endif:
ret i32 1
}
+
+define amdgpu_ps void @bcnt032_not_for_vregs(ptr addrspace(1) %out, ptr
addrspace(1) %in) {
linuxrocks123 wrote:
Done
https://github.com/llvm/llvm-project/pull/164847
_
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 1/9] Initial work
---
clang/include/clang/Basic/Builtin
@@ -264,7 +264,9 @@ def S_BREV_B64 : SOP1_64 <"s_brev_b64",
} // End isReMaterializable = 1, isAsCheapAsAMove = 1
let Defs = [SCC] in {
-def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">;
+def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32",
+ [(set i32:$sdst, (UniformBinFrag 32
@@ -1884,6 +1886,13 @@ def : GCNPat <
(S_MOV_B32 (i32 0)), sub1))
>;
+def : GCNPat <
+ (i64 (UniformBinFrag 64, (UniformUnaryFrag i64:$src))),
linuxrocks123 wrote:
Done
https://github.com/llvm/llvm-project/pull/164847
_
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -465,17 +463,16 @@ define amdgpu_ps i32 @bcnt032(i32 inreg %val0) {
define amdgpu_ps i32 @bcnt064(i64 inreg %val0) {
; CHECK-LABEL: bcnt064:
; CHECK: ; %bb.0:
-; CHECK-NEXT:s_bcnt1_i32_b64 s0, s[0:1]
-; CHECK-NEXT:s_sub_u32 s0, 64, s0
-; CHECK-NEXT:s_subb_u
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 1/8] Initial work
---
clang/include/clang/Basic/Builtin
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2359,6 +2359,12 @@ def int_amdgcn_mbcnt_hi :
DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
[IntrNoMem]>;
+def int_amdgcn_bcnt32_lo :
linuxrocks123 wrote:
@arsenm were you referring to the Clang intrinsic or this code here?
@@ -2359,6 +2359,12 @@ def int_amdgcn_mbcnt_hi :
DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
[IntrNoMem]>;
+def int_amdgcn_bcnt32_lo :
linuxrocks123 wrote:
@jayfoad there is no change to Clang introducing an intrinsic now.
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 1/6] Initial work
---
clang/include/clang/Basic/Builtin
@@ -1977,6 +1989,37 @@ Value
*AMDGPUCodeGenPrepareImpl::applyFractPat(IRBuilder<> &Builder,
return insertValues(Builder, FractArg->getType(), ResultVals);
}
+bool AMDGPUCodeGenPrepareImpl::visitCtpop(IntrinsicInst &I) {
+ uint32_t BitWidth, DestinationWidth, IntrinsicWidth
@@ -1977,6 +1989,37 @@ Value
*AMDGPUCodeGenPrepareImpl::applyFractPat(IRBuilder<> &Builder,
return insertValues(Builder, FractArg->getType(), ResultVals);
}
+bool AMDGPUCodeGenPrepareImpl::visitCtpop(IntrinsicInst &I) {
+ uint32_t BitWidth, DestinationWidth, IntrinsicWidth
@@ -1977,6 +1989,37 @@ Value
*AMDGPUCodeGenPrepareImpl::applyFractPat(IRBuilder<> &Builder,
return insertValues(Builder, FractArg->getType(), ResultVals);
}
+bool AMDGPUCodeGenPrepareImpl::visitCtpop(IntrinsicInst &I) {
+ uint32_t BitWidth, DestinationWidth, IntrinsicWidth
@@ -1977,6 +1989,37 @@ Value
*AMDGPUCodeGenPrepareImpl::applyFractPat(IRBuilder<> &Builder,
return insertValues(Builder, FractArg->getType(), ResultVals);
}
+bool AMDGPUCodeGenPrepareImpl::visitCtpop(IntrinsicInst &I) {
+ uint32_t BitWidth, DestinationWidth, IntrinsicWidth
@@ -2359,6 +2359,12 @@ def int_amdgcn_mbcnt_hi :
DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
[IntrNoMem]>;
+def int_amdgcn_bcnt32_lo :
linuxrocks123 wrote:
Removed.
https://github.com/llvm/llvm-project/pull/164847
_
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 1/5] Initial work
---
clang/include/clang/Basic/Builtin
@@ -63,6 +63,9 @@ BUILTIN(__builtin_amdgcn_grid_size_z, "Ui", "nc")
BUILTIN(__builtin_amdgcn_mbcnt_hi, "UiUiUi", "nc")
BUILTIN(__builtin_amdgcn_mbcnt_lo, "UiUiUi", "nc")
+BUILTIN(__builtin_amdgcn_bcnt32_lo, "UiUi", "nc")
+BUILTIN(__builtin_amdgcn_bcnt64_lo, "UiWUi", "nc")
@@ -465,17 +463,15 @@ define amdgpu_ps i32 @bcnt032(i32 inreg %val0) {
define amdgpu_ps i32 @bcnt064(i64 inreg %val0) {
; CHECK-LABEL: bcnt064:
; CHECK: ; %bb.0:
-; CHECK-NEXT:s_bcnt1_i32_b64 s0, s[0:1]
-; CHECK-NEXT:s_sub_u32 s0, 64, s0
-; CHECK-NEXT:s_subb_u
https://github.com/linuxrocks123 edited
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/linuxrocks123 ready_for_review
https://github.com/llvm/llvm-project/pull/164847
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/linuxrocks123 updated
https://github.com/llvm/llvm-project/pull/164847
>From ddda6473ab7ae8485a906a749eebad0853b857ca Mon Sep 17 00:00:00 2001
From: Patrick Simmons
Date: Thu, 23 Oct 2025 11:50:32 -0500
Subject: [PATCH 1/2] Initial work
---
clang/include/clang/Basic/Builtin
https://github.com/linuxrocks123 created
https://github.com/llvm/llvm-project/pull/164847
This PR optimizes the pattern bitsin(typeof(x)) - popcnt(x) to s_bcnt0_i32 on
AMDGPU. It also creates a Blang builtin for s_bcnt0_i32 so that users can call
this instruction directly instead of relying o
46 matches
Mail list logo