llvm-project
llvm-project copied to clipboard
[AMDGPU][GlobalISel] max(min(x, K1), K0) -> fmed3 combine is incorrect for qNaN inputs with ieee=false
The AMDGPU GlobalISel combine turns max(min(a, 4.0), 2.0) into v_med3_f32 a, 2.0, 4.0 with amdgpu-ieee=false when a is not sNaN. For a = qNaN, max(min(a, 4.0), 2.0) returns 4.0, but v_med3_f32 returns 2.0.
I have not checked whether SelectionDAG has the same issue.
Discovered here: https://github.com/llvm/llvm-project/pull/233986#discussion_r4562555578
@llvm/issue-subscribers-backend-amdgpu
Author: Eric Ross (ZERICO2005)
The AMDGPU GlobalISel combine turns `max(min(a, 4.0), 2.0)` into `v_med3_f32 a, 2.0, 4.0` with `amdgpu-ieee=false` when `a` is not sNaN. For `a = qNaN`, `max(min(a, 4.0), 2.0)` returns `4.0`, but `v_med3_f32` returns `2.0`.
Discovered here: https://github.com/llvm/llvm-project/pull/233986#discussion_r4562555578
i'd like to work in this
confirmed that SelectionDAG doesn't have this issue