[llvm] [AMDGPU] Swap select operands to allow later v_cndmask shrinking into vop2 (PR #142354)
Ana Mihajlovic via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 04:45:14 PDT 2025
================
@@ -87,10 +87,11 @@ define amdgpu_kernel void @v_round_f64(ptr addrspace(1) %out, ptr addrspace(1) %
; SI-NEXT: v_not_b32_e32 v5, v5
; SI-NEXT: v_not_b32_e32 v4, v4
; SI-NEXT: v_and_b32_e32 v5, v3, v5
-; SI-NEXT: v_and_b32_e32 v4, v2, v4
; SI-NEXT: v_cmp_gt_i32_e32 vcc, 0, v6
+; SI-NEXT: v_and_b32_e32 v4, v2, v4
; SI-NEXT: v_cndmask_b32_e32 v5, v5, v7, vcc
-; SI-NEXT: v_cndmask_b32_e64 v4, v4, 0, vcc
+; SI-NEXT: v_cmp_lt_i32_e32 vcc, -1, v6
+; SI-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc
----------------
mihajlovicana wrote:
I think the reason is this leftover condition :
``` if (DAG.isConstantValueOfAnyType(True) && !DAG.isConstantValueOfAnyType(False)) {```
So even if the shouldSwap counter is over zero, the swap will only be performed on instructions that fulfill this condition
https://github.com/llvm/llvm-project/pull/142354
More information about the llvm-commits
mailing list