[llvm] [AMDGPU] - Add bitreplicate const folding tests (PR #72649)
Jessica Del via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 17 05:09:32 PST 2023
https://github.com/OutOfCache created https://github.com/llvm/llvm-project/pull/72649
Add more test cases for `s_bitreplicate` constant folding.
>From 288b7204b22a8afc326513065100629000ce4834 Mon Sep 17 00:00:00 2001
From: Jessica Del <Jessica.Del at amd.com>
Date: Fri, 17 Nov 2023 13:49:36 +0100
Subject: [PATCH] [AMDGPU] - Add bitreplicate const folding tests
Add more test cases for `s_bitreplicate` constant folding.
---
.../AMDGPU/llvm.amdgcn.bitreplicate.ll | 46 +++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.bitreplicate.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.bitreplicate.ll
index 0937280e6352c80..815e5c709ff7cb9 100644
--- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.bitreplicate.ll
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.bitreplicate.ll
@@ -16,6 +16,52 @@ entry:
ret i64 %br
}
+define i64 @test_s_bitreplicate_constant_zero() {
+; GFX11-LABEL: test_s_bitreplicate_constant_zero:
+; GFX11: ; %bb.0: ; %entry
+; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; GFX11-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 0
+; GFX11-NEXT: s_setpc_b64 s[30:31]
+entry:
+ %br = call i64 @llvm.amdgcn.s.bitreplicate(i32 0)
+ ret i64 %br
+}
+
+define i64 @test_s_bitreplicate_constant_neg_one() {
+; GFX11-LABEL: test_s_bitreplicate_constant_neg_one:
+; GFX11: ; %bb.0: ; %entry
+; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; GFX11-NEXT: v_dual_mov_b32 v0, -1 :: v_dual_mov_b32 v1, -1
+; GFX11-NEXT: s_setpc_b64 s[30:31]
+entry:
+ %br = call i64 @llvm.amdgcn.s.bitreplicate(i32 -1)
+ ret i64 %br
+}
+
+define i64 @test_s_bitreplicate_constant_undef() {
+; GFX11-LABEL: test_s_bitreplicate_constant_undef:
+; GFX11: ; %bb.0: ; %entry
+; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; GFX11-NEXT: s_bitreplicate_b64_b32 s[0:1], s0
+; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
+; GFX11-NEXT: s_setpc_b64 s[30:31]
+entry:
+ %br = call i64 @llvm.amdgcn.s.bitreplicate(i32 undef)
+ ret i64 %br
+}
+
+define i64 @test_s_bitreplicate_constant_poison() {
+; GFX11-LABEL: test_s_bitreplicate_constant_poison:
+; GFX11: ; %bb.0: ; %entry
+; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; GFX11-NEXT: s_bitreplicate_b64_b32 s[0:1], s0
+; GFX11-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
+; GFX11-NEXT: s_setpc_b64 s[30:31]
+entry:
+ %br = call i64 @llvm.amdgcn.s.bitreplicate(i32 poison)
+ ret i64 %br
+}
+
define amdgpu_cs void @test_s_bitreplicate_sgpr(i32 inreg %mask, ptr addrspace(1) %out) {
; GFX11-LABEL: test_s_bitreplicate_sgpr:
; GFX11: ; %bb.0: ; %entry
More information about the llvm-commits
mailing list