[llvm] [LLVM] Make use of s_flbit_i32_b64 and s_ff1_i32_b64 (PR #75158)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 02:04:34 PST 2023


================
@@ -3067,6 +3067,17 @@ SDValue AMDGPUTargetLowering::LowerCTLZ_CTTZ(SDValue Op, SelectionDAG &DAG) cons
     return NewOpr;
   }
 
+  //  64-bit scalar ctlz/cttz should use S_FLBIT_I32_B64/S_FF1_I32_B64
+  //  64-bit scalar version produce 32-bit result
+  if (!(Src->isDivergent()) && Src.getValueType() == MVT::i64) {
----------------
jayfoad wrote:

The type check should be an assert, since these ops should only be legal for i32 and i64.

But anyway this block should be merged with the block above - using "if (i32 or uniform i64) {...}". Only the final zext might need to be conditional.

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


More information about the llvm-commits mailing list