[llvm] [AMDGPU][True16][CodeGen] true16 codegen for bswap (PR #122849)

Brox Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 07:27:23 PST 2025


================
@@ -3039,6 +3041,19 @@ def : GCNPat <
   (i32 (zext (bswap i16:$a))),
   (V_PERM_B32_e64  (i32 0), VSrc_b32:$a, (S_MOV_B32 (i32 0x0c0c0001)))
 >;
+}
+
+let True16Predicate = UseRealTrue16Insts in {
+def : GCNPat <
+  (i16 (bswap i16:$a)),
+  (EXTRACT_SUBREG (V_PERM_B32_e64  (i32 0), (COPY VGPR_16:$a), (S_MOV_B32 (i32 0x0c0c0001))), lo16)
+>;
+
+def : GCNPat <
+  (i32 (zext (bswap i16:$a))),
----------------
broxigarchen wrote:

Hi Matt. From the pattern this is zero filling so it should be zext. 

This is following the existing pattern here https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/SIInstructions.td#L3039

https://github.com/llvm/llvm-project/pull/122849


More information about the llvm-commits mailing list