[llvm] [RISCV,GISel] Add legalizer for G_ABS (PR #67577)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 10:43:07 PDT 2023


MaskRay wrote:

> Nit. The IRTranslator has probably generated something like:
> 
> ```
> G_INTRINSIC intrinsic(@llvm.abs.v2.32)
> ```
> 
> llvm.abs* is automatically supported. You code does not contain intrinsics.

irtranslator translates `%abs = tail call i32 @llvm.abs.i32(i32 %a, i1 true)` into `%3:_(s32) = G_ABS %0:_`. Without legalizer lowering `G_ABS` into `G_ASHR/G_ADD/G_XOR`, `G_ABS` fails to be selected. 

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


More information about the llvm-commits mailing list