llvm-project
d7fe2cf8 - [InstCombine] Widen Sel width after Cmp to generate Max/Min intrinsics. (#118932)

Commit
326 days ago
[InstCombine] Widen Sel width after Cmp to generate Max/Min intrinsics. (#118932) When Sel(Cmp) are in different integer type, From: (K and N mean width, K < N; a and b are src operands.) bN = Ext(bK) cond = Cmp(aN, bN) aK = Trunc aN retK = Sel(cond, aK, bK) To: bN = Ext(bK) cond = Cmp(aN, bN) retN = Sel(cond, aN, bN) retK = Trunc retN Though Sel's operands width becomes larger, the benefit of making type width in Sel the same as Cmp, is for combing to max/min intrinsics, and also better performance for SIMD instructions. References of correctness: https://alive2.llvm.org/ce/z/Y4Kegm https://alive2.llvm.org/ce/z/qFtjtR Reference of generated code comparision: https://gcc.godbolt.org/z/o97svGvYM https://gcc.godbolt.org/z/59Ynj91ov
Author
Parents
Loading