[llvm] [CodeGen] [AMDGPU] Adds pre-commit test for fmul-select combine (PR #111107)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 04:38:28 PDT 2024


arsenm wrote:

> > Test really high powers of 2. Particularly the cases where the exponent is > 64 (or < -16) and thus no longer an inline immediate
> 
> ```
> define float @fmul_select_f32_test11(float %x, i32 %bool.arg1, i32 %bool.arg2) {
>   %bool = icmp eq i32 %bool.arg1, %bool.arg2
>   %y = select i1 %bool, float -3.0223145e+23, float -7.2057594e+16
>   %ldexp = fmul float %x, %y
>   ret float %ldexp
> }
> ```
> 
> Note : **_-3.0223145e+23 = -2^78_** and _**-7.2057594e+16 = -2^56**_ Whats wrong with this as it is giving this error?
> 
> ```
> /opt/compiler-explorer/clang-trunk/bin/llc: error: /opt/compiler-explorer/clang-trunk/bin/llc: <source>:72:31: error: floating point constant invalid for type
>   %y = select i1 %bool, float -3.0223145e+23, float -7.2057594e+16

You can only use the decimal notation for cases that are exactly representable in decimal. You need to use the standard hex representation (I really wish the IR would switch to using C99 hex float notation) 

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


More information about the llvm-commits mailing list