[llvm] [AMDGPU][GlobalISel] Combine (or s64, zext(s32)) (PR #151519)

Mirko BrkuĊĦanin via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 10:05:01 PDT 2025


================
@@ -151,6 +151,21 @@ def zext_of_shift_amount_combines : GICombineGroup<[
   canonicalize_zext_lshr, canonicalize_zext_ashr, canonicalize_zext_shl
 ]>;
 
+// (or i64:x, (zext i32:y)) -> i64:(merge (or i32:y, lo_32(x)), hi_32(x))
+def combine_or_s64_s32 : GICombineRule<
+  (defs root:$dst),
+  (match (G_ZEXT $zext_val, i32:$src_s32):$zext_inst,
+         (G_OR $dst, i64:$src_s64, $zext_val):$dst),
+  (apply [{ Helper.applyCombineOrS64S32(*${dst}, ${src_s64}.getReg(), ${src_s32}.getReg()); }])>;
+
+// (and i64:x, 0xFFFFFFFF00000000) -> i64:(merge i32:0, hi_32(x))
----------------
mbrkusanin wrote:

I've moved this to a separate PR: https://github.com/llvm/llvm-project/pull/151731

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


More information about the llvm-commits mailing list